orderDetailNewView.vue 12 KB

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