index.vue 5.6 KB

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