orderDetailNewView.vue 11 KB

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