exchangeOrder.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="container">
  3. <u-sticky>
  4. <view class="head">
  5. <u-navbar title="我的订单" leftIconColor="#ffffff" titleStyle="color:#fff" :autoBack="true" placeholder></u-navbar>
  6. <view>
  7. <view class="searchBox">
  8. <view>
  9. <u--input placeholder="请输入商品名称" v-model="searchValue" placeholderClass="placeholderClass" border="none" clearable></u--input>
  10. <view class="searchBox_btn" @click="goSearch()">
  11. <text class="iconfont icon-sousuo"></text>
  12. 搜索
  13. </view>
  14. </view>
  15. </view>
  16. <view class="tabs">
  17. <view v-for="(v,i) in tabsList" :key="i" :class="{active:tabIndex==i}" @click="tabsClick(i)">{{v.name}}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </u-sticky>
  22. <view class="list">
  23. <view class="item" v-for="(v,i) in list" :key="i" @click="goPath('/pages/mine/exchangeOrderDetails?orderId='+v.orderId)">
  24. <view class="item_t">订单号: <text>{{v.orderNo}}</text>
  25. <view class="tag red" :class="{green:v.orderStatus==20,gary:v.orderStatus==30}">{{dealStatus(v.orderStatus)}}</view>
  26. </view>
  27. <view class="item_b" v-if="v.orderDetails&&v.orderDetails.length>0">
  28. <image :src="v.orderDetails[0].productCover" mode="" />
  29. <view class="item_b_r">
  30. <view class="item_b_r_title">{{v.orderDetails[0].productTitle}}</view>
  31. <view class="item_b_r_num">X{{v.orderDetails[0].productNum}}</view>
  32. <view class="item_b_r_price">
  33. <view class="item_b_r_price_l">¥{{v.orderDetails[0].productPrice}}</view>
  34. <view class="item_b_r_price_r">{{v.orderDetails[0].pointsPerProduct}}兑换豆</view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <empty marginTop="50" v-if="(!list||list.length<=0)&&status!='loading'"></empty>
  40. <u-loadmore v-else :status="status" />
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import { shoporderPage } from '@/api/home';
  46. export default {
  47. data () {
  48. return {
  49. tabsList: [{ name: "全部", value: undefined }, { name: "待发货", value: 10 }, { name: "已发货", value: 20 }, { name: "已完成", value: 30 }],
  50. tabIndex: 0,
  51. status: 'loadmore',//加载前值为loadmore,加载中为loading,没有数据为nomore,
  52. params: {
  53. pageSize: 10,
  54. pageNum: 1,
  55. orderStatus: undefined,//订单状态(0待支付,10待发货,20已发货待收货,30交易完成,100订单已取消),
  56. },
  57. list: [],
  58. searchValue: ""
  59. }
  60. },
  61. onLoad (options) {
  62. if (options.orderStatus) {
  63. this.params.orderStatus = options.orderStatus;
  64. this.tabIndex = this.tabsList.findIndex(v => v.value == options.orderStatus);
  65. }
  66. this.getList();
  67. },
  68. onPullDownRefresh () {
  69. this.params.pageNum = 1;
  70. this.getList()
  71. },
  72. onReachBottom () {
  73. if (this.status == "loadmore") {
  74. this.params.pageNum++;
  75. this.getList()
  76. }
  77. },
  78. methods: {
  79. goSearch () {
  80. this.params.productTitle = this.searchValue;
  81. this.params.pageNum = 1;
  82. this.getList()
  83. },
  84. dealStatus (orderStatus) {
  85. let status = ''
  86. this.tabsList.map(v => {
  87. if (v.value == orderStatus) {
  88. status = v.name
  89. }
  90. })
  91. return status
  92. },
  93. tabsClick (index) {
  94. this.tabIndex = index;
  95. this.params.pageNum = 1;
  96. this.params.orderStatus = this.tabsList[index].value;
  97. this.getList()
  98. },
  99. getList () {
  100. this.status = 'loading';
  101. shoporderPage(this.params).then(res => {
  102. // res.rows.map(v => {
  103. // v.productDataJosn = JSON.parse(v.productData);
  104. // })
  105. if (this.params.pageNum == 1) {
  106. this.list = res.rows
  107. } else {
  108. this.list.push(...res.rows);
  109. }
  110. if (this.list.length < res.total) {
  111. this.status = 'loadmore';
  112. } else {
  113. this.status = 'nomore';
  114. }
  115. }).finally(()=>{
  116. uni.stopPullDownRefresh();
  117. })
  118. },
  119. goPath (path) {
  120. uni.navigateTo({
  121. url: path
  122. })
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang='scss' scoped>
  128. ::v-deep .u-navbar__content,
  129. ::v-deep .u-status-bar {
  130. background-color: transparent !important;
  131. }
  132. .container {
  133. .head {
  134. background: linear-gradient(180deg, #c90700, #c90700 100%);
  135. padding: 20rpx 30rpx 50rpx;
  136. .searchBox {
  137. font-family: FZZhunYuan-M02S;
  138. > view {
  139. display: flex;
  140. background: #f5f5f5;
  141. height: 78rpx;
  142. border-radius: 40rpx;
  143. padding-left: 30rpx;
  144. border: 1px solid #e6e6e6;
  145. }
  146. .searchBox_btn {
  147. font-size: 28rpx;
  148. width: 136rpx;
  149. height: 66rpx;
  150. background: #fb0b03;
  151. border-radius: 33rpx;
  152. color: #ffffff;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. margin: 7rpx;
  157. .icon-sousuo {
  158. display: inline-block;
  159. margin-right: 8rpx;
  160. font-size: 32rpx;
  161. }
  162. }
  163. }
  164. .tabs {
  165. margin-top: 30rpx;
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. > view {
  170. font-size: 28rpx;
  171. color: #fae6e6;
  172. }
  173. .active {
  174. font-family: FZCuYuan-M03;
  175. position: relative;
  176. &::after {
  177. content: "";
  178. display: block;
  179. width: 100%;
  180. height: 4rpx;
  181. background: #ffffff;
  182. border-radius: 2rpx;
  183. position: absolute;
  184. left: 0;
  185. bottom: -15rpx;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. .list {
  192. background: #f8f8f8;
  193. min-height: 70vh;
  194. padding: 45rpx 30rpx;
  195. .item {
  196. background: #ffffff;
  197. border-radius: 30rpx;
  198. margin-bottom: 32rpx;
  199. .item_t {
  200. font-size: 29rpx;
  201. color: #1a1a1a;
  202. font-family: FZCuYuan-M03;
  203. padding: 50rpx 20rpx 30rpx;
  204. border-bottom: 1px solid #cccccc;
  205. position: relative;
  206. text {
  207. color: #808080;
  208. font-family: FZCuYuan-M03;
  209. }
  210. .tag {
  211. width: 136rpx;
  212. height: 50rpx;
  213. border-radius: 0rpx 30rpx 0rpx 30rpx;
  214. font-size: 24rpx;
  215. line-height: 50rpx;
  216. text-align: center;
  217. position: absolute;
  218. top: 0;
  219. right: 0;
  220. }
  221. .red {
  222. background: #ffdbd9;
  223. color: #fb0b03;
  224. }
  225. .green {
  226. background: #e6ffec;
  227. color: #00bf02;
  228. }
  229. .gary {
  230. background: #e6e6e6;
  231. color: #333333;
  232. }
  233. }
  234. .item_b {
  235. display: flex;
  236. padding: 30rpx 20rpx 48rpx;
  237. > image {
  238. width: 172rpx;
  239. height: 172rpx;
  240. border-radius: 12rpx;
  241. margin-right: 20rpx;
  242. flex-shrink: 0;
  243. }
  244. .item_b_r {
  245. flex-grow: 1;
  246. .item_b_r_title {
  247. height: 84rpx;
  248. font-size: 28rpx;
  249. color: #1a1a1a;
  250. overflow: hidden;
  251. text-overflow: ellipsis;
  252. display: -webkit-box;
  253. -webkit-line-clamp: 2;
  254. -webkit-box-orient: vertical;
  255. line-height: 42rpx;
  256. }
  257. .item_b_r_num {
  258. font-size: 26rpx;
  259. color: #1a1a1a;
  260. margin-top: 10rpx;
  261. }
  262. .item_b_r_price {
  263. margin-top: 20rpx;
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: baseline;
  267. .item_b_r_price_l {
  268. font-size: 26rpx;
  269. color: #1a1a1a;
  270. }
  271. .item_b_r_price_r {
  272. font-size: 32rpx;
  273. color: #fb0b03;
  274. font-family: FZCuYuan-M03;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }
  281. ::v-deep .placeholderClass {
  282. font-family: FZZhunYuan-M02S;
  283. font-size: 28rpx;
  284. }
  285. </style>