deliver-detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <view>
  3. <view class="list">
  4. <view v-for="(item, idx) in dateList" :key="idx">
  5. <view class="list_con flexB" @click="changeSwitch(item, idx)">
  6. <view class="flexS">
  7. <view class="circle_out flexCC">
  8. <view class="circle_in"></view>
  9. </view>
  10. <text class="date">{{ item.date }}</text>
  11. <text class="order_count">订单数:{{ item.count }}</text>
  12. </view>
  13. <image src="../../static/icon/arrow.png"></image>
  14. </view>
  15. <view v-if="item.switch" style="margin-bottom:30rpx;">
  16. <view class="con_detail" v-for="(detail, index) in detailList" :key="'key' + index">
  17. <image src="../../static/new_stock/finish.png"
  18. v-if="detail.get_order && detail.get_order.track_status == 2" class="state"></image>
  19. <image src="../../static/new_stock/no_finish.png" v-else class="state"></image>
  20. <view v-if="detail.get_order" class="detail">
  21. <view>
  22. <!-- <view @click="skipOrder(detail.get_order.order_num)"> -->
  23. <text>订单编号:</text>
  24. <text class="order_no">{{ detail.get_order.order_num }}</text>
  25. </view>
  26. <view>
  27. <text>收货人:</text>
  28. <text
  29. v-if="detail.get_order.address">{{ detail.get_order.address.username | getNickname }}</text>
  30. <text
  31. style="font-size:28rpx;margin-left:15rpx;">{{ detail.get_order.address.mobile }}</text>
  32. </view>
  33. <view>
  34. <text>地址:</text>
  35. <text>
  36. {{ detail.get_order.address.province }}{{ detail.get_order.address.city }}{{ detail.get_order.address.town}}{{ detail.get_order.address.address }}
  37. </text>
  38. </view>
  39. <view class="flexB">
  40. <view v-if="detail.get_order.get_express">
  41. 箱数:{{ detail.get_order.get_express.length ? detail.get_order.get_express.length : 0 }}箱
  42. </view>
  43. <view class="more" :class="detail.toggle ? 'open' : 'close'"
  44. @click="detail.toggle = !detail.toggle">查看详情</view>
  45. </view>
  46. </view>
  47. <view class="box" v-if="detail.toggle && detail.get_order">
  48. <view class="box_con" v-for="(temp, i) in detail.get_order.get_express" :key="i">
  49. <view class="box_fix" v-if="temp.is_gift === 1"></view>
  50. <view class="flexS" style="margin-bottom:15rpx;">
  51. <text>第{{ i + 1 }}箱</text>
  52. <text style="margin:0 30rpx;">{{ temp.express_com }}</text>
  53. <text>单号:{{ temp.express_number }}</text>
  54. </view>
  55. <view class="flexB opera" v-if="temp.is_gift === 0">
  56. <view class="search"
  57. @click="goodsDetail(temp,temp.id, temp.put_status, temp.remark)">货物详情</view>
  58. <view class="search" @click="getLog(temp)">物流查询</view>
  59. <view class="box_btn"
  60. :class="temp.good_user_id != temp.user_id || temp.put_status == 1 ? 'gray_btn' : 'active_btn'"
  61. @click="temp.good_user_id == temp.user_id && temp.put_status == 0 ? toPublishRuKu(temp.id, index, i) : ''">
  62. {{ temp.put_status == 1 ? '已入库' : '入库' }}
  63. </view>
  64. </view>
  65. <view class="flexe opera" v-if="temp.is_gift === 1">
  66. <view class="searche" @click="giftsList(temp)">礼品详情</view>
  67. <view class="searcht" @click="getLog(temp)">物流查询</view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="block"></view>
  74. </view>
  75. <view class="noData" v-if="dateList.length == 0">
  76. <image src="../../static/default/no_record.png"></image>
  77. <view class="gray" style="font-size:30rpx;">--暂无数据--</view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import {
  84. getGroup,
  85. getDetail
  86. } from '@/apis/deliver.js';
  87. import {
  88. publishRuKu
  89. } from '@/apis/stock.js';
  90. export default {
  91. data() {
  92. return {
  93. dateList: '', //日期列表
  94. detailList: '', //列表详情
  95. params: {
  96. page_index: 1,
  97. page_size: 10
  98. },
  99. total: 0, //总条数
  100. isStorage: false //是否已经入库
  101. };
  102. },
  103. onLoad() {
  104. this.getDate();
  105. },
  106. filters: {
  107. /*截取地址字数*/
  108. getAds(value) {
  109. return value.length > 15 ? value.slice(0, 15) + '...' : value;
  110. },
  111. getNickname(value) {
  112. return value.length > 5 ? value.slice(0, 5) + '...' : value;
  113. }
  114. },
  115. methods: {
  116. giftsList(btem) {
  117. if (btem.remark === null) {
  118. btem.remark = ''
  119. }
  120. var obj = eval(btem.notes) //由JSON字符串转换为JSON对象
  121. uni.navigateTo({
  122. url: `../gifts_list/gifts_list?remark=${btem.remark}&item=${encodeURIComponent(JSON.stringify(obj))}`,
  123. });
  124. },
  125. /*展开关闭日期*/
  126. changeSwitch(item, idx) {
  127. let list = this.dateList;
  128. if (list.length == 0) {
  129. uni.showToast({
  130. title: '暂无数据',
  131. icon: 'none'
  132. });
  133. return false;
  134. }
  135. list.map((item, index) => {
  136. if (index == idx) {
  137. item.switch = !item.switch;
  138. item.switch ? this.getDetail(item.date) : '';
  139. } else {
  140. this.$set(item, 'switch', false);
  141. }
  142. });
  143. },
  144. /*获取日期列表*/
  145. getDate(isMore) {
  146. let params = this.params;
  147. getGroup(params).then(res => {
  148. if (res.code == 200) {
  149. let list = res.data.list;
  150. if (list.length == 0) {
  151. return false;
  152. }
  153. list.map((item, idx) => {
  154. idx == 0 ? this.$set(item, 'switch', true) : this.$set(item, 'switch', false);
  155. });
  156. this.total = Math.ceil(res.data.total / this.params.page_size);
  157. this.dateList = isMore ? this.dateList.concat(list) : list;
  158. this.getDetail(res.data.list[0].date, res.data.list[0].switch);
  159. } else {
  160. uni.showModal({
  161. content: res.message || '获取列表失败',
  162. showCancel: false
  163. });
  164. }
  165. });
  166. },
  167. /*跳转到订单详情*/
  168. skipOrder(order_num) {
  169. uni.navigateTo({
  170. url: '../order-detail1/order-detail1?order_num=' + order_num
  171. });
  172. },
  173. /*获取列表详情*/
  174. getDetail(time, isSwitch) {
  175. getDetail({
  176. time
  177. }).then(res => {
  178. if (res.code == 200) {
  179. let list = res.data.list;
  180. list.map((item, idx) => {
  181. idx == 0 && isSwitch ? this.$set(item, 'toggle', true) : this.$set(item,
  182. 'toggle', false);
  183. });
  184. this.detailList = list;
  185. } else {
  186. uni.showModal({
  187. content: res.message || '获取详情失败',
  188. showCancel: false
  189. });
  190. }
  191. });
  192. },
  193. /*获取更多数据*/
  194. getMore() {
  195. if (this.params.page_index > this.total) {
  196. uni.showToast({
  197. title: '没有更多啦~',
  198. icon: 'none'
  199. });
  200. return false;
  201. }
  202. this.params.page_index++;
  203. this.getDate(true);
  204. },
  205. /*跳转到货物详情
  206. * @params status 1 显示入库按钮 0不显示入库按钮
  207. */
  208. goodsDetail(temp, id, put_status, remark) {
  209. // uni.navigateTo({
  210. // url: '../unshipped-detail/index?order_id=' + id
  211. // });
  212. if (remark === null) {
  213. remark = ''
  214. }
  215. let status = ''
  216. if (temp.good_user_id == temp.user_id && put_status == 0) {
  217. status = 1
  218. } else {
  219. status = 0
  220. }
  221. uni.navigateTo({
  222. url: '../stock/ing_ruku?order_id=' + id + '&status=' + status + '&remark=' + remark
  223. });
  224. },
  225. /*查看物流*/
  226. getLog(temp) {
  227. const {
  228. express_number,
  229. express_com,
  230. id
  231. } = temp;
  232. uni.navigateTo({
  233. url: '../logistics-details/logistics-details?express_number=' + express_number +
  234. '&express_com=' + express_com + '&id=' + id
  235. });
  236. },
  237. // 确认入库
  238. toPublishRuKu(id, index, i) {
  239. const _this = this;
  240. uni.showModal({
  241. content: '入库时请确认商品信息是否正确',
  242. confirmText: '入库',
  243. cancelText: '取消',
  244. success(res) {
  245. if (res.confirm) {
  246. uni.showLoading();
  247. publishRuKu({
  248. id
  249. })
  250. .then(res => {
  251. uni.hideLoading();
  252. if (res.code === 200) {
  253. _this.detailList[index].get_order.get_express[i].put_status = 1;
  254. uni.showModal({
  255. content: '入库成功',
  256. showCancel: false
  257. })
  258. } else {
  259. uni.showModal({
  260. content: res.message || '入库失败',
  261. showCancel: false
  262. })
  263. }
  264. })
  265. .catch(() => {
  266. uni.hideLoading();
  267. uni.showModal({
  268. content: '入库失败',
  269. showCancel: false
  270. });
  271. });
  272. }
  273. }
  274. })
  275. }
  276. }
  277. };
  278. </script>
  279. <style lang="scss" scoped>
  280. .list {
  281. view,
  282. text {
  283. font-weight: 500;
  284. }
  285. .list_con {
  286. width: 100%;
  287. height: 120rpx;
  288. padding: 0 30rpx;
  289. background: #fff;
  290. box-sizing: border-box;
  291. image {
  292. width: 35rpx;
  293. height: 35rpx;
  294. vertical-align: -6rpx;
  295. }
  296. .circle_out {
  297. width: 44rpx;
  298. height: 44rpx;
  299. background: rgba(234, 74, 65, 0.2);
  300. border-radius: 50%;
  301. .circle_in {
  302. width: 28rpx;
  303. height: 28rpx;
  304. background: rgba(234, 74, 65, 1);
  305. border-radius: 50%;
  306. }
  307. }
  308. .date {
  309. color: $base-color;
  310. font-size: 32rpx;
  311. margin: 0 30rpx 0 15rpx;
  312. }
  313. .order_count {
  314. font-size: 32rpx;
  315. margin-top: -10rpx;
  316. }
  317. .noList {
  318. width: 100%;
  319. text-align: center;
  320. font-size: 28rpx;
  321. color: #999;
  322. margin-top: 150rpx;
  323. }
  324. }
  325. .block {
  326. width: 100%;
  327. height: 30rpx;
  328. background: #f9f9fb;
  329. }
  330. .con_detail {
  331. width: 690rpx;
  332. margin: 0 auto 30rpx;
  333. padding: 20rpx 70rpx 20rpx 20rpx;
  334. box-sizing: border-box;
  335. border-radius: 24rpx;
  336. background: #f8f8f8;
  337. position: relative;
  338. .state {
  339. width: 108rpx;
  340. height: 98rpx;
  341. position: absolute;
  342. top: 0;
  343. right: 10rpx;
  344. }
  345. .detail {
  346. >view {
  347. margin-top: 20rpx;
  348. font-size: 32rpx;
  349. .order_no {
  350. color: #3394f8;
  351. }
  352. }
  353. }
  354. .more {
  355. position: relative;
  356. color: $base-color;
  357. &::after {
  358. content: '';
  359. display: block;
  360. width: 15rpx;
  361. height: 15rpx;
  362. position: absolute;
  363. top: 15rpx;
  364. right: -30rpx;
  365. }
  366. }
  367. .close::after {
  368. border-top: 3rpx solid $base-color;
  369. border-right: 3rpx solid $base-color;
  370. transform: rotate(45deg);
  371. }
  372. .open::after {
  373. border-top: 3rpx solid $base-color;
  374. border-right: 3rpx solid $base-color;
  375. transform: rotate(135deg);
  376. }
  377. .box {
  378. .box_con {
  379. width: 630rpx;
  380. height: 194rpx;
  381. background: #fff;
  382. margin-top: 30rpx;
  383. padding: 15rpx 30rpx;
  384. box-sizing: border-box;
  385. display: flex;
  386. flex-direction: column;
  387. justify-content: center;
  388. border-radius: 24rpx;
  389. position: relative;
  390. .box_fix {
  391. width: 6rpx;
  392. height: 84rpx;
  393. background: #FB231F;
  394. position: absolute;
  395. top: 56rpx;
  396. left: 0;
  397. }
  398. .box_btn {
  399. width: 100rpx;
  400. height: 56rpx;
  401. line-height: 56rpx;
  402. text-align: center;
  403. color: #fff;
  404. border-radius: 8rpx;
  405. font-size: 28rpx;
  406. }
  407. .gray_btn {
  408. background: #999;
  409. }
  410. .active_btn {
  411. background: linear-gradient(88deg, #f97c55 0%, #f44545 100%);
  412. }
  413. .flexe {
  414. display: flex;
  415. justify-content: center;
  416. }
  417. .opera {
  418. border-top: 2rpx solid #eeeeee;
  419. padding-top: 15rpx;
  420. .search {
  421. color: $base-color;
  422. width: 30%;
  423. text-align: center;
  424. font-size: 28rpx;
  425. border-right: 2rpx solid #eee;
  426. }
  427. .searcht {
  428. color: $base-color;
  429. width: 100%;
  430. text-align: center;
  431. font-size: 28rpx;
  432. }
  433. .searche {
  434. color: $base-color;
  435. width: 100%;
  436. text-align: center;
  437. font-size: 28rpx;
  438. border-right: 2rpx solid #eee;
  439. }
  440. }
  441. }
  442. }
  443. }
  444. }
  445. </style>