list.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view>
  3. <navbar v-model="screenHeight" title-color="#ffffff" background="#1b43c4" :iSimmersive="false" :placeholder="true" title="订单列表"></navbar>
  4. <view class="">
  5. <view class="menu">
  6. <view class="menu-wrap">
  7. <text @click="go('1')" :class="{active: activeId == '1'}">待付款</text>
  8. <text @click="go('2')" :class="{active: activeId == '2'}">待发货</text>
  9. <text @click="go('3')" :class="{active: activeId == '3'}">待收货</text>
  10. <text @click="go('4')" :class="{active: activeId == '4'}">待评价</text>
  11. <text @click="go('5')" :class="{active: activeId == '5'}">已完成</text>
  12. </view>
  13. </view>
  14. <view class="placeholder-box"></view>
  15. </view>
  16. <mescroll-body
  17. ref="mescrollRef"
  18. @init="mescrollInit"
  19. @down="downCallback"
  20. @up="upCallback"
  21. :height="(screenHeight-50)+'px'"
  22. >
  23. <view class="list-wrap">
  24. <view class="list-box">
  25. <view class="list-item-box" v-for="(item,index) in result" :key="index">
  26. <view class="top">
  27. <text class="order-type">{{item.type}}</text>
  28. <text class="time">{{item.create_time}}</text>
  29. <text class="satus">{{item.order_status}}</text>
  30. </view>
  31. <view class="goods-box" @click="$utils.navigateTo('order/detail',{ id: item.order_id })">
  32. <view class="goods-item clear" v-for="(value,j) in item.item" :key="j">
  33. <view class="goods-img">
  34. <image :src="value.thumb_image">
  35. </view>
  36. <view class="goods-info">
  37. <view class="t">
  38. <text>{{value.title}}</text>
  39. <text>¥{{value.price}}</text>
  40. </view>
  41. <view class="b">
  42. <text>{{value.spec}}</text>
  43. <text>× {{value.nums}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="order" :class="{addBorder:item.active==6}">
  49. <view class="total">
  50. 共{{item.item.length}}件商品,总金额
  51. <view>¥<text>{{item.order_amount}}</text></view>
  52. </view>
  53. </view>
  54. <view class="botttom" v-if="item.active!=6">
  55. <text class="cancel" v-if="item.active == 1" @click="cancel(item.order_id)">取消订单</text>
  56. <text class="pay" v-if="item.active == 1" @click="$utils.navigateTo('order/detail',{ id: item.order_id })">立即付款</text>
  57. <text class="cancel" v-if="item.active == 2 || item.active==3 || item.active==4" @click="$utils.navigateTo('order/refund',{ id: item.order_id })">申请退款</text>
  58. <text class="cancel" v-if="item.active==3 || item.active==4" @click="$utils.navigateTo('order/express',{ id: item.order_id })">查看物流</text>
  59. <text class="pay" v-if="item.active == 2 || item.active==3 || item.active==4" @click="$utils.navigateTo('order/confirm_delivery',{ id: item.order_id })">确认收货</text>
  60. <text class="pay" v-if="item.active==5" @click="$utils.navigateTo('order/evaluate',{ id: item.order_id })">待评价</text>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </mescroll-body>
  66. </view>
  67. </template>
  68. <script>
  69. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  70. import navbar from "@/components/navbar/navbar";
  71. export default {
  72. mixins: [MescrollMixin],
  73. components: {
  74. navbar
  75. },
  76. data() {
  77. return {
  78. screenHeight: 0,
  79. activeId: 1,
  80. result: []
  81. };
  82. },
  83. onLoad(options){
  84. this.activeId = options.id
  85. },
  86. onBackPress(e) {
  87. this.$utils.switchTab('ucenter/index');
  88. return true;
  89. },
  90. methods: {
  91. go(id){
  92. this.activeId = id;
  93. this.result = [];
  94. this.mescroll.triggerDownScroll();
  95. },
  96. cancel(order_id){
  97. this.$utils.showLoading();
  98. this.$http.getOrderListCancel({
  99. order_id: order_id
  100. }).then(res=>{
  101. this.$utils.hideLoading();
  102. if(res.status){
  103. let index = this.result.findIndex((value)=>{
  104. return value.order_id == order_id;
  105. });
  106. this.result.splice(index,1);
  107. this.$utils.msg(res.info);
  108. }else{
  109. this.$utils.msg(res.info);
  110. }
  111. }).catch(err=>{
  112. this.$utils.hideLoading();
  113. this.$utils.msg("网络出错,请检查网络是否连接");
  114. });
  115. },
  116. downCallback(){
  117. setTimeout(()=>{
  118. this.mescroll.resetUpScroll();
  119. },1200);
  120. },
  121. triggerDownScroll(){
  122. this.mescroll.triggerDownScroll();
  123. },
  124. upCallback(page) {
  125. this.$http.getOrderList({
  126. type: this.activeId,
  127. page: page.num
  128. }).then((result)=>{
  129. this.mescroll.endByPage(result.data.list.length, result.data.total);
  130. if(result.status==1){
  131. if(page.num == 1) this.result = [];
  132. this.result = this.result.concat(result.data.list);
  133. }else if(result.status == -1){
  134. this.mescroll.endErr();
  135. }
  136. }).catch(error=>{
  137. this.mescroll.endErr();
  138. });
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .placeholder-box{
  145. width: 100%;
  146. height: 100rpx;
  147. }
  148. .addBorder{
  149. border-top: 2rpx solid #eee;
  150. }
  151. .menu{
  152. background-color: #1b43c4;
  153. height: 100rpx;
  154. line-height: 100rpx;
  155. position: fixed;
  156. width: 100%;
  157. top: calc(44px + env(safe-area-inset-top)) + rpx;
  158. left: 0;
  159. font-size: 30rpx;
  160. z-index: 999999;
  161. .menu-wrap{
  162. display: flex;
  163. flex-wrap: nowrap;
  164. flex-direction: row;
  165. text {
  166. flex: 1;
  167. text-align: center;
  168. position: relative;
  169. color: #fff;
  170. }
  171. .active {
  172. color: #fff000;
  173. }
  174. }
  175. }
  176. .list-wrap{
  177. margin-top: 20rpx;
  178. }
  179. .list-box{
  180. display: flex;
  181. flex-direction: column;
  182. flex-wrap: wrap;
  183. .list-item-box {
  184. width: 95%;
  185. margin: 20rpx 2.5%;
  186. background-color: #fff;
  187. border-radius: 12rpx;
  188. .top{
  189. height: 90rpx;
  190. line-height: 90rpx;
  191. font-size: 30rpx;
  192. border-bottom: 2rpx solid #eee;
  193. .order-type{
  194. font-size: 28rpx;
  195. margin-right: 10rpx;
  196. color: #666;
  197. }
  198. text:first-child{
  199. float: left;
  200. padding-left: 20rpx;
  201. }
  202. text:last-child{
  203. font-size: 28rpx;
  204. float: right;
  205. padding-right: 20rpx;
  206. }
  207. }
  208. .goods-box{
  209. padding: 0 20rpx;
  210. .goods-item {
  211. padding-top: 20rpx;
  212. .goods-img {
  213. width: 154rpx;
  214. height: 154rpx;
  215. display: inline-block;
  216. float: left;
  217. image{
  218. width: 100%;
  219. height: 100%;
  220. }
  221. }
  222. .goods-info {
  223. display: inline-block;
  224. width: 72%;
  225. font-size: 28rpx;
  226. float: right;
  227. .t {
  228. width: 100%;
  229. height: 90rpx;
  230. text:first-child{
  231. float: left;
  232. display: -webkit-box;overflow: hidden;-webkit-line-clamp: 2;
  233. -webkit-box-orient: vertical;
  234. width: 70%;
  235. }
  236. text:last-child{
  237. width: 30%;
  238. float: right;
  239. text-align: right;
  240. }
  241. }
  242. .b{
  243. width: 100%;
  244. height: 80rpx;
  245. font-size: 26rpx;
  246. text:first-child{
  247. float: left;
  248. color: #999;
  249. }
  250. text:last-child{
  251. float: right;
  252. color: #666;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. .order{
  259. width: 100%;
  260. height: 90rpx;
  261. line-height: 90rpx;
  262. border-bottom: 2rpx solid #eee;
  263. .total {
  264. height: 90rpx;
  265. line-height: 90rpx;
  266. text-align: right;
  267. font-size: 28rpx;
  268. padding-right: 20rpx;
  269. view {
  270. display: inline-block;
  271. color: red;
  272. text{
  273. font-style: normal;
  274. font-size: 32rpx;
  275. }
  276. }
  277. }
  278. }
  279. .botttom{
  280. width: 100%;
  281. height: 110rpx;
  282. line-height: 110rpx;
  283. text-align: right;
  284. text{
  285. font-size: 28rpx;
  286. text-align: center;
  287. border-radius: 30rpx;
  288. background-color: #fff;
  289. padding: 16rpx 30rpx;
  290. margin-right: 20rpx;
  291. }
  292. text.cancel{
  293. color: #333;
  294. border: 2rpx solid #ddd;
  295. }
  296. text.pay {
  297. background-color: #e93323;
  298. color: #fff;
  299. }
  300. }
  301. }
  302. }
  303. </style>