x-orderManagement.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <view style="width: 100%;">
  3. <view class="card_ordermang" v-for="(item,index) in orderList" :key="index" @click="goOrderDetails(item)">
  4. <view class="head_ordermang space_between">
  5. <view class="waybill_title">运单号:<span>{{item.waybillNo}}</span></view>
  6. <span class="card_state" :style="{color:getState(item.status)}">{{orderStatus(item.status)}}</span>
  7. </view>
  8. <view class="title_ordermang"><span>订单号:</span>{{item.orderNo}}</view>
  9. <view class="title_ordermang"><span>收货人地址:</span>{{item.consigneeAddressDetails}}</view>
  10. <view class="title_ordermang"><span>收货人电话:</span>{{item.consigneeAddressPhone}}</view>
  11. <view class="title_ordermang"><span>下单时间:</span>{{item.orderTime}}</view>
  12. <view style="display: flex;margin-top: 15rpx;"
  13. v-if="item.status == 1 || item.status == 2 || item.status == 3">
  14. <!-- <view class="btn_printil markd10"
  15. @click.stop="modifyOrder(item)">
  16. <u-button size="small" type="warning" text="修改运单"></u-button>
  17. </view>
  18. <view class="btn_printil markd10" @click.stop="antiDismantle(item)">
  19. <u-button size="small" type="primary" text="防拆标签"></u-button>
  20. </view>
  21. <view class="btn_printil markd10" @click.stop="sendOrders(item)">
  22. <u-button size="small" type="success" text="派单"></u-button>
  23. </view> -->
  24. <view class="btn_printil markd10" @click.stop="toDeliver(item)">
  25. <u-button size="small" type="success" text="去配送"></u-button>
  26. </view>
  27. </view>
  28. <view style="display: flex;" v-if="item.status == 4">
  29. <view class="btn_printil markd10" @click.stop="rejection(item)">
  30. <u-button size="small" type="error" text="拒收"></u-button>
  31. </view>
  32. <view class="btn_printil markd10" @click.stop="signFor(item)">
  33. <u-button size="small" type="primary" text="签收"></u-button>
  34. </view>
  35. </view>
  36. </view>
  37. <u-popup :show="signForShow" mode="center" round="6" closeable :closeOnClickOverlay="false" @close="close">
  38. <view class="center_in title_sign">{{signRejection}}</view>
  39. <view class="card_sign_for">
  40. <view class="img_sign_rejection">运单号: {{orderNumber}}</view>
  41. <view style="margin-bottom: 20rpx;" v-if="!rejectionFlag">
  42. <u-radio-group v-model="modePayment">
  43. <span style="font-size: 30rpx;margin: 0rpx 20rpx 15rpx 0rpx;">支付方式:</span>
  44. <u-radio style="margin: 0rpx 20rpx 15rpx 0rpx;" v-for="(item, index) in radiolist" :key="index"
  45. :label="item.name" :name="item.value"></u-radio>
  46. </u-radio-group>
  47. </view>
  48. <view style="margin-bottom: 20rpx;" v-if="!rejectionFlag">
  49. <u-radio-group v-model="statePayment">
  50. <span style="font-size: 30rpx;margin: 0rpx 20rpx 15rpx 0rpx;">支付状态:</span>
  51. <u-radio style="margin: 0rpx 20rpx 15rpx 0rpx;" v-for="(item, index) in stateList" :key="index"
  52. :label="item.name" :name="item.value"></u-radio>
  53. </u-radio-group>
  54. <view v-if="statePayment == 2">
  55. <u--input placeholder="请输入未结清备注" border="surround" v-model="remarksSettled"></u--input>
  56. </view>
  57. </view>
  58. <view class="card_image_sign">
  59. <view class="img_sign_rejection">{{signRejection}}图片</view>
  60. <u-upload :fileList="fileList1" name="1" multiple :maxCount="10" @afterRead="afterRead"
  61. @delete="deletePic"></u-upload>
  62. </view>
  63. <view class="card_image_sign">
  64. <view class="img_sign_rejection" @click="goSignature('client')">客户签字</view>
  65. <u-image :showLoading="true" :src="imageData" width="300rpx" height="155rpx"
  66. @click="goSignature('client')" mode="scaleToFill"></u-image>
  67. </view>
  68. <view class="rejection_card" v-if="rejectionFlag">
  69. <view class="img_sign_rejection">拒收原因</view>
  70. <u-textarea v-model="rejectionValue" placeholder="请输入拒收原因" autoHeight></u-textarea>
  71. </view>
  72. <u-button style="margin-top: 30rpx;" size="small" type="primary" text="确定"
  73. @click="confirm()"></u-button>
  74. </view>
  75. </u-popup>
  76. <u-popup :show="antiShow" mode="center" closeable :closeOnClickOverlay="false" round="6" @close="close">
  77. <view class="card_dismantle">
  78. <view class="headline_anti">防拆标签</view>
  79. <x-form ref="goods" :list="goodsList" :model="goodsModel" :rules="goodsRules"></x-form>
  80. <u-button style="margin-top: 10rpx;" size="small" type="primary" text="确定"
  81. @click="modifiedTamper()"></u-button>
  82. </view>
  83. </u-popup>
  84. </view>
  85. </template>
  86. <script>
  87. const ENV = require('@/.env.js')
  88. import {
  89. formRules,
  90. } from "./waybill.js";
  91. export default {
  92. name: 'xOrderManagement',
  93. props: {
  94. // 运单列表
  95. orderList: {
  96. type: Array,
  97. default: () => [],
  98. },
  99. userInfo: {
  100. type: Object,
  101. default: () => {},
  102. }
  103. },
  104. data() {
  105. return {
  106. signForShow: false,
  107. fileList1: [],
  108. rejectionValue: '',
  109. rejectionFlag: false,
  110. signRejection: '',
  111. orderNumber: '',
  112. imageUrl: '',
  113. antiShow: false,
  114. goodsList: formRules(),
  115. goodsModel: {
  116. tamperProofLabel: '',
  117. tamperProofLabelImg: '',
  118. },
  119. goodsRules: {
  120. tamperProofLabel: {
  121. required: true,
  122. message: '请输入防拆标签码',
  123. trigger: ['blur', 'change']
  124. },
  125. tamperProofLabelImg: {
  126. required: true,
  127. message: '请上传防拆标签图片',
  128. trigger: ['blur', 'change']
  129. },
  130. },
  131. antiList: {},
  132. imageData: '',
  133. radiolist: [{
  134. name: '现金',
  135. value: 1,
  136. }, {
  137. name: '线上支付',
  138. value: 2,
  139. }, {
  140. name: '银行卡',
  141. value: 3,
  142. }, {
  143. name: '医保',
  144. value: 4,
  145. }, {
  146. name: '其他',
  147. value: 5,
  148. }],
  149. stateList: [{
  150. name: '已结清',
  151. value: 1,
  152. }, {
  153. name: '未结清',
  154. value: 2,
  155. }],
  156. modePayment: null,
  157. statePayment: null,
  158. remarksSettled: '',
  159. }
  160. },
  161. mounted() {
  162. // console.log(this.userInfo, 26)
  163. },
  164. methods: {
  165. // 打印条码
  166. printBarCode(value) {
  167. this.$cache.setCache('commodity', JSON.stringify(value))
  168. uni.navigateTo({
  169. url: '/pages/order/quantum?waybillNo=' + value.waybillNo + '&printType=barCode'
  170. });
  171. },
  172. // 派单
  173. sendOrders(value) {
  174. this.$emit('sendOrders', value)
  175. },
  176. // 防拆标签
  177. antiDismantle(value) {
  178. this.antiList = value
  179. this.antiShow = true
  180. this.goodsModel.tamperProofLabel = value.tamperProofLabel
  181. this.goodsModel.tamperProofLabelImg = value.tamperProofLabelImg
  182. this.goodsModel.id = value.id
  183. if (value.tamperProofLabelImg) {
  184. let arrImg = value.tamperProofLabelImg.split(',')
  185. let arrImgList = []
  186. arrImg.forEach((item) => {
  187. const arr = {
  188. url: item,
  189. }
  190. arrImgList.push(arr)
  191. })
  192. this.$nextTick(() => {
  193. this.$refs.goods.fileList1 = arrImgList
  194. })
  195. }
  196. },
  197. // 去配送
  198. toDeliver(event) {
  199. uni.setStorageSync('incubatorValue', event.coolerBox)
  200. uni.setStorageSync('orderValue', JSON.stringify(event))
  201. uni.navigateTo({
  202. url: '/pages/order/dispatching'
  203. });
  204. },
  205. // 拒收
  206. rejection(value) {
  207. this.orderNumber = value.waybillNo
  208. this.signForShow = true
  209. this.rejectionFlag = true
  210. this.signRejection = '拒收'
  211. },
  212. // 签收
  213. signFor(value) {
  214. this.orderNumber = value.waybillNo
  215. this.signForShow = true
  216. this.rejectionFlag = false
  217. this.signRejection = '签收'
  218. },
  219. // 确定签收/拒收
  220. confirm() {
  221. let params = {
  222. waybillNo: this.orderNumber,
  223. receiptImg: this.imageUrl,
  224. status: 5,
  225. rejectionReason: this.rejectionValue,
  226. receiptsign: this.imageData,
  227. paymentType: this.modePayment,
  228. paymentStatus: this.statePayment,
  229. paymentremark: this.remarksSettled,
  230. }
  231. let verify = false
  232. if (this.rejectionFlag) {
  233. params.status = 6
  234. verify = this.verification(params)
  235. } else {
  236. params.status = 5
  237. verify = this.verification(params)
  238. }
  239. if (verify) {
  240. this.$api.post('/api/waybill/receipt', params).then(res => {
  241. if (res.code == 200) {
  242. this.signForShow = false
  243. uni.$u.toast(res.msg)
  244. this.$emit('operateSuccessfully')
  245. } else {
  246. uni.$u.toast(res.msg)
  247. }
  248. })
  249. }
  250. },
  251. // 拒收签收验证
  252. verification(params) {
  253. let flag = false
  254. if (this.rejectionFlag) {
  255. if (params.receiptImg) {
  256. flag = true
  257. } else {
  258. uni.$u.toast('请上传' + this.signRejection + '图片')
  259. }
  260. } else {
  261. if (params.paymentType) {
  262. if (params.paymentStatus) {
  263. if (params.receiptImg) {
  264. flag = true
  265. } else {
  266. uni.$u.toast('请上传' + this.signRejection + '图片')
  267. }
  268. } else {
  269. uni.$u.toast('请选择支付状态')
  270. }
  271. } else {
  272. uni.$u.toast('请选择支付方式')
  273. }
  274. }
  275. return flag
  276. },
  277. // 修改防拆标签
  278. async modifiedTamper() {
  279. let flag2 = await this.$refs['goods'].validateForm();
  280. if (flag2) {
  281. let params = {
  282. senderAddressName: this.antiList.senderAddressName,
  283. senderAddressPhone: this.antiList.senderAddressPhone,
  284. senderAddressDetails: this.antiList.senderAddressDetails,
  285. consigneeAddressName: this.antiList.consigneeAddressName,
  286. consigneeAddressPhone: this.antiList.consigneeAddressPhone,
  287. consigneeAddressDetails: this.antiList.consigneeAddressDetails,
  288. deliveryName: this.antiList.deliveryName,
  289. deliveryPhone: this.antiList.deliveryPhone,
  290. ...this.goodsModel,
  291. }
  292. uni.showLoading();
  293. // 修改运单
  294. this.$api.put('/api/waybill', params).then(res => {
  295. if (res.code == 200) {
  296. this.antiShow = false
  297. uni.$u.toast(res.msg)
  298. this.$emit('proofRenewal')
  299. } else {
  300. uni.$u.toast('修改失败')
  301. }
  302. uni.hideLoading();
  303. }).catch(() => {
  304. uni.hideLoading();
  305. })
  306. }
  307. },
  308. // 打印温湿度记录
  309. humidityRecording(value) {
  310. this.$cache.setCache('commodity', JSON.stringify(value))
  311. uni.navigateTo({
  312. url: '/pages/order/quantum?waybillNo=' + value.waybillNo + '&printType=record'
  313. });
  314. },
  315. // 修改运单
  316. modifyOrder(value) {
  317. this.$cache.setCache('orderDetails', value)
  318. uni.redirectTo({
  319. url: '/pages/order/addWaybill?title=修改运单&type=2'
  320. });
  321. },
  322. // 运单详情
  323. goOrderDetails(value) {
  324. this.$cache.setCache('orderDetails', value)
  325. uni.navigateTo({
  326. url: '/pages/order/orderDetails?type=details'
  327. });
  328. },
  329. // 运单状态
  330. orderStatus(value) {
  331. if (value == 3) {
  332. return '待配送'
  333. } else if (value == 4) {
  334. return '配送中'
  335. } else if (value == 5) {
  336. return '已送达'
  337. } else if (value == 6) {
  338. return '已拒收'
  339. }
  340. },
  341. // 运单文字颜色
  342. getState(value) {
  343. if (value == 3) {
  344. return '#9ddd54'
  345. } else if (value == 4) {
  346. return '#4bc7fc'
  347. } else if (value == 5) {
  348. return '#1cc723'
  349. } else if (value == 6) {
  350. return '#fe880e'
  351. }
  352. },
  353. // 新增图片
  354. async afterRead(event) {
  355. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  356. let lists = [].concat(event.file)
  357. let fileListLen = this[`fileList${event.name}`].length
  358. lists.map((item) => {
  359. this[`fileList${event.name}`].push({
  360. ...item,
  361. status: 'uploading',
  362. message: '上传中'
  363. })
  364. })
  365. uni.showLoading({
  366. title: '上传中',
  367. mask: true,
  368. })
  369. for (let i = 0; i < lists.length; i++) {
  370. const result = await this.uploadFilePromise(lists[i].url)
  371. let item = this[`fileList${event.name}`][fileListLen]
  372. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  373. status: 'success',
  374. message: '',
  375. url: result
  376. }))
  377. fileListLen++
  378. }
  379. var arr = []
  380. this.fileList1.forEach(item1 => {
  381. arr.push(item1.url)
  382. })
  383. uni.hideLoading();
  384. this.imageUrl = arr.join()
  385. },
  386. // 删除图片
  387. deletePic(event) {
  388. this[`fileList${event.name}`].splice(event.index, 1)
  389. var arr = []
  390. this.fileList1.forEach(item1 => {
  391. arr.push(item1.url)
  392. })
  393. this.imageUrl = arr.join()
  394. },
  395. // 签字
  396. goSignature(title) {
  397. uni.navigateTo({
  398. url: '/pages/order/signatureBoard'
  399. });
  400. },
  401. uploadFilePromise(url) {
  402. return new Promise((resolve, reject) => {
  403. let a = uni.uploadFile({
  404. url: ENV.APP_DEV_URL + '/api/upload', // 仅为示例,非真实的接口地址
  405. filePath: url,
  406. name: 'file',
  407. header: {
  408. 'Authorization': 'Bearer ' + uni.getStorageSync('access_token'),
  409. },
  410. success: (res) => {
  411. let state = JSON.parse(res.data)
  412. setTimeout(() => {
  413. if (state.code == 200) {
  414. resolve(state.data)
  415. }
  416. }, 100)
  417. }
  418. });
  419. })
  420. },
  421. close() {
  422. this.signForShow = false
  423. this.modePayment = null
  424. this.statePayment = null
  425. this.remarksSettled = ''
  426. this.fileList1 = []
  427. this.imageData = ''
  428. this.rejectionValue = ''
  429. this.antiShow = false
  430. },
  431. }
  432. }
  433. </script>
  434. <style lang="scss">
  435. .card_ordermang {
  436. background-color: #fff;
  437. padding: 20rpx;
  438. border-radius: 10rpx;
  439. margin: 20rpx;
  440. }
  441. .head_ordermang {
  442. margin-bottom: 10rpx;
  443. }
  444. .title_ordermang {
  445. margin-top: 10rpx;
  446. font-size: 26rpx;
  447. color: #909399;
  448. span {
  449. font-size: 26rpx;
  450. color: #909399;
  451. margin-right: 10rpx;
  452. }
  453. }
  454. .waybill_title {
  455. font-size: 30rpx;
  456. span {
  457. margin-left: 10rpx;
  458. }
  459. }
  460. .card_state {
  461. color: #606266;
  462. font-size: 28rpx;
  463. }
  464. .card_specification {
  465. display: flex;
  466. align-items: center;
  467. }
  468. .specification_title {
  469. margin-right: 20rpx;
  470. }
  471. .btn_printil {
  472. flex: 1;
  473. margin-top: 10px;
  474. }
  475. .markd10:nth-child(1) {
  476. margin: 10rpx 10rpx 0rpx 0rpx;
  477. }
  478. .markd10:nth-child(2) {
  479. margin: 10rpx 0rpx 0rpx 10rpx;
  480. }
  481. .markd10:nth-child(3) {
  482. margin: 10rpx 0rpx 0rpx 20rpx;
  483. }
  484. .title_sign {
  485. padding: 10rpx 0rpx;
  486. height: 60rpx;
  487. }
  488. .card_sign_for {
  489. width: 640rpx;
  490. padding: 10rpx 30rpx 30rpx 30rpx;
  491. }
  492. .rejection_card {
  493. margin-bottom: 20rpx;
  494. }
  495. .card_image_sign {
  496. display: flex;
  497. flex-direction: column;
  498. margin-bottom: 10rpx;
  499. }
  500. .img_sign_rejection {
  501. font-size: 30rpx;
  502. margin-bottom: 20rpx;
  503. }
  504. .card_dismantle {
  505. padding: 30rpx;
  506. }
  507. .headline_anti {
  508. font-size: 38rpx;
  509. font-weight: 600;
  510. display: flex;
  511. justify-content: center;
  512. border-bottom: 1rpx solid #e7e6e4;
  513. padding-bottom: 15rpx;
  514. margin-bottom: 15rpx;
  515. align-items: center;
  516. }
  517. ::v-deep .u-radio-group--row {
  518. flex-wrap: wrap;
  519. }
  520. </style>