index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="order">
  3. <view class="fixed-box">
  4. <capsule :showBorder="true" bgColor="#FFFFFF">
  5. <template v-slot:top>
  6. <view class="order-box">订单列表</view>
  7. </template>
  8. </capsule>
  9. <view class="order-top">
  10. <view class="search-box" @click="navigateTo('/order_module/searchOrder/index')">
  11. <view class="search-icon">
  12. <tui-icon name="search-2" :size="18" color="#999999"></tui-icon>
  13. </view>
  14. <text>请输入订单号/手机号</text>
  15. </view>
  16. <view class="order-state">
  17. <scroll-view scroll-x="true" class="scroll-X">
  18. <view
  19. class="scroll-item"
  20. v-for="(item, index) in orderState"
  21. :key="index"
  22. :class="item.state == orderIdx ? 'act' : ''"
  23. @click="changeState(item.state)"
  24. >{{ item.title }}</view
  25. >
  26. </scroll-view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="order-container" v-if="orderList.length > 0">
  31. <view class="order-list">
  32. <view
  33. class="order-item"
  34. v-for="item in orderList"
  35. :key="item.orderId"
  36. @click="goOrderDetail(item)"
  37. >
  38. <view class="order-number">
  39. <view class="number">订单编号:{{ item.orderFormid }}</view>
  40. <view class="number-icon">
  41. <text>详情</text>
  42. <tui-icon
  43. name="arrowright"
  44. :size="20"
  45. color="#999999"
  46. style="padding: 0;"
  47. ></tui-icon>
  48. </view>
  49. </view>
  50. <view class="text-info">用户昵称:{{ item.customerName }}</view>
  51. <view class="text-info">用户手机号:{{ item.customerPhone }}</view>
  52. <view class="commodity-list">
  53. <view
  54. class="commodity-item"
  55. v-for="item2 in item.products"
  56. :key="item2.orderProductId"
  57. >
  58. <view class="item-left">
  59. <view class="left-image">
  60. <image :src="item2.image" />
  61. </view>
  62. <view class="left-text">
  63. <view class="text-title">{{ item2.productName }}</view>
  64. <template v-if="item2.productName == '扫码付款商品'">
  65. <view class="text-price">扫码付款商品</view>
  66. </template>
  67. <template v-else>
  68. <view class="text-price">小份</view>
  69. <view class="text-price">x1</view>
  70. </template>
  71. </view>
  72. </view>
  73. <view class="item-right">¥{{ item2.productPrice }}</view>
  74. </view>
  75. </view>
  76. <view class="gifts">
  77. <view class="gifs-left">赠送代金券</view>
  78. <view class="gifs-right">¥{{ item.presenterVoucher }}</view>
  79. </view>
  80. <view class="all-price"
  81. >总价¥{{ item.price }}</view
  82. >
  83. <view class="border-box"></view>
  84. <view class="order-state">
  85. <text v-if="item.state == 1">待付款</text>
  86. <text v-if="item.state == 2">待发货</text>
  87. <text v-if="item.state == 3">待收货</text>
  88. <text v-if="item.state == 4">已完成</text>
  89. <text v-if="item.state == 5">交易关闭(已取消)</text>
  90. <text v-if="item.state == 6">待成团</text>
  91. <text v-if="item.state == 7">待售后</text>
  92. <text v-if="item.state == 8" :style="{ color: '#EA1717' }"
  93. >待核销(未付款)</text
  94. >
  95. <text v-if="item.state == 9">待核销(已付款)</text>
  96. <text v-if="item.state == 10">已核销</text>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="order-empty" v-else>
  102. <image src="@/static/image/order/empty.png" />
  103. <view class="empty-title">暂无订单信息...</view>
  104. <!-- <view class="empty-info">有订单信息您会在这边看到的</view> -->
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. import { orderGetAll } from "@/config/index.js";
  110. export default {
  111. created() {
  112. this.getOrderList();
  113. },
  114. data() {
  115. return {
  116. orderState: [
  117. {
  118. title: "全部",
  119. state: "",
  120. },
  121. {
  122. title: "未付款",
  123. state: 8,
  124. },
  125. {
  126. title: "已付款",
  127. state: 9,
  128. },
  129. {
  130. title: "已核销",
  131. state: 10,
  132. },
  133. {
  134. title: "已取消",
  135. state: 5,
  136. },
  137. {
  138. title: "售后订单",
  139. },
  140. ],
  141. orderIdx: 0,
  142. // 请求订单参数
  143. serachParams: {
  144. afterState: "",
  145. dates: [],
  146. page: 1,
  147. pageSize: 10,
  148. search: "",
  149. searchType: "1",
  150. state: "",
  151. },
  152. orderList: [],
  153. };
  154. },
  155. methods: {
  156. // 状态修改
  157. changeState(state) {
  158. this.orderIdx = state;
  159. this.serachParams.state = state;
  160. this.orderList = []
  161. // 请求新的数据
  162. this.getOrderList();
  163. },
  164. // 获取订单列表
  165. async getOrderList() {
  166. this.$loading.show("加载中!");
  167. try {
  168. let { data } = await orderGetAll(this.serachParams);
  169. this.orderList = [...this.orderList,...data.list];
  170. } catch (error) {
  171. } finally {
  172. this.$loading.hide();
  173. }
  174. },
  175. // 去到订单详情
  176. goOrderDetail(item) {
  177. this.navigateTo(
  178. `/order_module/orderDetail/index?orderId=${item.orderId}`
  179. );
  180. },
  181. },
  182. // 触底加载
  183. onReachBottom() {
  184. this.serachParams.page++;
  185. this.getOrderList();
  186. },
  187. };
  188. </script>
  189. <style lang="scss" scoped>
  190. @import "./index.scss";
  191. </style>