order-list.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <!-- pages/order-list/order-list.wxml -->
  3. <view class="container">
  4. <!-- 头部菜单 -->
  5. <view class="order-tit">
  6. <text data-sts="0" :class="sts==0?'on':''" @tap="onStsTap">全部</text>
  7. <text data-sts="1" :class="sts==1?'on':''" @tap="onStsTap">待付款</text>
  8. <text data-sts="2" :class="sts==2?'on':''" @tap="onStsTap">待发货</text>
  9. <text data-sts="3" :class="sts==3?'on':''" @tap="onStsTap">待收货</text>
  10. <text data-sts="5" :class="sts==5?'on':''" @tap="onStsTap">已完成</text>
  11. </view>
  12. <!-- end 头部菜单 -->
  13. <view class="main">
  14. <!-- <view class="empty" wx:if="{{list.length==0}}">这里还没有相关订单~</view> -->
  15. <!-- 订单列表 -->
  16. <block v-for="(item, orderNumber) in list" :key="orderNumber">
  17. <view class="prod-item">
  18. <!-- 店铺 -->
  19. <view class="shop-box">
  20. <view class="shop-icon">
  21. <image src="/static/images/icon/shop.png" />
  22. </view>
  23. <view class="shop-name">{{ item.shopName }}</view>
  24. </view>
  25. <!-- 订单编号 -->
  26. <view class="order-num">
  27. <text>订单编号:{{ item.orderNumber }}</text>
  28. <view class="order-state">
  29. <text :class="['order-sts' , {red: (item.status < 5) }]">{{ ['','待付款','待发货','待收货','待评价','已完成','已取消','拼团中'][item.status] }}</text>
  30. </view>
  31. <view v-if="item.refundStatus" class="order-state red">
  32. <!-- refundStatus 订单退款状态 1.申请退款 2.退款完成 3.部分退款完成 4.退款失败 -->
  33. <text>({{ ['','退款中','退款完成','部分退款','退款关闭'][item.refundStatus] }})</text>
  34. </view>
  35. </view>
  36. <!-- 商品列表 -->
  37. <!-- 一个订单单个商品的显示 -->
  38. <block v-if="item.orderItemDtos.length==1">
  39. <block v-for="(prod, prodId) in item.orderItemDtos" :key="prodId">
  40. <view class="item-cont" @tap="toOrderDetailPage(item.orderNumber, item.refundStatus)">
  41. <view class="prod-pic">
  42. <image :src="prod.pic" />
  43. </view>
  44. <view class="prod-info">
  45. <view class="prodname">{{ prod.prodName }}</view>
  46. <view class="prod-info-cont">{{ prod.skuName }}</view>
  47. <view class="price-nums">
  48. <text class="prodprice">
  49. <text v-if="prod.price" class="symbol">¥</text>
  50. <text v-if="prod.price" class="big-num">{{ wxs.parsePrice(prod.price)[0] }}</text>
  51. <text v-if="prod.price" class="small-num">.{{ wxs.parsePrice(prod.price)[1] }}</text>
  52. <text v-if="prod.price && item.orderType==3" class="small-num" decode="true">&emsp;+&emsp;</text>
  53. <text v-if="prod.useScore && item.orderType==3" class="small-num">{{ prod.useScore }} 积分</text>
  54. </text>
  55. <text class="prodcount">× {{ prod.prodCount }}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </block>
  60. </block>
  61. <!-- 一个订单多个商品时的显示 -->
  62. <block v-else>
  63. <view class="item-cont" @tap="toOrderDetailPage(item.orderNumber, item.refundStatus)">
  64. <scroll-view scroll-x="true" scroll-left="0" scroll-with-animation="false" class="categories">
  65. <block v-for="(prod, prodId) in item.orderItemDtos" :key="prodId">
  66. <view class="prod-pic">
  67. <image :src="prod.pic" />
  68. </view>
  69. </block>
  70. </scroll-view>
  71. </view>
  72. </block>
  73. <view class="total-num">
  74. <view v-if="item.orderType" class="spell-group-icon">
  75. <!-- orderType 订单类型(0普通订单 1团购订单 2秒杀订单) -->
  76. {{ ['','拼团','秒杀','积分'][item.orderType] }}
  77. </view>
  78. <view v-if="item.orderMold == 1" class="spell-group-icon">虚拟</view>
  79. <!-- <view class="spell-group-icon">自提</view> -->
  80. <view class="right">
  81. <view class="prodcount">共 {{ item.productNums }} 件商品</view>
  82. <view class="prodprice">合计:
  83. <text v-if="item.actualTotal" class="symbol">¥</text>
  84. <text v-if="item.actualTotal" class="big-num">{{ wxs.parsePrice(item.actualTotal)[0] }}</text>
  85. <text v-if="item.actualTotal" class="small-num">.{{ wxs.parsePrice(item.actualTotal)[1] }}</text>
  86. <text v-if="(item.actualTotal && item.actualTotal > 0) && (item.orderType==3 || item.orderToataluseScore > 0)" class="small-num">+</text>
  87. <text v-if="item.orderType==3 || item.orderToataluseScore > 0" class="small-num">{{ item.orderToataluseScore }} 积分</text>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- end 商品列表 -->
  92. <!-- <view class="prod-foot" v-if="item.status == 1 || item.status == 2 || item.status == 3 || item.status==5 || (item.status==5 && item.orderItemDtos[0].commSts==0)"> -->
  93. <!-- <view class="prod-foot" v-if="item.status == 2"> -->
  94. <!-- <view class="btn"> -->
  95. <!-- <text v-if="item.status==2" class="button warn" @tap="pickGood" :data-ordernum="item.orderNumber" hover-class="none">提货</text> -->
  96. <!-- </view> -->
  97. <!-- </view> -->
  98. </view>
  99. </block>
  100. </view>
  101. <!-- 到底了~ -->
  102. <view v-if="list.length > 10 && loadAll" class="loadall">已加载全部数据</view>
  103. <!-- 空 -->
  104. <view v-if="!list.length" class="empty">
  105. <view class="empty-icon">
  106. <image src="/static/images/icon/empty.png" />
  107. </view>
  108. <view class="empty-text">这里还没有相关订单~</view>
  109. </view>
  110. </view>
  111. <!-- end 订单列表 -->
  112. </template>
  113. <script module="wxs" lang="wxs" src="../../wxs/number.wxs"></script>
  114. <script>
  115. var http = require("../../utils/http.js");
  116. var config = require("../../utils/config.js");
  117. export default {
  118. data() {
  119. return {
  120. list: [],
  121. current: 1,
  122. pages: 0,
  123. sts: 0,
  124. endTime: '', //订单过期时间
  125. loadAll: false // 已加载全部
  126. };
  127. },
  128. components: {},
  129. props: {},
  130. /**
  131. * 生命周期函数--监听页面加载
  132. */
  133. onLoad: function (options) {
  134. if (options.sts) {
  135. this.setData({
  136. sts: options.sts
  137. });
  138. }
  139. },
  140. /**
  141. * 生命周期函数--监听页面显示
  142. */
  143. onShow: function () {
  144. this.loadOrderData(this.sts, 1);
  145. },
  146. /**
  147. * 生命周期函数--监听页面初次渲染完成
  148. */
  149. onReady: function () {},
  150. /**
  151. * 生命周期函数--监听页面隐藏
  152. */
  153. onHide: function () {},
  154. /**
  155. * 生命周期函数--监听页面卸载
  156. */
  157. onUnload: function () {},
  158. /**
  159. * 页面相关事件处理函数--监听用户下拉动作
  160. */
  161. onPullDownRefresh: function () {},
  162. /**
  163. * 页面上拉触底事件的处理函数
  164. */
  165. onReachBottom: function () {
  166. if (this.current < this.pages) {
  167. this.loadOrderData(this.sts, this.current + 1);
  168. } else {
  169. this.setData({
  170. loadAll: true
  171. })
  172. }
  173. },
  174. /**
  175. * 用户点击右上角分享
  176. */
  177. onShareAppMessage: function () {},
  178. methods: {
  179. /**
  180. * 加载订单数据
  181. */
  182. loadOrderData: function (sts, current) {
  183. var ths = this;
  184. wx.showLoading(); //加载订单列表
  185. var params = {
  186. url: "/p/station/orderListByStatus",
  187. method: "GET",
  188. data: {
  189. current: current,
  190. size: 10,
  191. status: sts
  192. },
  193. callBack: function (res) {
  194. res.records.forEach(order=> {
  195. order.orderToataluseScore = 0
  196. order.orderItemDtos.forEach(orderItem=> {
  197. if (orderItem.useScore) {
  198. order.orderToataluseScore += orderItem.useScore
  199. }
  200. })
  201. })
  202. var list = [];
  203. if (res.current == 1) {
  204. list = res.records;
  205. } else {
  206. list = ths.list.concat(res.records)
  207. }
  208. ths.setData({
  209. list: list,
  210. pages: res.pages,
  211. current: res.current,
  212. });
  213. wx.hideLoading();
  214. },
  215. };
  216. http.request(params);
  217. },
  218. /**
  219. * 状态点击事件
  220. */
  221. onStsTap: function (e) {
  222. var sts = e.currentTarget.dataset.sts;
  223. this.setData({
  224. sts: sts
  225. });
  226. this.loadOrderData(sts, 1);
  227. },
  228. /**
  229. * 跳转提货页面
  230. */
  231. pickGood: function (e) {
  232. let orderNum = e.currentTarget.dataset.ordernum
  233. let ths = this
  234. wx.showModal({
  235. title: '',
  236. content: '确认取货?',
  237. confirmColor: "#3e62ad",
  238. cancelColor: "#3e62ad",
  239. cancelText: '否',
  240. confirmText: '是',
  241. success(res) {
  242. if (res.confirm) {
  243. wx.showLoading()
  244. var param = {
  245. url: "/p/station/orderStationByOrderNumber",
  246. method: "PUT",
  247. data: this.orderNumber,
  248. callBack: res => {
  249. ths.loadOrderData(ths.sts, 1)
  250. wx.hideLoading()
  251. }
  252. }
  253. http.request(param)
  254. } else if (res.cancel) {}
  255. }
  256. })
  257. },
  258. /**
  259. * 查看订单详情
  260. */
  261. toOrderDetailPage: function (orderNum, refundStatus) {
  262. let sts = refundStatus ? refundStatus : 0
  263. wx.navigateTo({
  264. url: '/pages/order-detail/order-detail?orderNum=' + orderNum + '&refundStatus=' + sts
  265. })
  266. }
  267. }
  268. };
  269. </script>
  270. <style>
  271. @import "./order-list.css";
  272. </style>