orderDetailNewView.vue 13 KB

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