orderDetailNewView.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <view class="orderDetailNewView">
  3. <view class="page-item" v-show="activeIndex === 0">
  4. <pageOne @handleNextClick="handleNextClick" :orderDetail="detail" :orderId="orderId" />
  5. </view>
  6. <view class="page-item" v-show="activeIndex === 1">
  7. <pageTwo @handleNextClick="handleNextClick" :orderDetail="detail" :orderId="orderId" :followUpList="followUpList" />
  8. </view>
  9. <view class="page-item" v-show="activeIndex === 2">
  10. <pageThree @handleNextClick="handleNextClick" :orderDetail="detail" @handleNeedSave="handleNeedSave"
  11. :receiptList="receiptList" @handleConfirmPay="handleConfirmPay" ref="pageThreeComp"
  12. :orderId="orderId" />
  13. </view>
  14. <view class="page-item" v-show="activeIndex === 3">
  15. <pageFour @confirmInterStore="confirmInterStore" @handleNextClick="handleNextClick" :orderDetail="detail"
  16. :receiptList="receiptList" />
  17. </view>
  18. <ul class="page">
  19. <li v-for="(tab, index) in tabs" :key="index" :class="{ 'active': activeIndex === index }"
  20. @click="activeIndex = index">{{ tab }}</li>
  21. </ul>
  22. </view>
  23. </template>
  24. <script>
  25. import pageOne from './pageOne.vue'
  26. import pageTwo from './pageTwo.vue'
  27. import pageThree from './pageThree.vue'
  28. import pageFour from './pageFour.vue'
  29. export default {
  30. props: {
  31. detail: {
  32. type: Object,
  33. default: () => { },
  34. },
  35. topInfo: {
  36. type: Object,
  37. default: () => { },
  38. },
  39. orderId: {
  40. type: String,
  41. default: ''
  42. }
  43. },
  44. components: {
  45. pageOne,
  46. pageTwo,
  47. pageThree,
  48. pageFour
  49. },
  50. data() {
  51. return {
  52. activeIndex: 0,
  53. tabs: ['一', '二', '三', '四'],
  54. allFroms: {
  55. formOne: {},
  56. formTwo: {},
  57. formThree: {},
  58. formFour: {},
  59. },
  60. pageThreeForm: {},
  61. fileIds: '',
  62. //收件信息page4
  63. receiptList: [],
  64. //订单细节
  65. orderDetail: {},
  66. // 跟进记录
  67. followUpList: [],
  68. }
  69. },
  70. name: 'OrderDetailNewView',
  71. watch: {
  72. orderId: {
  73. handler(newVal) {
  74. if (newVal) {
  75. this.fetchReceiptList();
  76. }
  77. }, immediate: true
  78. },
  79. detail: {
  80. handler(newVal) {
  81. if (newVal) {
  82. this.orderDetail = newVal;
  83. this.getFollowUpList();
  84. }
  85. },
  86. deep: true,
  87. }
  88. },
  89. methods: {
  90. handleNextClick({ nowPage, form }) {
  91. this.activeIndex++
  92. this.allFroms[nowPage] = form
  93. console.log("all page data:", this.allFroms[nowPage])
  94. // 当点击到第三页时,更新第三页的图片列表
  95. if (nowPage === 'formTwo') {
  96. this.$refs.pageThreeComp.getList('2', '3');
  97. }
  98. },
  99. // 没有recepitid就新增
  100. async saveData(params) {
  101. await uni.$u.api.addReceiptForm(params);
  102. },
  103. // 有recepitid就更新
  104. async updateData(params) {
  105. await uni.$u.api.updateReceiptForm(params);
  106. },
  107. handleNeedSave({ nowPage, form, fileIds }) {
  108. this.pageThreeForm = form;
  109. this.fileIds = fileIds;
  110. const params = {
  111. "searchValue": this.detail.searchValue,
  112. "createBy": this.detail.createBy,
  113. "createTime": this.detail.createTime,
  114. "updateBy": this.detail.updateBy,
  115. "updateTime": this.detail.updateTime,
  116. // "remark": , //发单备注,先不传
  117. "params": this.detail.params, //看接口文档
  118. "id": this.detail.receiptId,
  119. "sendFormId": this.orderId, //接单中心的id,就是接单中心列表的id(发单id)
  120. "clueId": this.detail.clueId,
  121. "item": this.detail.item,
  122. "brand": this.detail.brand,
  123. // "needCheckCode": 1, //先不传
  124. // "code": null, //先不传
  125. // "paymentAmount": null, //支付总额page3 先不传
  126. "phone": this.detail.phone,
  127. "tableFee": this.pageThreeForm.paymentAmount,//page3支付总额
  128. // "benefitFee": 200, //好处费page4加上
  129. // "freight": 30, //运费page4加上
  130. // "checkCodeFee": null, //查码费
  131. // "totalCost": "60230.00", // 成本合计 = 运费 + 好处费 + 查码费 + 表款(支付总额) + 维修费。
  132. "sellingPrice": this.topInfo.price.replace(/,/g, ''), //实际价格(售价)顶上tab里面的第三栏
  133. // "performance": "29772.00", //sellingPrice - totalCost
  134. // "receiptRemark": //"收单之后还需再跟进", 先不传
  135. // "repairAmount": null, //维修总金额 ,先不传
  136. // "grossPerformance": "7443.00", //毛利 performance*splitRatio
  137. // "expressOrderNo": null, //快递单号+后续加上一个键加上图url
  138. "fileIds": this.fileIds, //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
  139. "model": this.detail.model,
  140. // "splitRatio": "25", //分成比例,先不传
  141. "customerServiceName": "1", //默认传1,判断入库的类型,回收类入库,销售类入库,维保类入库,第四步传,增加选项下拉
  142. "deptId": this.detail.deptId,
  143. "category": this.detail.category,
  144. "delFlag": this.detail.delFlag,
  145. "idCard": this.pageThreeForm.idNumber,
  146. "paymentMethod": '小葫芦线上支付', //支付方式,如果是app里面默认传‘小葫芦线上支付’
  147. "bankCardNumber": this.pageThreeForm.bankAccount,
  148. "bankName": this.pageThreeForm.bankName,
  149. "customName": this.pageThreeForm.customName,
  150. }
  151. //调用接口保存收单表单
  152. if (this.detail.receiptId) {
  153. this.updateData(params);
  154. } else {
  155. this.saveData(params);
  156. }
  157. },
  158. // 确认支付
  159. handleConfirmPay() {
  160. // 调用支付接口
  161. this.pay();
  162. },
  163. //支付
  164. async pay() {
  165. // 开始支付
  166. console.log('开始支付')
  167. try {
  168. const response = await uni.$u.api.saveOrderFileAndTransfer({
  169. id: this.orderId,
  170. clueId: this.detail.clueId//线索id
  171. })
  172. uni.$u.toast(response.msg || '支付成功')
  173. } catch (error) {
  174. uni.$u.toast(`支付失败:${response.msg}`)
  175. }
  176. },
  177. //确认入库
  178. confirmInterStore({ warehouseInfo, profitSharingList }) {
  179. console.log(warehouseInfo, profitSharingList)
  180. const paramsInterStore = {
  181. "searchValue": this.detail.searchValue,
  182. "createBy": this.detail.createBy,
  183. "createTime": this.detail.createTime,
  184. "updateBy": this.detail.updateBy,
  185. "updateTime": this.detail.updateTime,
  186. // "remark": , //发单备注,先不传
  187. "params": this.detail.params, //看接口文档
  188. "id": this.detail.receiptId,
  189. "sendFormId": this.orderId, //接单中心的id,就是接单中心列表的id(发单id)
  190. "clueId": this.detail.clueId,
  191. "item": warehouseInfo.item || '',
  192. "brand": this.detail.brand,
  193. // "needCheckCode": 1, //先不传
  194. "code": warehouseInfo.codeStorage || '', //先不传
  195. // "paymentAmount": null, //支付总额page3 先不传
  196. "phone": this.detail.phone,
  197. "tableFee": warehouseInfo.watchPrice || '',//page3支付总额
  198. "benefitFee": warehouseInfo.benefitFee || '', //好处费page4加上
  199. "freight": warehouseInfo.freight || '', //运费page4加上
  200. "checkCodeFee": warehouseInfo.checkCodeFee || '', //查码费
  201. // "totalCost": "60230.00", // 成本合计 = 运费 + 好处费 + 查码费 + 表款(支付总额) + 维修费。
  202. "sellingPrice": this.topInfo.price.replace(/,/g, ''), //实际价格(售价)顶上tab里面的第三栏
  203. // "performance": "29772.00", //sellingPrice - totalCost
  204. "receiptRemark": warehouseInfo.remarks,//"收单之后还需再跟进", 先不传
  205. "repairAmount": warehouseInfo.repairAmount || '', //维修总金额 ,先不传
  206. "grossPerformance": warehouseInfo.grossPerformance || '', //毛利 performance*splitRatio
  207. "expressOrderNo": warehouseInfo.expressOrderNo || '', //快递单号+后续加上一个键加上图url
  208. "fileIds": this.fileIds, //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
  209. "model": this.detail.model,
  210. // "splitRatio": "25", //分成比例,先不传
  211. "customerServiceName": "1", //默认传1,判断入库的类型,回收类入库,销售类入库,维保类入库,第四步传,增加选项下拉
  212. "deptId": this.detail.deptId,
  213. "category": this.detail.category,
  214. "delFlag": this.detail.delFlag,
  215. "idCard": this.pageThreeForm.idNumber,
  216. "paymentMethod": '小葫芦线上支付', //支付方式,如果是app里面默认传‘小葫芦线上支付’
  217. "bankCardNumber": this.pageThreeForm.bankAccount,
  218. "bankName": this.pageThreeForm.bankName,
  219. "customName": this.pageThreeForm.customName,
  220. }
  221. //调用接口保存物流消息
  222. if (this.detail.receiptId) {
  223. this.updateData(paramsInterStore);
  224. } else {
  225. this.saveData(paramsInterStore);
  226. }
  227. },
  228. // 获取收单列表
  229. async fetchReceiptList() {
  230. try {
  231. const res = await uni.$u.api.clueReceiptFormListByOrderId(this.orderId);
  232. console.log('这里是收件列表', res)
  233. this.receiptList = res.data || [];
  234. } catch (error) {
  235. console.error("获取收单列表失败:", error);
  236. uni.$u.toast("获取收单列表失败");
  237. }
  238. },
  239. //获取跟进记录
  240. async getFollowUpList() {
  241. try {
  242. const res = await uni.$u.api.getDuplicateOrderFollowListByClueId({ clueId: this.orderDetail.clueId });
  243. const data = res.data || {};
  244. const followUpList = [];
  245. for (const key in data) {
  246. const element = data[key];
  247. followUpList.push(...element)
  248. }
  249. this.followUpList = followUpList;
  250. } catch (error) {
  251. console.error("获取跟进记录失败:", error);
  252. uni.$u.toast("获取跟进记录失败");
  253. }
  254. }
  255. },
  256. }
  257. </script>
  258. <style scoped>
  259. .orderDetailNewView {
  260. padding: 20rpx;
  261. }
  262. .page {
  263. position: fixed;
  264. right: 20rpx;
  265. top: 40%;
  266. display: flex;
  267. flex-direction: column;
  268. align-items: center;
  269. justify-content: center;
  270. list-style: none;
  271. color: #000;
  272. font-size: 20rpx;
  273. font-weight: 800;
  274. li {
  275. opacity: 0.7;
  276. display: flex;
  277. align-items: center;
  278. justify-content: center;
  279. background-color: #fff;
  280. border-radius: 50%;
  281. width: 70rpx;
  282. height: 70rpx;
  283. line-height: 80rpx;
  284. text-align: center;
  285. margin-bottom: 10rpx;
  286. transition: all 0.3s ease-in-out;
  287. font-weight: 800;
  288. }
  289. li.active {
  290. color: #fff;
  291. opacity: 1;
  292. background-color: rgb(37 99 235 / 1);
  293. }
  294. }
  295. </style>