index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="my-order">
  3. <!-- #ifdef H5 -->
  4. <view class="nav acea-row row-around">
  5. <view class="item" :class="orderStatus === 0 ? 'on' : ''" @click="statusClick(0)">
  6. <view>待付款</view>
  7. </view>
  8. <view class="item" :class="orderStatus == 1 ? 'on' : ''" @click="statusClick(1)">
  9. <view>待发货</view>
  10. </view>
  11. <view class="item" :class="orderStatus == 2 ? 'on' : ''" @click="statusClick(2)">
  12. <view>待收货</view>
  13. </view>
  14. <view class="item" :class="orderStatus == 3 ? 'on' : ''" @click="statusClick(3)">
  15. <view>待评价</view>
  16. </view>
  17. <view class="item" :class="orderStatus == 4 ? 'on' : ''" @click="statusClick(4)">
  18. <view>已完成</view>
  19. </view>
  20. <view class="item" :class="orderStatus == -3 ? 'on' : ''" @click="statusClick(-3)">
  21. <view>退款</view>
  22. </view>
  23. </view>
  24. <Loading :loaded="loaded" :loading="loading"></Loading>
  25. <view class="list">
  26. <view class="item" v-for="(item,index) in orderList" :key="index" @click="goOrderDetails(item.id)">
  27. <view class="title acea-row row-between row-middle">
  28. <view>
  29. <view class="order_no">订单号:{{item.order_id}}</view>
  30. <view class="create_time">下单时间:{{item._add_time}}</view>
  31. </view>
  32. <view class="sign" v-if="orderStatus == -3 && item.refund_type == 6">已退款</view>
  33. <view class="sign" v-if="orderStatus == -3 && item.refund_type == 1">仅退款</view>
  34. <view class="sign" v-if="orderStatus == -3 && item.refund_type == 2">退货退款</view>
  35. <view class="sign" v-if="orderStatus == -3 && item.refund_type == 3">拒绝</view>
  36. <view class="sign" v-if="orderStatus == -3 && item.refund_type == 4">同意退货</view>
  37. <view class="sign" v-if="orderStatus == -3 && item.refund_type == 5">已退货</view>
  38. <view class="sign" v-else>{{orderStatus | typeMsg}}</view>
  39. </view>
  40. <view class="item-info acea-row row-between row-top" v-for="(val, index1) in item.cartInfo" :key="index1">
  41. <view class="pictrue">
  42. <image :src="val.productInfo.image"></image>
  43. </view>
  44. <view>
  45. <view class="text acea-row row-between">
  46. <view class="name line2">{{ val.productInfo.store_name }}</view>
  47. <view class="money">¥{{ val.productInfo.attrInfo.price }}
  48. <view>x{{ val.cart_num }}</view>
  49. </view>
  50. </view>
  51. <view class="sku line1" v-if="val.productInfo.attrInfo.suk">
  52. {{ val.productInfo.attrInfo.suk }}
  53. </view>
  54. </view>
  55. </view>
  56. <view class="totalPrice">
  57. 共{{ item.total_num }}件商品,总金额
  58. <text class="money">¥{{ item.pay_price }}</text>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="ht100"></view>
  63. <tNav :active="1"></tNav>
  64. <!-- #endif -->
  65. </view>
  66. </template>
  67. <script>
  68. // #ifdef H5
  69. import {getWorkOrderList} from "@/api/work.js"
  70. import Loading from '@/components/Loading/index.vue';
  71. import tNav from '../components/tabNav.vue';
  72. import {wx} from "@/utils/agent.js"
  73. export default{
  74. data() {
  75. return {
  76. userId:"",
  77. loaded: false,
  78. loading: false, //是否加载中
  79. loadend: false, //是否加载完毕
  80. loadTitle: '加载更多', //提示语
  81. orderList: [], //订单数组
  82. orderStatus: 0, //订单状态
  83. page: 1,
  84. limit: 10,
  85. }
  86. },
  87. components:{Loading,tNav},
  88. filters:{
  89. typeMsg(value){
  90. const statusMap = {
  91. 0: "待付款",
  92. 1: "待发货",
  93. 2: "待收货",
  94. 3: "待评价",
  95. 4: "已完成",
  96. };
  97. return statusMap[value];
  98. }
  99. },
  100. onLoad() {
  101. this.userId = this.$Cache.get('work_user_id')
  102. this.getList();
  103. },
  104. methods:{
  105. getUserID(){
  106. wx.invoke('getContext', {}, (res)=>{
  107. if(res.err_msg == "getContext:ok"){
  108. let entry = res.entry ;
  109. //返回进入H5页面的入口类型,
  110. //目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
  111. wx.invoke('getCurExternalContact', {entry}, (response)=>{
  112. if(response.err_msg == "getCurExternalContact:ok"){
  113. //返回当前外部联系人userId
  114. this.userId = response.userId;
  115. this.getList();
  116. }
  117. });
  118. }
  119. });
  120. },
  121. statusClick(index){
  122. if(this.loading) return
  123. if (index === this.orderStatus) return;
  124. this.orderStatus = index;
  125. this.loadend = false;
  126. this.page = 1;
  127. this.$set(this, 'orderList', []);
  128. this.getList();
  129. },
  130. getList(){
  131. let that = this;
  132. let params = {};
  133. if (that.loadend) return;
  134. if (that.loading) return;
  135. that.loading = true;
  136. that.loadTitle = '加载更多';
  137. params = {
  138. userid:that.userId,
  139. page:that.page,
  140. limit:that.limit,
  141. type:that.orderStatus
  142. }
  143. getWorkOrderList(params).then(res=>{
  144. let list = res.data || [];
  145. let loadend = list.length < that.limit;
  146. that.orderList = that.$util.SplitArray(list, that.orderList);
  147. that.$set(that, 'orderList', that.orderList);
  148. that.loadend = loadend;
  149. that.loading = false;
  150. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  151. that.page = that.page + 1;
  152. }).catch(err=>{
  153. return that.$util.Tips({
  154. title: err
  155. });
  156. })
  157. },
  158. goOrderDetails(id){
  159. uni.navigateTo({
  160. url:'/pages/work/orderDetail/index?id=' + id
  161. })
  162. }
  163. },
  164. onReachBottom: function() {
  165. this.getList();
  166. }
  167. }
  168. // #endif
  169. </script>
  170. <style lang="scss">
  171. /* #ifdef H5 */
  172. .nav {
  173. width: 750rpx;
  174. height: 92rpx;
  175. background: #FFFFFF;
  176. }
  177. .nav .item {
  178. text-align: center;
  179. line-height: 92rpx;
  180. font-size: 28rpx;
  181. font-family: PingFangSC-Regular, PingFang SC;
  182. font-weight: 400;
  183. color: #333333;
  184. }
  185. .nav .item.on {
  186. font-weight: 400;
  187. color: #1890FF;
  188. }
  189. .list {
  190. width: 690rpx;
  191. margin: 28rpx auto 0;
  192. }
  193. .list .item {
  194. background-color: #fff;
  195. border-radius: 12rpx;
  196. margin-bottom: 28rpx;
  197. }
  198. .my-order .list .item .title {
  199. height: 110rpx;
  200. padding: 16rpx 24rpx 18rpx;
  201. box-sizing: border-box;
  202. border-bottom: 1rpx solid #eee;
  203. .order_no{
  204. font-size: 30rpx;
  205. font-family: PingFangSC-Medium, PingFang SC;
  206. font-weight: 500;
  207. color: rgba(0, 0, 0, 0.85);
  208. line-height: 42rpx;
  209. }
  210. .create_time{
  211. font-size: 24rpx;
  212. font-family: PingFangSC-Regular, PingFang SC;
  213. font-weight: 400;
  214. color: #666666;
  215. line-height: 34rpx;
  216. }
  217. }
  218. .my-order .list .item .title .sign {
  219. color: #1890FF;
  220. }
  221. .my-order .list .item .item-info {
  222. padding: 0 30rpx;
  223. margin-top: 22rpx;
  224. }
  225. .my-order .list .item .item-info .pictrue {
  226. width: 140rpx;
  227. height: 140rpx;
  228. }
  229. .my-order .list .item .item-info .pictrue image {
  230. width: 100%;
  231. height: 100%;
  232. border-radius: 8rpx;
  233. }
  234. .my-order .list .item .item-info .text {
  235. width: 486rpx;
  236. font-size: 28rpx;
  237. color: #999;
  238. }
  239. .my-order .list .item .item-info .text .name {
  240. width: 306rpx;
  241. color: rgba(0, 0, 0, 0.85);
  242. font-size: 28rpx;
  243. height: 80rpx;
  244. line-height: 40rpx;
  245. margin-left: 22rpx;
  246. }
  247. .my-order .list .item .sku{
  248. width: 280rpx;
  249. margin: 26rpx 0 0 22rpx;
  250. font-size: 24rpx;
  251. color: #666;
  252. }
  253. .my-order .list .item .item-info .text .money {
  254. text-align: right;
  255. width: 150rpx;
  256. }
  257. .my-order .list .item .item-info .text .money .return{
  258. margin-top: 10rpx;
  259. font-size: 24rpx;
  260. }
  261. .my-order .list .item .totalPrice {
  262. font-size: 26rpx;
  263. color: #282828;
  264. text-align: right;
  265. margin: 27rpx 0 0 30rpx;
  266. padding: 0 30rpx 30rpx 0;
  267. border-bottom: 1rpx solid #eee;
  268. }
  269. .my-order .list .item .totalPrice .money {
  270. font-size: 28rpx;
  271. font-weight: bold;
  272. color: #F5222D;
  273. }
  274. .my-order .list .item .bottom {
  275. height: 107rpx;
  276. padding: 0 30rpx;
  277. }
  278. .my-order .list .item .bottom .bnt {
  279. width: 176rpx;
  280. height: 60rpx;
  281. text-align: center;
  282. line-height: 60rpx;
  283. color: #fff;
  284. border-radius: 50rpx;
  285. font-size: 27rpx;
  286. }
  287. .my-order .list .item .bottom .bnt.cancelBnt {
  288. border: 1rpx solid #ddd;
  289. color: #aaa;
  290. }
  291. .my-order .list .item .bottom .bnt~.bnt {
  292. margin-left: 17rpx;
  293. }
  294. .ht100{
  295. height: 120rpx;
  296. }
  297. /* #endif */
  298. </style>