consignment.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="container">
  3. <!-- 顶部导航 -->
  4. <view class="Tab_con flex_r flex_ac flex_jb">
  5. <view class="tab_list flex_r flex_ac" :class="current == item.status ? 'active' : ''" v-for="(item,index) in TabList" :key="index" @tap="SetCurrent(item.status)">{{item.title}}</view>
  6. </view>
  7. <!-- 顶部导航-end -->
  8. <!-- 寄卖列表 -->
  9. <view class="con">
  10. <view class="goods flex_c" v-for="(item,index) in goods" :key="index" @tap="navToSpeedUp(item,index)">
  11. <view class="flex_r">
  12. <image class="goods_img" :src="item.original_img" mode=""></image>
  13. <view class="goods_info flex_c flex_jc">
  14. <view class="goods_name ellipsis">{{item.goods_name}}</view>
  15. <view class="period">寄卖数量:{{item.surplus_num}}套</view>
  16. </view>
  17. <view class="goods_status flex_grow flex_r flex_je" :class="item.status === 0 ? 'g_color' : item.status == 1 ? 'g_color' : item.status == 2 ? 'y_color' : 'r_color'">
  18. {{item.status === 0 ? '寄卖中' : item.status == 1 ? '寄卖成功' : item.status == 2 ? '寄卖失败' : '寄卖转邮递'}}
  19. </view>
  20. </view>
  21. <view class="goods_time">{{$day(item.start_sell_time*1000).format("YYYY-MM-DD HH:mm:ss")}}</view>
  22. </view>
  23. </view>
  24. <!-- 寄卖列表-end -->
  25. <not-goods v-if="haveGoods" textStr="暂无寄卖信息"></not-goods>
  26. </view>
  27. </template>
  28. <script>
  29. let page = 1;
  30. import { post } from "@/request/api.js";
  31. import notGoods from '@/components/not-goods/index.vue'
  32. export default {
  33. components:{
  34. notGoods,
  35. },
  36. data() {
  37. return {
  38. current: 0,
  39. TabList:[
  40. {title:'全部',status:0},
  41. {title:'寄卖中',status:1},
  42. {title:'寄卖成功',status:2},
  43. {title:'寄卖失败',status:3},
  44. ],
  45. goods: [],
  46. haveGoods: false, // 是否有商品
  47. selectIndex:'',
  48. isShow:false ,// 是否显示地址
  49. DefaultAddress:'' ,// 地址
  50. pay_way:0 // 操作-0:再次寄卖;1:收货
  51. };
  52. },
  53. onLoad(){
  54. // this.loadAddress()
  55. },
  56. onShow(options){
  57. page = 1;
  58. this.goods = []
  59. this.loadData()
  60. },
  61. methods:{
  62. tabsChange(index){
  63. this.current = index
  64. },
  65. loadData(){
  66. let that = this;
  67. let data = {
  68. type: this.current,
  69. page: page
  70. }
  71. post("v1/goods/consignment",data).then(res => {
  72. if(res.code === 0){
  73. let obj = res.data.data.data
  74. if(obj.length>0){
  75. obj.forEach(e => {
  76. that.goods.push(e)
  77. });
  78. }else{
  79. if(page == 1){
  80. that.haveGoods = true
  81. page = -1
  82. }else{
  83. page = -1
  84. that.$toast('暂无更多')
  85. }
  86. }
  87. }else{
  88. if(page == 1){
  89. that.haveGoods = true
  90. page = -1
  91. }else{
  92. page = -1
  93. that.$toast('暂无更多')
  94. }
  95. }
  96. })
  97. },
  98. // 修改
  99. SetCurrent(i){
  100. this.current = i;
  101. this.haveGoods = false;
  102. page = 1;
  103. this.goods = []
  104. this.loadData()
  105. },
  106. // 跳转加速
  107. navToSpeedUp(item,index){
  108. this.goto("/pages/speed-up/index",{id:item.id})
  109. }
  110. },
  111. onShareAppMessage() {
  112. let userinfo = uni.getStorageSync('userinfo');
  113. var path = '/pages/account/consignment';
  114. if (userinfo.invite) path = '/pages/account/consignment?invite=' + userinfo.invite;
  115. var title = `让数字经济赋能美好生活!`;
  116. return {
  117. title: title,
  118. path: path
  119. }
  120. },
  121. //页面上拉触底事件的处理函数
  122. onReachBottom() {
  123. if (page != -1) {
  124. var that = this;
  125. setTimeout(function () {
  126. ++page;
  127. that.loadData();
  128. }, 800);
  129. }
  130. },
  131. onUnload(){
  132. // #ifdef H5 || APP-PLUS
  133. this.goto("/pages/my/index");
  134. // #endif
  135. // #ifdef  MP-WEIXIN
  136. // uni.switchTab({
  137. // url: "/pages/my/index"
  138. // });
  139. // #endif
  140. },
  141. }
  142. </script>
  143. <style lang="scss">
  144. // 页面配置
  145. page{background: #F4F4F4;}
  146. // 页面配置-end
  147. // 顶部列表
  148. .tab_list{height: 100%;box-sizing: border-box;font-size: 30rpx;color:#808080;}
  149. .Tab_con{width: 100%;height: 92rpx;background: #fff;padding:0 30rpx;box-sizing: border-box;}
  150. .active{color: #1BBD89;border-bottom: 6rpx solid #1BBD89;}
  151. // 顶部列表-end
  152. // 寄卖列表
  153. .goods_info{width: 300rpx;overflow: hidden;}
  154. .period{font-size: 26rpx;color:#5D5C5C;margin-top: 24rpx;}
  155. .goods_status{font-size: 30rpx;font-family: "SourceHanSansCN-Medium";}
  156. .goods_time{font-size: 22rpx;color: #808080;line-height: 1;margin-top: 20rpx;}
  157. .con{width: 100%;overflow: hidden;padding:30rpx 30rpx 0;box-sizing: border-box;}
  158. .goods_img{width: 150rpx;height: 138.8rpx;margin-right: 36rpx;border-radius: 8rpx;}
  159. .goods_name{width: 100%;overflow: hidden;font-size: 32rpx;color: #373636;font-family: "SourceHanSansCN-Medium";}
  160. .goods{width: 100%;overflow: hidden;padding:24rpx 20rpx;box-sizing: border-box;background: #fff;border-radius: 12rpx;margin-bottom: 30rpx;}
  161. // 寄卖列表-end
  162. // 状态颜色
  163. .g_color{color: #1BBD89 !important;}
  164. .y_color{color: #FD9F33 !important;}
  165. .r_color{color: #EC421A !important;}
  166. // 状态颜色-end
  167. // 兑换弹窗
  168. .frist_list{width: 50%;overflow: hidden;}
  169. .frist_text{font-size: 28rpx;color:#302F2F;}
  170. .frist_img{width: 35rpx;height: 35rpx;margin-right: 32rpx;}
  171. .frist_info{width: 100%;overflow: hidden;align-items: initial;}
  172. .closePopup{width: 42rpx;height: 42rpx;position: absolute;right: 0;top: -65rpx;}
  173. .const_info{width: 100%;overflow: hidden;padding:30rpx 50rpx;box-sizing: border-box;}
  174. .const_con{width: 689rpx;border-radius: 10rpx;background: #fff;position: relative;padding-bottom: 20rpx;}
  175. .const_head{width: 100%;height: 97rpx;border-bottom:3rpx solid rgba(0,0,0,.15);font-size: 40rpx;color:#1BBD89;font-family: "SourceHanSansCN-Medium";}
  176. .conversion{width: 269rpx;height: 68rpx;background: #1BBE8A;font-family: "SourceHanSansCN-Medium";color:#fff;font-size: 32rpx;border-radius: 34rpx;margin: 40rpx auto 0;}
  177. // 兑换弹窗-end
  178. // 收货地址
  179. .user_phone{font-size: 26rpx;color:#222;}
  180. .set_text{font-size: 24rpx;color:#868686;}
  181. .set_img{width: 24rpx;height: 24rpx;margin-right: 9rpx;}
  182. .add_address{width: 100%;overflow: hidden;height: 109rpx;}
  183. .add_icon{width: 60rpx;height: 60rpx;margin-bottom: 12rpx;}
  184. .user_name{font-size:32rpx;color:#000;margin-right: 46rpx;}
  185. .add_name{width: 448rpx;overflow: hidden;font-size: 24rpx;color:#868686;}
  186. .add_text{font-size: 24rpx;color:#868686;font-family: "SourceHanSansCN-Normal";}
  187. .address{width: 100%;overflow: hidden;padding:28rpx;box-sizing: border-box;background: #fff;border-radius: 12rpx;background: #f4f4f4;}
  188. // 收货地址-end
  189. </style>