deliver-record.vue 13 KB

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