index.vue 8.0 KB

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