down-order.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view class="down-order">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <view class="swiper-nav">
  6. <view v-for="(item, index) in typeList" :key="index" class="item" :class="{ active: MIXIN_ActiveIndex === index }" @tap="switchSwiper(index)">{{ item }}</view>
  7. <view class="moveBar" :style="{ left: MIXIN_MoveBarLeft + 'px', width: 100 / typeList.length + '%' }"><text></text></view>
  8. </view>
  9. <view class="swiper-area">
  10. <pulldown-refresher ref="pulldownRefresher" @pulldownRefresh="MIXIN_pulldownrefresh">
  11. <swiper class="swiper" :current="MIXIN_NowIndex" :duration="234" @transition="MIXIN_transition" @change="MIXIN_change" @animationfinish="MIXIN_animationfinish">
  12. <swiper-item>
  13. <scroll-view scroll-y :style="{ height: MIXIN_ScrollViewHeight + 'px' }" @scrolltolower="MIXIN_scrolltolower">
  14. <view class="order-item" v-for="(orderItem, orderIndex) in lists[0]" :key="orderItem.order_num" v-if="orderItem">
  15. <view class="order-num">
  16. <text>订单编号:{{ orderItem.order_num }}</text>
  17. <text class="basecolor">未付款</text>
  18. </view>
  19. <view class="good-item" v-for="(goodItem, goodIndex) in orderItem.goodList" :key="goodIndex">
  20. <image :src="goodItem.img"></image>
  21. <view class="info">
  22. <text class="name">{{ goodItem.name }}</text>
  23. <text class="num">数量:{{ goodItem.num }}件</text>
  24. <text class="price">金额:¥{{ goodItem.price * goodItem.num + '' }}</text>
  25. </view>
  26. </view>
  27. <view class="totalPrice">
  28. <text>合计:<text class="basecolor">{{ orderItem | total }}</text></text>
  29. <view class="right">
  30. <text class="small-btn dank" @tap="delOrder(orderItem.order_num, orderIndex)">删除订单</text>
  31. <text class="small-btn" @tap="comfirmMon(orderItem.order_num, orderIndex)">确认收款</text>
  32. <text class="small-btn" @tap="toDetail(orderItem.order_num)">查看订单</text>
  33. </view>
  34. </view>
  35. </view>
  36. <custom-reach-bottom v-if="lists[0].length" :nomore="page[0] === 0" />
  37. <swiper-status v-else :page="page[0]" />
  38. </scroll-view>
  39. </swiper-item>
  40. <swiper-item>
  41. <scroll-view scroll-y :style="{ height: MIXIN_ScrollViewHeight + 'px' }" @scrolltolower="MIXIN_scrolltolower">
  42. <view class="order-item" v-for="(orderItem, orderIndex) in lists[1]" :key="orderItem.order_num">
  43. <view class="order-num">
  44. <text>订单编号:{{ orderItem.order_num }}</text>
  45. </view>
  46. <view class="good-item" v-for="(goodItem, goodIndex) in orderItem.goodList" :key="goodIndex">
  47. <image :src="goodItem.img"></image>
  48. <view class="info">
  49. <text class="name">{{ goodItem.name }}</text>
  50. <text class="num">数量:{{ goodItem.num }}件</text>
  51. <text class="price">金额:¥{{ goodItem.price * goodItem.num + '' }}</text>
  52. </view>
  53. </view>
  54. <view class="totalPrice">
  55. <text>合计:<text class="basecolor">{{ orderItem | total }}</text></text>
  56. <view class="right">
  57. <text class="small-btn" @tap="toSend(orderItem.order_num, orderIndex)">去发货</text>
  58. <text class="small-btn" @tap="toDetail(orderItem.order_num)">查看订单</text>
  59. </view>
  60. </view>
  61. </view>
  62. <custom-reach-bottom v-if="lists[1].length" :nomore="page[1] === 0" />
  63. <swiper-status v-else :page="page[1]" />
  64. </scroll-view>
  65. </swiper-item>
  66. <swiper-item v-for="(item, index) in typeList" :key="index" v-if="index > 1">
  67. <scroll-view scroll-y :style="{ height: MIXIN_ScrollViewHeight + 'px' }" @scrolltolower="MIXIN_scrolltolower">
  68. <view class="order-item" v-for="(orderItem) in lists[index]" :key="orderItem.order_num">
  69. <view class="order-num">
  70. <text>订单编号:{{ orderItem.order_num }}</text>
  71. <text v-if="index === 4 && orderItem.status == 3" class="basecolor">已完成</text>
  72. <text v-if="index === 4 && orderItem.status == 4">已取消</text>
  73. </view>
  74. <view class="good-item" v-for="(goodItem, goodIndex) in orderItem.goodList" :key="goodIndex.order_num">
  75. <image :src="goodItem.img"></image>
  76. <view class="info">
  77. <text class="name">{{ goodItem.name }}</text>
  78. <text class="num">数量:{{ goodItem.num }}件</text>
  79. <text class="price">金额:¥{{ goodItem.price * goodItem.num + '' }}</text>
  80. </view>
  81. </view>
  82. <view class="totalPrice">
  83. <text>合计:<text class="basecolor">{{ orderItem | total }}</text></text>
  84. <view class="right">
  85. <text class="small-btn" @tap="toDetail(orderItem.order_num, index)">查看订单</text>
  86. </view>
  87. </view>
  88. </view>
  89. <custom-reach-bottom v-if="lists[index].length" :nomore="page[index] === 0" />
  90. <swiper-status v-else :page="page[index]" />
  91. </scroll-view>
  92. </swiper-item>
  93. </swiper>
  94. </pulldown-refresher>
  95. </view>
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. import { deepClone } from '@/common/util/index.js'
  101. import MIXIN from '@/mixin/swiper-list.js'
  102. import swiperStatus from '@/components/public/swiper-status.vue'
  103. import pulldownRefresher from '@/components/public/pulldown-refresher.vue'
  104. import customReachBottom from '@/components/public/custom-reach-bottom.vue'
  105. import {
  106. _API_OrderDownWillpay,
  107. _API_OrderDownWillsend,
  108. _API_OrderDownSended,
  109. _API_OrderDownForward,
  110. _API_OrderDownCompleted,
  111. _API_OrderReceiveMoney,
  112. _API_OrderDel
  113. } from '@/apis/order.js'
  114. export default {
  115. mixins: [MIXIN],
  116. components: { swiperStatus, customReachBottom, pulldownRefresher },
  117. data() {
  118. return {
  119. title: '下级订单',
  120. page: [1, 1, 1, 1, 1], // 每种类型的页数 当页数为零时表示当前类型没有更多了
  121. lists: { 0: [], 1: [], 2: [], 3: [], 4: [] }, // 数据
  122. typeList: ['待审核', '待发货', '已发货', '已转单', '已完成'],
  123. apis: [_API_OrderDownWillpay, _API_OrderDownWillsend, _API_OrderDownSended, _API_OrderDownForward, _API_OrderDownCompleted]
  124. }
  125. },
  126. filters: {
  127. total(orderItem) {
  128. return '¥ ' + orderItem.goodList.reduce((t, e) => t + (+e.num * +e.price), 0) + ''
  129. }
  130. },
  131. onLoad(opt) {
  132. uni.navigateBack()
  133. setTimeout(() => uni.$emit('noopening'))
  134. return
  135. this.MIXIN_request()
  136. uni.$on('SENDGOOD', index => { // 将已发货订单从待发货订单删除
  137. const list1 = deepClone(this.lists[1])
  138. list1.splice(index, 1) // 把当前订单从待审核列表删除
  139. this.$set(this.lists, 1, list1)
  140. })
  141. },
  142. methods: {
  143. toDetail(order_num, index) { // 点击查看订单
  144. if (index == 3) { // 查看转单详情
  145. uni.navigateTo({ url: `../order-detail/order-detail?order_num=${order_num}&forward=1` })
  146. } else { // 查看订单详情
  147. uni.navigateTo({ url: `../order-detail/order-detail?order_num=${order_num}` })
  148. }
  149. },
  150. delOrder(order_num, index) { // 点击删除订单
  151. this.$refs.ltm.modal('提示', ['确定要删除这个订单']).then(() => {
  152. uni.showLoading({ mask: true })
  153. _API_OrderDel({ order_num }).then(res => {
  154. if (res.code === 200) {
  155. const list0 = deepClone(this.lists[0])
  156. list0.splice(index, 1) // 把当前订单从待审核列表删除
  157. this.$set(this.lists, 0, list0)
  158. uni.toast('删除成功')
  159. } else {
  160. uni.toast('删除失败,请稍后重试')
  161. }
  162. })
  163. }).catch(() => {
  164. uni.toast('取消删除')
  165. })
  166. },
  167. comfirmMon(order_num, index) { // 确认收款
  168. this.$refs.ltm.modal('提示', ['确定收到货款?']).then(() => {
  169. uni.showLoading({ mask: true })
  170. _API_OrderReceiveMoney({ order_num }).then(res => {
  171. if (res.code === 200) {
  172. const list0 = deepClone(this.lists[0])
  173. list0.splice(index, 1) // 把当前订单从待审核列表删除
  174. this.$set(this.lists, 0, list0)
  175. uni.toast('确认成功,请及时发货')
  176. } else {
  177. uni.toast('确认失败,请稍后重试')
  178. }
  179. })
  180. }).catch(() => {
  181. uni.toast('取消确认')
  182. })
  183. },
  184. toSend(order_num, index) { // 点击去发货
  185. uni.navigateTo({ url: `../send-good/send-good?index=${index}&order_num=${order_num}&num=${this.lists[1].length}` })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss">
  191. .down-order {
  192. @include page();
  193. .content {
  194. @include flex(column);
  195. .swiper-nav {
  196. text {
  197. width: 56rpx;
  198. }
  199. }
  200. .swiper-area {
  201. scroll-view {
  202. .order-item {
  203. background: #FFFFFF;
  204. > view {
  205. padding: 0 30rpx;
  206. box-sizing: border-box;
  207. }
  208. .order-num {
  209. @include flex();
  210. height: 60rpx;
  211. font-size: 26rpx;
  212. justify-content: space-between;
  213. border-top: 10rpx solid $app-base-bg;
  214. border-bottom: 1rpx solid $app-base-bg;
  215. }
  216. .good-item {
  217. @include flex();
  218. height: 180rpx;
  219. padding: 0 30rpx;
  220. margin-bottom: 1rpx;
  221. background: #FFFFFF;
  222. box-sizing: border-box;
  223. justify-content: space-between;
  224. border-bottom: 1rpx solid $app-base-bg;
  225. image {
  226. width: 140rpx;
  227. height: 140rpx;
  228. }
  229. .info {
  230. @include flex(column);
  231. flex: 1;
  232. height: 100%;
  233. margin: 0 30rpx;
  234. align-items: flex-start;
  235. justify-content: flex-start;
  236. .name {
  237. font-size: 32rpx;
  238. margin-top: 20rpx;
  239. }
  240. .num {
  241. font-size: 26rpx;
  242. margin-top: 10rpx;
  243. color: $app-sec-text-color;
  244. }
  245. .price {
  246. font-size: 26rpx;
  247. margin-top: 10rpx;
  248. color: $app-base-color;
  249. }
  250. }
  251. }
  252. .totalPrice {
  253. @include flex();
  254. height: 100rpx;
  255. font-size: 26rpx;
  256. justify-content: space-between;
  257. .right {
  258. @include flex();
  259. flex: 1;
  260. height: 100%;
  261. justify-content: flex-end;
  262. }
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. </style>