orderDetailNewView.vue 11 KB

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