deliver-record.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <template>
  2. <view class="container record clearfix" :style="{ paddingTop: CustomBar + 'px' }">
  3. <cd-custom
  4. :systeminfo="systeminfo"
  5. :navbar-data="nvabarData"
  6. :headerBtnPosi="headerBtnPosi"
  7. :page="1"
  8. @pageDetails="hanldPageDetails"
  9. ></cd-custom>
  10. <view
  11. class="record-content-empty"
  12. v-if="isEmpty"
  13. :style="{ height: windowHeight ? windowHeight - CustomBar + 'px' : 'auto' }"
  14. >
  15. <view class="record-container clearfix">
  16. <image
  17. class="club-empty-image"
  18. src="https://img.caimei365.com/group1/M00/03/B7/Cmis2178OfaAEjhLAABqsz9OXM0847.png"
  19. mode="aspectFit"
  20. ></image>
  21. <view class="txt">此订单暂无发货记录~</view> <view class="btn" @click="pageGoLink">去发货</view>
  22. </view>
  23. </view>
  24. <view class="record-content" v-else>
  25. <scroll-view scroll-y="true" class="scroll-view">
  26. <view class="record-list clearfix" v-for="(item, index) in RecordList" :key="index">
  27. <view class="record-top clearfix">
  28. <view class="top-view">
  29. <view class="top-viewlabel">发货时间:</view>
  30. <view class="top-viewtext">{{ item.deliveryTime }}</view>
  31. </view>
  32. <view class="top-view" v-for="(logist, idx) in item.logisticsInformationList" :key="logist.id">
  33. <view class="top-viewlabel">{{ logist.logisticsCompanyName }}:</view>
  34. <view class="top-viewtext">
  35. <text>{{ logist.nu }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="goods-pros">
  40. <view class="goods-pros-t" v-for="(pros, idx) in item.logisticsRecordList" :key="pros.id">
  41. <view class="pros-img"
  42. ><image :src="pros.image ? pros.image : ''" alt="" mode="aspectFill"
  43. /></view>
  44. <view class="pros-product">
  45. <view class="producttitle">{{ pros.productName }}</view>
  46. <view class="productspec">规格:{{ pros.unit ? pros.unit : '' }}</view>
  47. <view class="productspec">商品编码:{{ pros.productCode ? pros.productCode : '' }}</view>
  48. <view class="product-view">
  49. <view class="view-num">数量:{{ pros.buyNum }}</view>
  50. </view>
  51. <view class="product-view">
  52. <view class="view-num">本次发货:{{ pros.num }}</view>
  53. <view class="view-num">已发货:{{ pros.shipmentsNum }}</view>
  54. </view>
  55. <view class="product-view">
  56. <view class="view-num">未发货:{{ pros.notShippedNum }}</view>
  57. <view class="view-num">已退货:{{ pros.returnedNum }}</view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="goods-pros-b clearfix" v-show="item.remarkImages && item.remarkImages.length > 0">
  62. <view class="b-label">拍照备注</view>
  63. <view class="b-photo">
  64. <view class="b-imageView" v-for="(imgItem, imgIdx) in item.remarkImages" :key="imgIdx">
  65. <image
  66. :src="imgItem"
  67. mode="aspectFill"
  68. @click="previewImg(imgIdx, item.remarkImages)"
  69. ></image>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="goods-pros-b clearfix" v-if="item.remark != ''">
  74. <view class="b-label">文字备注</view>
  75. <view class="b-photo">
  76. <view class="text">{{ item.remark ? item.remark : '' }}</view>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 底部button -->
  81. <order-button ref="orderButton" :hanldData="item" @buttonConfirm="handButtonConfirm">
  82. </order-button>
  83. </view>
  84. <!--加载loadding-->
  85. <tui-loadmore :visible="loadding" :index="3" type="black" />
  86. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText" />
  87. <!--加载loadding-->
  88. </scroll-view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import { mapState, mapMutations } from 'vuex'
  94. import orderButton from './components/supplierRecorgButton.vue' //底部按钮
  95. import cdCustom from '@/components/cm-custom/custom-d'
  96. var isPreviewImg
  97. export default {
  98. components: {
  99. orderButton,
  100. cdCustom
  101. },
  102. data() {
  103. return {
  104. nvabarData: {
  105. //顶部自定义导航
  106. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  107. title: '发货记录' // 导航栏 中间的标题
  108. },
  109. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  110. systeminfo: this.setSysteminfo(), //获取设备信息
  111. CustomBar: this.CustomBar, // 顶部导航栏高度
  112. isIphoneX: this.$store.state.isIphoneX,
  113. listQuery: {
  114. shopOrderId: 0,
  115. pageNum: 1,
  116. pageSize: 10
  117. },
  118. lgisList: [],
  119. ramkesList: [],
  120. RecordList: [], //发货记录
  121. hasNextPage: false,
  122. loadding: false,
  123. pullUpOn: true,
  124. pullFlag: true,
  125. isEmpty: false,
  126. nomoreText: '上拉显示更多',
  127. scrollHeight: '',
  128. windowHeight: '',
  129. mobile: 0
  130. }
  131. },
  132. onLoad(option) {
  133. this.listQuery.shopOrderId = option.shopOrderId
  134. this.setScrollHeight()
  135. this.initShopShipmentsRecord()
  136. },
  137. computed: {
  138. ...mapState(['hasLogin', 'userInfo'])
  139. },
  140. methods: {
  141. initShopShipmentsRecord() {
  142. //初始化发货记录 index:1
  143. this.ShopService.ShopShipmentsRecord(this.listQuery)
  144. .then(response => {
  145. console.log(response)
  146. let data = response.data
  147. let logisticsBatchPage = data.logisticsBatchPage
  148. this.mobile = data.userInfo.mobile
  149. if (logisticsBatchPage.list && logisticsBatchPage.list.length > 0) {
  150. this.isEmpty = false
  151. this.hasNextPage = logisticsBatchPage.hasNextPage
  152. this.RecordList = logisticsBatchPage.list
  153. this.pullFlag = false
  154. setTimeout(() => {
  155. this.pullFlag = true
  156. }, 500)
  157. if (this.hasNextPage) {
  158. this.pullUpOn = false
  159. this.nomoreText = '上拉显示更多'
  160. } else {
  161. if (this.RecordList.length < 2) {
  162. this.pullUpOn = true
  163. this.loadding = false
  164. } else {
  165. this.pullUpOn = false
  166. this.loadding = false
  167. this.nomoreText = '已至底部'
  168. }
  169. }
  170. } else {
  171. this.isEmpty = true
  172. }
  173. })
  174. .catch(error => {
  175. this.$util.msg(error.msg, 2000)
  176. })
  177. },
  178. getOnReachBottomData() {
  179. this.listQuery.pageNum += 1
  180. this.ShopService.ShopShipmentsRecord(this.listQuery)
  181. .then(response => {
  182. let data = response.data.logisticsBatchPage
  183. if (data.list && data.list.length > 0) {
  184. this.hasNextPage = data.hasNextPage
  185. this.RecordList = this.RecordList.concat(data.list)
  186. this.pullFlag = false // 防上拉暴滑
  187. setTimeout(() => {
  188. this.pullFlag = true
  189. }, 500)
  190. if (this.hasNextPage) {
  191. this.pullUpOn = false
  192. this.nomoreText = '上拉显示更多'
  193. } else {
  194. this.pullUpOn = false
  195. this.loadding = false
  196. this.nomoreText = '已至底部'
  197. }
  198. }
  199. })
  200. .catch(error => {
  201. this.$util.msg(error.msg, 2000)
  202. })
  203. },
  204. setHeaderBtnPosi() {
  205. // 获得胶囊按钮位置信息
  206. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  207. return headerBtnPosi
  208. },
  209. setSysteminfo() {
  210. // 获取设备信息
  211. let systeminfo
  212. uni.getSystemInfo({
  213. success: res => {
  214. systeminfo = res
  215. }
  216. })
  217. return systeminfo
  218. },
  219. setScrollHeight() {
  220. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  221. this.windowHeight = windowHeight - 1
  222. this.scrollHeight = windowHeight - 1
  223. },
  224. previewImg(index, previewUrls) {
  225. //顶部商品图片预览
  226. isPreviewImg = true
  227. uni.previewImage({
  228. current: index, //图片索引
  229. urls: previewUrls, //必须是http图片,本地图片无效
  230. longPressActions: ''
  231. })
  232. },
  233. handButtonConfirm(data) {
  234. //监听点击时间的按钮类型并执行...
  235. // console.log(data)
  236. this.handShowAlert(data)
  237. },
  238. handShowAlert(data) {
  239. //判断点击的按钮类型并执行...
  240. let hanldType = data.hanldType
  241. let hanldData = data.hanldData
  242. console.log(hanldData)
  243. switch (hanldType) {
  244. case 'cancel':
  245. this.handCenceConfirm(hanldData)
  246. break
  247. case 'add':
  248. let setProductList = []
  249. let repleArray = hanldData.logisticsRecordList
  250. repleArray.forEach(el => {
  251. let elObject = {
  252. orderProductId: el.orderProductId,
  253. num: el.num
  254. }
  255. setProductList.push(elObject)
  256. })
  257. let data = {
  258. logisticsBatchId: hanldData.id,
  259. logisticsBatchData: setProductList
  260. }
  261. this.$api.navigateTo(
  262. `/pages/supplier/deliver/add-logistics?type=reple&mobile=${this.mobile}&shopOrderId=${
  263. this.listQuery.shopOrderId
  264. }&data=${JSON.stringify(data)}`
  265. )
  266. break
  267. case 'qualifications':
  268. this.$api.navigateTo(
  269. `/pages/supplier/deliver/qualifications-details?logisticsBatchId=${hanldData.id}&shopOrderId=${
  270. this.listQuery.shopOrderId
  271. }`
  272. )
  273. break
  274. }
  275. },
  276. handCenceConfirm(data) {
  277. //取消订单
  278. this.$util.modal('提示', '确定要撤销本次发货吗?撤销后需重新发货', '确定', '取消', true, () => {
  279. this.ShopService.ShopCancelShipment({ logisticsBatchId: data.id })
  280. .then(response => {
  281. this.$util.msg('撤销成功', 2000, true, 'success')
  282. setTimeout(() => {
  283. this.initShopShipmentsRecord()
  284. }, 2000)
  285. })
  286. .catch(error => {
  287. this.$util.msg(error.msg, 2000)
  288. })
  289. })
  290. },
  291. pageGoLink() {
  292. this.$api.navigateTo('/pages/supplier/deliver/deliver-goods?shopOrderId=' + this.listQuery.shopOrderId)
  293. },
  294. hanldPageDetails() {
  295. this.$api.navigateTo('/pages/supplier/order/order-details?shopOrderId=' + this.listQuery.shopOrderId)
  296. }
  297. },
  298. onPullDownRefresh() {
  299. //下拉刷新
  300. this.initShopShipmentsRecord()
  301. uni.stopPullDownRefresh()
  302. },
  303. onReachBottom() {
  304. if (this.hasNextPage) {
  305. this.loadding = true
  306. this.pullUpOn = true
  307. this.getOnReachBottomData()
  308. }
  309. },
  310. onShow() {}
  311. }
  312. </script>
  313. <style lang="scss">
  314. page {
  315. background: #f7f7f7;
  316. height: auto;
  317. }
  318. .record-content {
  319. position: relative;
  320. border-top: 1px solid #ebebeb;
  321. .scroll-view {
  322. height: 100%;
  323. }
  324. }
  325. .record-content-empty {
  326. width: 100%;
  327. height: 100%;
  328. display: flex;
  329. align-items: center;
  330. justify-content: center;
  331. .record-container {
  332. width: 400rpx;
  333. height: auto;
  334. image {
  335. width: 400rpx;
  336. height: 400rpx;
  337. display: block;
  338. }
  339. .txt {
  340. font-size: $font-size-28;
  341. text-align: center;
  342. color: #333;
  343. line-height: 30rpx;
  344. margin-bottom: 20rpx;
  345. }
  346. .btn {
  347. width: 400rpx;
  348. height: 80rpx;
  349. background: $btn-confirm;
  350. border-radius: 40rpx;
  351. line-height: 80rpx;
  352. font-size: $font-size-28;
  353. text-align: center;
  354. color: #ffffff;
  355. }
  356. }
  357. }
  358. .record-list {
  359. width: 100%;
  360. height: auto;
  361. background-color: #f7f7f7;
  362. margin-bottom: 24rpx;
  363. .record-top {
  364. width: 702rpx;
  365. padding: 20rpx 24rpx;
  366. height: auto;
  367. background-color: #fff;
  368. margin-bottom: 20rpx;
  369. .top-view {
  370. width: 100%;
  371. height: auto;
  372. float: left;
  373. line-height: 50rpx;
  374. font-size: $font-size-28;
  375. color: #333333;
  376. display: flex;
  377. .top-viewlabel {
  378. width: 130rpx;
  379. margin-right: 10rpx;
  380. color: #999999;
  381. }
  382. .top-viewtext {
  383. width: 562rpx;
  384. height: auto;
  385. text {
  386. display: inline-block;
  387. margin-right: 30rpx;
  388. }
  389. }
  390. }
  391. }
  392. .goods-pros {
  393. width: 702rpx;
  394. padding: 0 24rpx;
  395. background: #ffffff;
  396. }
  397. .goods-pros-t {
  398. display: flex;
  399. width: 100%;
  400. height: auto;
  401. padding: 20rpx 0;
  402. .pros-img {
  403. width: 210rpx;
  404. height: 210rpx;
  405. border-radius: 10rpx;
  406. margin: 0 20rpx;
  407. border: 1px solid #f3f3f3;
  408. margin-left: 0;
  409. image {
  410. width: 100%;
  411. height: 100%;
  412. border-radius: 10rpx;
  413. }
  414. }
  415. .pros-product {
  416. width: 492rpx;
  417. height: 100%;
  418. line-height: 36rpx;
  419. font-size: $font-size-28;
  420. position: relative;
  421. .producttitle {
  422. width: 100%;
  423. display: inline-block;
  424. height: auto;
  425. text-overflow: ellipsis;
  426. display: -webkit-box;
  427. word-break: break-all;
  428. -webkit-box-orient: vertical;
  429. -webkit-line-clamp: 2;
  430. overflow: hidden;
  431. margin-bottom: 8rpx;
  432. }
  433. .productspec {
  434. height: 44rpx;
  435. color: #999999;
  436. line-height: 44rpx;
  437. font-size: $font-size-26;
  438. }
  439. .product-view {
  440. width: 100%;
  441. height: auto;
  442. display: flex;
  443. .view-num {
  444. flex: 1;
  445. text-align: left;
  446. font-size: $font-size-26;
  447. color: #666666;
  448. line-height: 44rpx;
  449. }
  450. }
  451. }
  452. }
  453. .goods-pros-b {
  454. width: 100%;
  455. height: auto;
  456. padding: 10rpx 0;
  457. border-top: 1px solid #f7f7f7;
  458. border-bottom: 1px solid #f7f7f7;
  459. position: relative;
  460. .b-label {
  461. width: 100%;
  462. line-height: 70rpx;
  463. font-size: $font-size-28;
  464. color: $text-color;
  465. }
  466. .b-photo {
  467. width: 100%;
  468. height: auto;
  469. padding: 10rpx 0;
  470. .b-imageView {
  471. width: 112rpx;
  472. height: 112rpx;
  473. margin: 0 20rpx 20rpx 0;
  474. float: left;
  475. image {
  476. width: 112rpx;
  477. height: 112rpx;
  478. display: block;
  479. }
  480. }
  481. .text {
  482. line-height: 44rpx;
  483. font-size: $font-size-28;
  484. color: $text-color;
  485. }
  486. }
  487. .goods-pros-m {
  488. width: 100%;
  489. height: auto;
  490. line-height: 76rpx;
  491. font-size: $font-size-26;
  492. color: $text-color;
  493. float: left;
  494. padding: 10rpx 0;
  495. border-top: 1px solid #f7f7f7;
  496. border-bottom: 1px solid #f7f7f7;
  497. .m-text {
  498. width: 62rpx;
  499. float: left;
  500. padding-right: 20rpx;
  501. font-weight: bold;
  502. }
  503. .m-input {
  504. display: -webkit-box;
  505. display: -webkit-flex;
  506. display: flex;
  507. -webkit-box-align: center;
  508. -webkit-align-items: center;
  509. align-items: center;
  510. position: relative;
  511. width: 620rpx;
  512. height: auto;
  513. padding: 20rpx 0 10rpx 0;
  514. background: #ffffff;
  515. .text {
  516. width: 100%;
  517. height: 100%;
  518. font-size: $font-size-26;
  519. line-height: 36rpx;
  520. color: #333333;
  521. }
  522. }
  523. }
  524. }
  525. }
  526. </style>