建材商城系统20241014
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

258 lines
6.8 KiB

8 months ago
1 week ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="订单中心" bgColor="#DC2828" color="#fff" leftClick @leftClick="$utils.navigateBack" />
  4. <uv-tabs :list="tabs"
  5. :activeStyle="{ color: '#FD5100', fontWeight: 600 }"
  6. lineColor="#FD5100" lineHeight="8rpx"
  7. lineWidth="50rpx"
  8. @click="clickTabs"></uv-tabs>
  9. <view v-if="orderList.records.length > 0" class="list">
  10. <view class="item" v-for="(item, index) in orderList.records" @click="toOrderDetail(item.id)" :key="index">
  11. <!-- 顶部 -->
  12. <view class="top">
  13. <view class="service">
  14. <text>{{ item.createTime }}</text>
  15. <!-- <text>{{ item.type_dictText }}</text> -->
  16. </view>
  17. <view class="status">
  18. <text> {{ tabs[item.status - 1 + 2].name }}</text>
  19. </view>
  20. </view>
  21. <!-- -->
  22. <view class="content"
  23. v-for="(shop, i) in item.children"
  24. :key="i">
  25. <view class="left">
  26. <image mode="aspectFill" :src="shop.image && shop.image.split(',')[0]"></image>
  27. </view>
  28. <view class="right">
  29. <view class="text-hidden-1">
  30. 材料{{ shop.title }}
  31. </view>
  32. <view class="text-hidden-1">
  33. 材质{{ shop.material }}
  34. </view>
  35. <view class="text-hidden-1">
  36. 数量{{ shop.num }}
  37. </view>
  38. </view>
  39. </view>
  40. <!-- -->
  41. <view class="bottom">
  42. <view class="price">
  43. 总价格<text class="num">{{ item.price }}</text>
  44. </view>
  45. <view class="b2" v-if="item.status == 0" @click.stop="toPayOrder(item)">
  46. 立即支付
  47. </view>
  48. <view class="b2" v-if="item.status == 2" @click.stop="confirmOrder(item)">
  49. 确认收货
  50. </view>
  51. <view class="b1" v-if="item.status == 0" @click.stop="cancelOrder(item)">
  52. 取消订单
  53. </view>
  54. <!-- <view class="b1" v-if="item.status != 0">
  55. 联系客服
  56. </view> -->
  57. </view>
  58. </view>
  59. </view>
  60. <kefu/>
  61. <quick-order-entry
  62. ref="quickOrderEntry"
  63. />
  64. </view>
  65. </template>
  66. <script>
  67. import orderMixin from '@/mixins/order.js'
  68. export default {
  69. mixins: [orderMixin],
  70. components: {
  71. },
  72. computed: {
  73. },
  74. data() {
  75. return {
  76. tabs: [
  77. {
  78. name: '全部'
  79. },
  80. {
  81. name: '待付款'
  82. },
  83. {
  84. name: '已付款'
  85. },
  86. {
  87. name: '配送中'
  88. },
  89. {
  90. name: '已完成'
  91. },
  92. {
  93. name: '已取消'
  94. }
  95. ],
  96. queryParams: {
  97. pageNo: 1,
  98. pageSize: 10
  99. },
  100. orderList: {
  101. records: [],
  102. total: 0,
  103. },
  104. state: -1,
  105. }
  106. },
  107. onShow() {
  108. this.getData()
  109. this.$refs.quickOrderEntry.refresh()
  110. },
  111. //滚动到屏幕底部
  112. onReachBottom() {
  113. if (this.queryParams.pageSize < this.orderList.total) {
  114. this.queryParams.pageSize += 10
  115. this.getData()
  116. }
  117. },
  118. onPullDownRefresh() {
  119. this.getData()
  120. },
  121. methods: {
  122. getData() {
  123. let queryParams = {
  124. ...this.queryParams,
  125. }
  126. if (this.state != -1) {
  127. queryParams.state = this.state
  128. }
  129. this.$api('getOrderPageBean', queryParams, res => {
  130. uni.stopPullDownRefresh()
  131. if (res.code == 200) {
  132. this.orderList = res.result
  133. }
  134. })
  135. },
  136. //点击tab栏
  137. clickTabs({ index }) {
  138. if (index == 0) {
  139. this.state = -1;
  140. } else {
  141. this.state = index - 1;
  142. }
  143. this.queryParams.pageSize = 10
  144. this.getData()
  145. },
  146. //跳转订单详情页面
  147. toOrderDetail(id) {
  148. uni.navigateTo({
  149. url: '/pages/order/orderDetail?id=' + id
  150. })
  151. },
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. .page {}
  157. .list {
  158. .item {
  159. width: calc(100% - 40rpx);
  160. background-color: #fff;
  161. margin: 20rpx;
  162. box-sizing: border-box;
  163. border-radius: 16rpx;
  164. padding: 30rpx 0;
  165. .top {
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. font-size: 30rpx;
  170. padding: 10rpx 30rpx;
  171. .service {}
  172. .status {
  173. font-size: 26rpx;
  174. font-weight: 600;
  175. color: $uni-color;
  176. }
  177. }
  178. .content {
  179. display: flex;
  180. padding: 10rpx 30rpx;
  181. .left {
  182. width: 150rpx;
  183. height: 150rpx;
  184. border-radius: 10rpx;
  185. image {
  186. width: 150rpx;
  187. height: 150rpx;
  188. border-radius: 10rpx;
  189. }
  190. }
  191. .right {
  192. width: calc(100% - 160rpx);
  193. color: #777;
  194. font-size: 24rpx;
  195. padding-left: 20rpx;
  196. line-height: 40rpx;
  197. background-color: #F8F8F8;
  198. }
  199. }
  200. .bottom {
  201. display: flex;
  202. justify-content: space-between;
  203. font-size: 25rpx;
  204. .price {
  205. color: #787777;
  206. font-weight: 900;
  207. text {
  208. color: #fd7d41;
  209. font-size: 26rpx;
  210. }
  211. }
  212. .b1 {
  213. border: 1px solid #777;
  214. color: #777;
  215. box-sizing: border-box;
  216. flex-shrink: 0;
  217. height: fit-content;
  218. }
  219. .b2 {
  220. background: linear-gradient(178deg, $uni-color, #d34f4f);
  221. color: #fff;
  222. flex-shrink: 0;
  223. height: fit-content;
  224. }
  225. view {
  226. margin: 12rpx;
  227. border-radius: 28rpx;
  228. padding: 8rpx 28rpx;
  229. margin-bottom: 0;
  230. }
  231. }
  232. }
  233. }
  234. </style>