pagereceivecenter.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <script>
  2. // import orderCard from "./compounts/orderCard.vue";
  3. export default {
  4. components: {
  5. // orderCard,
  6. },
  7. data() {
  8. return {
  9. orderList: [],
  10. page: {
  11. pageSize: 10,
  12. pageNum: 1,
  13. total: 0
  14. },
  15. tagModalVisible: false,
  16. tagList: [],
  17. currentTags: [],
  18. currentOrder: {},
  19. followUpModelShow: false,
  20. followUpNotes: '',
  21. }
  22. },
  23. onLoad() {
  24. //初始调用
  25. this.getOrderList();
  26. // uni.navigateTo({
  27. // url: `/pages/orderDetailNew/index?orderId=5464&item=测试发单&type=undefined&clueId=1973381744953516033`,
  28. // })
  29. },
  30. methods: {
  31. //获取列表数据
  32. async getOrderList() {
  33. try {
  34. const result = await uni.$u.api.selectClueOrderFormList({
  35. pageSize: this.page.pageSize,
  36. pageNum: this.page.pageNum,
  37. });
  38. console.log('接单列表', result);
  39. // 把数组按照status的大小排序,从小到大
  40. result.rows.sort((a, b) => {
  41. return a.status - b.status;
  42. })
  43. this.orderList.push(...result.rows);
  44. this.page.total = result.total;
  45. } catch (error) {
  46. console.error('接单列表接口调用失败:', error);
  47. // 添加用户友好的错误提示
  48. uni.$u.toast('获取订单列表失败,请稍后重试');
  49. }
  50. },
  51. // 处理按钮点击事件
  52. handleBtnClick(btnType, order) {
  53. if (btnType == 'acceptOrder') {
  54. //去接单
  55. console.log('去接单', order)
  56. //打开模态窗二次确认,确认后跳转接单form
  57. uni.showModal({
  58. title: '确认接单',
  59. content: `是否确认接单订单:${order.item}?`,
  60. success: async (res) => {
  61. if (res.confirm) {
  62. await uni.$u.api.oderForm({
  63. status: "2",
  64. id: order.id,
  65. });
  66. uni.navigateTo({
  67. url: `/pages/orderDetailNew/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
  68. })
  69. } else if (res.cancel) {
  70. // 用户点击了取消,不执行任何操作
  71. uni.$u.toast('已取消接单');
  72. }
  73. }
  74. })
  75. } else if (btnType == 'isBusy') {
  76. //在忙
  77. console.log('在忙', order)
  78. //当前订单移动到末尾
  79. this.orderList.push(this.orderList.splice(this.orderList.indexOf(order), 1)[0]);
  80. } else if (btnType == 'willFollow') {
  81. //待跟进
  82. console.log('待跟进', order)
  83. //打开模态窗
  84. this.followUpModelShow = true;
  85. this.currentOrder = order
  86. } else if (btnType == 'tag') {
  87. //打标签
  88. console.log('打标签', order)
  89. //打开模态窗
  90. this.tagModalVisible = true;
  91. this.getAllTags();
  92. this.currentTags = order.tags.map(tag => tag.id);
  93. this.currentOrder = order
  94. } else if (btnType == 'share') {
  95. //一键分享
  96. console.log('一键分享', order)
  97. } else if (btnType == 'oneFollow') {
  98. //待跟进
  99. console.log('待跟进', order)
  100. this.followUpModelShow = true;
  101. this.currentOrder = order
  102. }
  103. },
  104. // 跳转订单详情
  105. toOrderDetail(order) {
  106. //点卡片看详情
  107. // if (order.status == '1' || order.status == '2') {
  108. uni.navigateTo({
  109. url: `/pages/orderDetailNew/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
  110. })
  111. // } else {
  112. // uni.$u.toast('当前订单无法查看详情');
  113. // return;
  114. // }
  115. },
  116. //滑动加载
  117. scrolltolower() {
  118. console.log('到底了');
  119. // if (this.orderList.length >= this.page.total) {
  120. // return uni.$u.toast('没有更多了');
  121. // }
  122. this.page.pageNum++;
  123. this.getOrderList();
  124. },
  125. //获取全部标签
  126. async getAllTags() {
  127. const res = await uni.$u.api.getClueTagGroupVoList({ tagGroupApplication: '2' })
  128. console.log('全部标签', res.data[0].clueTagDataList)
  129. this.tagList = res.data[0].clueTagDataList;
  130. },
  131. cancelTag() {
  132. this.tagModalVisible = false;
  133. },
  134. async confirmTag() {
  135. console.log('确认打标签', this.currentTags)
  136. // 这里可以添加打标签的逻辑
  137. const allTags = this.currentTags.map(tag => tag).join(',');
  138. console.log('allTags', allTags)
  139. await uni.$u.api.updateTags({
  140. id: this.currentOrder.id,
  141. allTags: allTags,
  142. })
  143. this.tagModalVisible = false;
  144. uni.$u.toast('标签更新成功');
  145. //更新当前订单的标签
  146. this.currentOrder.tags = this.tagList.filter(tag => this.currentTags.includes(tag.id));
  147. },
  148. // 确认跟进细节按钮点击事件
  149. async confirmFollowUp() {
  150. console.log('确认跟进细节:', this.followUpNotes);
  151. this.followUpModelShow = false;
  152. // 可以在这里添加提交跟进细节的逻辑
  153. // 未收的时候,提交一个跟进记录 待跟进_内容
  154. const res = await uni.$u.api.addOrderFollow({
  155. orderId: this.currentOrder.id,
  156. content: `待跟进_${this.followUpNotes}`,
  157. })
  158. if (res.code == 200) {
  159. uni.$u.toast('提交待跟进记录成功');
  160. }
  161. },
  162. }
  163. }
  164. </script>
  165. <template>
  166. <view class="container">
  167. <u-navbar title="接单中心" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
  168. <view class="scrollViewContainer">
  169. <scroll-view class="scrollView" scroll-y @scrolltolower="scrolltolower">
  170. <transition-group name="order-move" tag="div">
  171. <!-- <orderCard v-for="item in orderList" :key="item.receiptId + item.id" :order="item"
  172. @handleBtnClick="handleBtnClick">
  173. </orderCard> -->
  174. <view class="orderCard" v-for="item in orderList" :key="item.receiptId + item.id"
  175. @click.stop="toOrderDetail(item)">
  176. <view class="bandAndPrice">
  177. <view class="bandName">{{ item.itemBrand || '暂无品牌' }}</view>
  178. <view class="price">¥{{ item.priceRange || '?' }}</view>
  179. </view>
  180. <view class="mainLind">
  181. <!-- <view class="mainLindImg">
  182. <image :src="'/static/acceptOrder/orderCardPic.jpg'" v-if="item.src" />
  183. </view> -->
  184. <view class="mainLindInfo">
  185. <view class="itemName">{{ item.item || '暂无项目' }}</view>
  186. <view>发单人:{{ item.createNickName || '未知' }}</view>
  187. <view>机构:{{ item.orgName || '暂无机构' }}</view>
  188. <view>电话:{{ item.phone || '暂无电话' }}</view>
  189. <view>所属人:{{ item.clueOwnerName || '暂无所属人' }}</view>
  190. <view>运营人:{{ item.clueOperationName || '暂无运营人' }}</view>
  191. <view>发单日期:{{ item.sendDate || '暂无时间' }}</view>
  192. </view>
  193. </view>
  194. <view class="tags">
  195. <view class="tag" v-for="(tag, index) in item.tags" :key="index"
  196. :style="{ backgroundColor: tag.color, opacity: 0.8 }">
  197. {{ tag.name }}</view>
  198. </view>
  199. <view class="Btns">
  200. <view class="btnGroup"
  201. v-if="item && (item.status == '1' || item.status == null || item.status === undefined)">
  202. <view class="card-button" @click.stop="handleBtnClick('acceptOrder', item)">立即接单</view>
  203. <view class=" card-button isBusy" @click.stop="handleBtnClick('isBusy', item)">在忙</view>
  204. </view>
  205. <view class="btnGroup"
  206. v-if="item && (item.status == '2' || item.status == null || item.status === undefined)">
  207. <view class="card-button willFollow" @click.stop="handleBtnClick('willFollow', item)">
  208. 待跟进
  209. </view>
  210. <view class="card-button isBusy" @click.stop="handleBtnClick('tag', item)">打标签</view>
  211. </view>
  212. <view class="btnGroup"
  213. v-if="item && (item.status == '3' || item.status == null || item.status === undefined)">
  214. <view class="card-button share" @click.stop="handleBtnClick('share', item)">一键分享</view>
  215. </view>
  216. <view class="btnGroup"
  217. v-if="item && (item.status == '4' || item.status == null || item.status === undefined)">
  218. <view class="card-button oneFollow" @click.stop="handleBtnClick('oneFollow', item)">待跟进
  219. </view>
  220. </view>
  221. </view>
  222. </view>
  223. </transition-group>
  224. <view class="hasMore">
  225. <!-- {{ orderList.length >= page.total ? '没有更多了~' : '向下滑动加载更多~' }} -->
  226. </view>
  227. </scroll-view>
  228. </view>
  229. <!-- 打标签模态窗 -->
  230. <u-modal :show="tagModalVisible" title="选择标签" @confirm="confirmTag" @cancel="cancelTag">
  231. <view class="slot-content">
  232. <u-checkbox-group v-model="currentTags" placement="column">
  233. <u-checkbox :customStyle="{ marginBottom: '8px' }" v-for="(item, index) in tagList" :key="item.id"
  234. :label="item.name" :name="item.id">
  235. </u-checkbox>
  236. </u-checkbox-group>
  237. </view>
  238. </u-modal>
  239. <u-modal :show="followUpModelShow" :title="'填写跟进细节'" :showConfirmButton="false">
  240. <view class="modal-content">
  241. <u--textarea v-model="followUpNotes" placeholder="请输入情况" confirm-type="done"
  242. style="width: 400rpx; margin-bottom: 30rpx;"></u--textarea>
  243. <u-button type="primary" size="large" @click="confirmFollowUp">确认</u-button>
  244. </view>
  245. </u-modal>
  246. </view>
  247. </template>
  248. <style scoped lang="scss">
  249. .hasMore {
  250. text-align: center;
  251. padding: 20rpx 0;
  252. font-size: 24rpx;
  253. color: #999;
  254. }
  255. .scrollViewContainer {
  256. height: calc(100vh - 44px);
  257. }
  258. .scrollView {
  259. height: 100%;
  260. }
  261. /* 订单移动动画 */
  262. .order-move-enter-active,
  263. .order-move-leave-active {
  264. transition: all 0.5s ease;
  265. }
  266. .order-move-enter-from,
  267. .order-move-leave-to {
  268. opacity: 0;
  269. transform: translateY(30px);
  270. }
  271. .order-move-move {
  272. transition: transform 0.5s ease;
  273. }
  274. /* 订单卡片主容器 */
  275. .orderCard {
  276. box-sizing: border-box;
  277. width: 95%;
  278. background-color: #fff;
  279. margin: 20rpx auto;
  280. border-radius: 20rpx;
  281. padding: 20rpx;
  282. }
  283. /* 品牌和价格区域 */
  284. .orderCard .bandAndPrice {
  285. display: flex;
  286. justify-content: space-between;
  287. align-items: center;
  288. }
  289. /* 品牌名称 */
  290. .orderCard .bandAndPrice .bandName {
  291. font-size: 20rpx;
  292. font-weight: 700;
  293. border: 2px solid #2563EB;
  294. padding: 6rpx 12rpx;
  295. border-radius: 15rpx;
  296. background-color: #EFF6FF;
  297. color: #2563EB;
  298. }
  299. /* 价格 */
  300. .orderCard .bandAndPrice .price {
  301. font-size: 30rpx;
  302. font-weight: 700;
  303. }
  304. /* 主要内容行 */
  305. .orderCard .mainLind {
  306. margin-top: 10rpx;
  307. display: flex;
  308. justify-content: space-between;
  309. align-items: center;
  310. gap: 20rpx;
  311. }
  312. /* 主要内容行图片容器 */
  313. .orderCard .mainLind .mainLindImg image {
  314. width: 150rpx;
  315. height: 150rpx;
  316. border-radius: 20rpx;
  317. }
  318. /* 主要内容行信息容器 */
  319. .orderCard .mainLind .mainLindInfo {
  320. flex: 1;
  321. display: flex;
  322. flex-direction: column;
  323. gap: 10rpx;
  324. font-size: 24rpx;
  325. color: #6b7280;
  326. }
  327. /* 商品名称 */
  328. .orderCard .mainLind .mainLindInfo .itemName {
  329. font-size: 30rpx;
  330. font-weight: 700;
  331. color: #374751;
  332. }
  333. /* 标签区域 */
  334. .orderCard .tags {
  335. display: flex;
  336. gap: 10rpx;
  337. }
  338. /* 单个标签 */
  339. .orderCard .tags .tag {
  340. font-size: 20rpx;
  341. font-weight: 700;
  342. padding: 6rpx 12rpx;
  343. border-radius: 15rpx;
  344. background-color: #EFF6FF;
  345. color: #fff;
  346. }
  347. /* 按钮区域 */
  348. .orderCard .Btns {
  349. margin-top: 10rpx;
  350. }
  351. /* 按钮组 */
  352. .orderCard .Btns .btnGroup {
  353. display: flex;
  354. justify-content: space-between;
  355. align-items: center;
  356. gap: 20rpx;
  357. }
  358. /* 卡片按钮基础样式 */
  359. .orderCard .Btns .btnGroup .card-button {
  360. font-size: 24rpx;
  361. font-weight: 700;
  362. border: 2rpx solid #2563EB;
  363. padding: 6rpx 12rpx;
  364. border-radius: 15rpx;
  365. background-color: #2563EB;
  366. color: #fff;
  367. width: 45%;
  368. text-align: center;
  369. cursor: pointer;
  370. height: 60rpx;
  371. line-height: 60rpx;
  372. }
  373. /* 忙碌状态按钮 */
  374. .orderCard .Btns .btnGroup .card-button.isBusy {
  375. background-color: #fff;
  376. color: #6B7280;
  377. border-color: #6B7280;
  378. }
  379. /* 待跟进状态按钮 */
  380. .orderCard .Btns .btnGroup .card-button.willFollow {
  381. background-color: #EFF6FF;
  382. color: #2563EB;
  383. }
  384. /* 分享按钮 */
  385. .orderCard .Btns .btnGroup .card-button.share {
  386. width: 100%;
  387. }
  388. /* 单独跟进按钮 */
  389. .orderCard .Btns .btnGroup .card-button.oneFollow {
  390. width: 100%;
  391. background-color: #EFF6FF;
  392. color: #2563EB;
  393. }
  394. </style>