myorder.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view>
  3. <scroll-view scroll-x class="bg-white nav text-center solid-bottom echo-fixed-top">
  4. <view class="cu-item flex-sub" data-status="0" :class="status=='0'?'text-orange cur':''" @tap="tabSelect">全部</view>
  5. <view class="cu-item flex-sub" data-status="2" :class="status=='2'?'text-orange cur':''" @tap="tabSelect">待支付</view>
  6. <view class="cu-item flex-sub" data-status="3" :class="status=='3'?'text-orange cur':''" @tap="tabSelect">已支付</view>
  7. <view class="cu-item flex-sub" data-status="4" :class="status=='4'?'text-orange cur':''" @tap="tabSelect">已完成</view>
  8. <view class="cu-item flex-sub" data-status="5" :class="status=='5'?'text-orange cur':''" @tap="tabSelect">已退单</view>
  9. <view class="cu-item flex-sub" data-status="1" :class="status=='1'?'text-orange cur':''" @tap="tabSelect">已取消</view>
  10. </scroll-view>
  11. <view class="echo-fixed-top-empty"></view>
  12. <block v-for="(item,index) in plist" :key="item.id">
  13. <view class="cu-item bg-white margin-top-sm">
  14. <view class="cu-list menu-avatar">
  15. <view class="cu-item">
  16. <view class="cu-avatar lg" :style="'background-image:url('+ item.tilpic +');'"></view>
  17. <view class="content echo-order-venue">
  18. <view class="text-grey">
  19. <text class="text-cut">{{item.title}}</text>
  20. </view>
  21. <view class="text-gray text-sm flex">
  22. <view class="text-cut">
  23. 订单号:{{item.ordersn}}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="cu-list menu sm-border solid-bottom" style="margin-top: 0rpx;">
  30. <view class="cu-item">
  31. <view class="content">
  32. <text class="text-grey">订单状态</text>
  33. </view>
  34. <view class="action">
  35. <text class="text-lg text-right basis-sm text-grey" v-if="item.status==1">已取消</text>
  36. <text class="text-lg text-right basis-sm text-red" v-if="item.status==2">待支付</text>
  37. <text class="text-lg text-right basis-sm text-green" v-if="item.status==3">已支付</text>
  38. <text class="text-lg text-right basis-sm text-green" v-if="item.status==4">已完成</text>
  39. <text class="text-lg text-right basis-sm text-orange" v-if="item.status==5">已退单</text>
  40. </view>
  41. </view>
  42. <view class="cu-item">
  43. <view class="content">
  44. <text class="text-grey">兑购数量</text>
  45. </view>
  46. <view class="action">
  47. <text class="text-lg">{{item.buynumber}} 件</text>
  48. </view>
  49. </view>
  50. <view class="cu-item">
  51. <view class="content">
  52. <text class="text-grey">积分&金额</text>
  53. </view>
  54. <view class="action">
  55. <text class="text-lg">{{item.integral}}积分 + ¥{{item.paymoney}}</text>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="solid-top grid text-center col-2" v-if="item.status==1">
  60. <view class="padding-tb text-grey solid-right" @tap="deleteOrder(item.id)">删除订单</view>
  61. <view class="padding-tb" @tap="goPage('/pages/mall/order?orderid='+item.id)">订单详情</view>
  62. </view>
  63. <view class="solid-top grid text-center col-2" v-else-if="item.status==2">
  64. <view class="padding-tb text-grey solid-right" @tap="closeOrder(item.id)">取消订单</view>
  65. <view class="padding-tb text-red" @tap="goPage('/pages/mall/order?orderid='+item.id)">立即支付</view>
  66. </view>
  67. <view class="solid-top grid text-center col-1" v-else>
  68. <view class="padding-tb" @tap="goPage('/pages/mall/order?orderid='+item.id)">订单详情</view>
  69. </view>
  70. </view>
  71. </block>
  72. <uni-load-more :status="pstatus"></uni-load-more>
  73. </view>
  74. </template>
  75. <script>
  76. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  77. var _this;
  78. export default {
  79. components: {
  80. uniLoadMore
  81. },
  82. data() {
  83. return {
  84. userinfo: false,
  85. status: 0,
  86. pstatus: 'more',
  87. ppage: 1,
  88. psize: 20,
  89. plist: []
  90. };
  91. },
  92. onLoad: function(option) {
  93. _this = this;
  94. var userinfo = uni.getStorageSync('userinfo') || false;
  95. if (userinfo == false) {
  96. uni.redirectTo({
  97. url: '/pages/login/login'
  98. });
  99. return false;
  100. }
  101. _this.userinfo = userinfo;
  102. _this.getMore();
  103. },
  104. onPullDownRefresh: function() {
  105. _this.ppage = 1;
  106. _this.pstatus = 'more';
  107. _this.plist = [];
  108. _this.getMore();
  109. },
  110. onReachBottom: function() {
  111. if (_this.pstatus !== 'more') {
  112. return;
  113. }
  114. _this.getMore();
  115. },
  116. methods: {
  117. closeOrder: function(orderid) {
  118. _this.$req.ajax({
  119. path: "mall/closeorder",
  120. data: {
  121. orderid: orderid,
  122. userid: _this.userinfo.id
  123. }
  124. }).then((data) => {
  125. uni.showModal({
  126. title: '信息提示',
  127. content: '订单取消成功。',
  128. showCancel: false,
  129. success: function(res) {
  130. _this.pageRefresh();
  131. }
  132. });
  133. }).catch((err) => {
  134. uni.showModal({
  135. title: '信息提示',
  136. content: err,
  137. showCancel: false
  138. });
  139. });
  140. },
  141. deleteOrder: function(orderid) {
  142. _this.$req.ajax({
  143. path: "mall/deleteorder",
  144. data: {
  145. orderid: orderid,
  146. userid: _this.userinfo.id
  147. }
  148. }).then((data) => {
  149. uni.showModal({
  150. title: '信息提示',
  151. content: '订单删除成功。',
  152. showCancel: false,
  153. success: function(res) {
  154. _this.pageRefresh();
  155. }
  156. });
  157. }).catch((err) => {
  158. uni.showModal({
  159. title: '信息提示',
  160. content: err,
  161. showCancel: false
  162. });
  163. });
  164. },
  165. getMore: function() {
  166. _this.$req.ajax({
  167. path: "mall/listorder",
  168. data: {
  169. ppage: _this.ppage,
  170. psize: _this.psize,
  171. userid: _this.userinfo.id,
  172. status: _this.status
  173. }
  174. }).then((data) => {
  175. _this.pstatus = data.pstatus;
  176. _this.plist = _this.plist.concat(data.plist);
  177. _this.ppage += 1;
  178. uni.stopPullDownRefresh();
  179. }).catch((err) => {
  180. uni.showModal({
  181. title: '信息提示',
  182. content: err,
  183. showCancel: false
  184. });
  185. });
  186. },
  187. tabSelect: function(e) {
  188. _this.status = e.currentTarget.dataset.status;
  189. _this.pageRefresh();
  190. },
  191. pageRefresh: function() {
  192. _this.pstatus = 'more';
  193. _this.ppage = 1;
  194. _this.plist = [];
  195. _this.getMore();
  196. },
  197. goPage: function(pageurl) {
  198. uni.navigateTo({
  199. url: pageurl
  200. });
  201. }
  202. }
  203. }
  204. </script>
  205. <style>
  206. .cu-list.menu-avatar>.cu-item .content {
  207. width: calc(100% - 96rpx - 60rpx - 20rpx) !important;
  208. }
  209. </style>