proItem.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <style lang="scss">
  2. .m-app{width:100vw}
  3. /* 头部 */
  4. .app-header{width:100%;position:fixed;top:0px;left:0px;z-index: 10;background: transparent;}
  5. .app-header-bg{background: #ffffff;}
  6. .mp-padding{width:100%;height:50px;}
  7. button.item-back-btn{width:30px;height:30px;}
  8. button.item-back-btn image{width:30px;height:30px;}
  9. .mp-title{color:transparent;font-size: 16px;font-weight: 700;text-align: center;width:100%;height:50px;line-height: 50px;position: relative;}
  10. .mp-title text{ width: 80%; white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;display: inline-block;}
  11. .mp-title button.item-back-btn{position: absolute;left:12px;top:10px}
  12. .app-header-bg .mp-title{color:#333333;}
  13. /* 滚动内容区域 */
  14. scroll-view.mid-body{width:100vw;height:calc(100vh - 50px);}
  15. /* 轮播 */
  16. .item-swiper{width:100vw;height:100vw;background:#ffffff;position: relative;}
  17. .swiper-count{height:24px;line-height: 24px; position: absolute;right:15px;bottom:15px;padding: 0px 10px;border-radius: 12px;background: rgba(0,0,0,0.5);}
  18. .swiper-count text{color:#f7f7f7;font-size: 14px;height:14px;line-height: 14px;}
  19. .swiper-count text:first-child{font-weight: 700;}
  20. swiper{width:100vw;height:100vw;}
  21. swiper-item{width:100vw;height:100vw;}
  22. image.swiper-item-img{width:100vw;height:100vw;}
  23. .item-transparent{background: transparent;}
  24. .item-info{
  25. background: linear-gradient(90deg, #ef4e51, #f4713b);
  26. bottom: 0;
  27. padding: 17px;
  28. .price{
  29. font-size: 28px;
  30. font-weight: 700;
  31. color: #fff;
  32. text{font-size: 16px;}
  33. }
  34. .info-time{
  35. font-size: 16px;
  36. font-weight: 600;
  37. color: #fff;
  38. }
  39. }
  40. .goods-item{
  41. padding: 36rpx;
  42. .title{
  43. font-size: 18px;
  44. font-weight: 700;
  45. color: #1d2023;
  46. }
  47. .people{
  48. margin-top: 17px;
  49. image{
  50. width: 12px;
  51. height: 12px;
  52. }
  53. .name{
  54. margin-left: 6px;
  55. font-size: 13px;
  56. font-family: PingFang SC;
  57. font-weight: 500;
  58. color: #333;
  59. }
  60. }
  61. .tmr{
  62. image{width: 24px;height: 24px;}
  63. margin-top: 9px;
  64. font-size: 13px;
  65. color: #333;
  66. }
  67. }
  68. .explain{
  69. padding: 22px 19px 26px 19px;
  70. .explain-title {
  71. font-size: 18px;
  72. font-weight: 6 00;
  73. color: #333;
  74. }
  75. .explain-main{
  76. margin-top: 29px;
  77. }
  78. .explainImage-box{
  79. display: flex;
  80. justify-content: space-around;
  81. align-items: center;
  82. .explain-image-item{
  83. width: 24px;
  84. height: 22px;
  85. }
  86. .explain-image-jiant{
  87. width: 21px;
  88. height: 5px;
  89. }
  90. }
  91. .explainfont-box{
  92. margin-top: 11px;
  93. display: flex;
  94. justify-content: space-between;
  95. .explain-font-item{
  96. font-size: 16px;
  97. font-family: PingFang SC;
  98. font-weight: 500;
  99. color: #333;
  100. }
  101. }
  102. }
  103. /** 商品新详情**/
  104. .goods-info{background: #fff;margin: 10px;padding: 8px;border-radius: 10px;}
  105. .goods-info .price-info{}
  106. .goods-info .price-info .price{color: #fd3b39;font-size: 28px;font-weight: 600;}
  107. .goods-info .price-info .price text{color: #fd3b39;font-size: 16px;font-weight: 400;}
  108. .goods-info .price-info .old-price{margin-left: 10px;color: #98999A;font-size: 14px;font-weight: 400;text-decoration: line-through;}
  109. .goods-info .title{color: #333;font-size: 16px;font-weight: 600;}
  110. .goods-info .foot{margin-top: 10px;}
  111. .goods-info .address{color: #ACACAC;font-size: 14px;font-weight: 400;}
  112. .goods-info .add-icon{width: 14px;height: 14px;margin-right: 3px;}
  113. .goods-info .sales{color: #ACACAC;font-size: 14px;font-weight: 400;}
  114. .green-info{border:1px solid #fd3b39;border-radius: 10px; padding: 5px;background: rgba(1, 149, 96, 0.2);margin-top: 10px;}
  115. .green-info image{width: 20px;height: 20px;margin-right: 4px;}
  116. .green-info .tinfo{font-size: 12px;color: #fd3b39;}
  117. .green-info .tinfo text{font-weight: bold;}
  118. /* 商品详情 */
  119. .item-desc{width:100%;}
  120. .item-desc-title{width:100%;height:40px;}
  121. .desc-title{font-size: 15px;height:15px;line-height: 15px;text-align: center;color:#333333;margin: 0px 10px;}
  122. .desc-title-left{width:40px;height:1px;background: #E6E6E6}
  123. .desc-title-right{width:40px;height:1px;background: #E6E6E6}
  124. .item-desc-img{width:100%}
  125. .item-desc-img image{width:100%}
  126. .item-desc-img text{ position: absolute; width: 100%; text-align: center; font-size: 1px; color: #ccc;}
  127. .app-footer{
  128. bottom: 0;
  129. height: 80px;
  130. background: #fff;
  131. width: calc(100% - 20px);
  132. padding-left: 10px;
  133. position: fixed;
  134. .left{
  135. .item{
  136. image{width: 21px;height: 21px;}
  137. .text{
  138. margin-top: 8px;
  139. font-size: 13px;
  140. font-weight: 600;
  141. color: #333;
  142. }
  143. }
  144. .line{
  145. margin: 0 20rpx;
  146. width: 1px;
  147. height: 30px;
  148. background: #c0bfc0;
  149. }
  150. }
  151. .app-btn{
  152. margin-left: 22px;
  153. height: 45px;
  154. background: #fd3b39;
  155. border-radius: 11px;
  156. text-align: center;
  157. font-size: 19px;
  158. font-weight: 700;
  159. color: #fff;
  160. line-height: 45px;
  161. }
  162. .app-btn-no{
  163. margin-left: 22px;
  164. height: 45px;
  165. background: #ccc;
  166. border-radius: 11px;
  167. text-align: center;
  168. font-size: 19px;
  169. font-weight: 700;
  170. color: #000;
  171. line-height: 45px;
  172. }
  173. }
  174. </style>
  175. <template>
  176. <view class="m-app">
  177. <view class="app-header" :class="topShow ? 'app-header-bg' : ''">
  178. <view class="top-bar" :style="'height:' + barHeight + 'px'"></view>
  179. <view class="mp-padding fx-r fx-bc" >
  180. <view class="mp-title">
  181. <button class="nt item-back-btn fx-r fx-bc fx-ac" @tap="tapBack">
  182. <image src="/static/img/icon_item_back.png"></image>
  183. </button>
  184. <text>{{data.name || ""}}</text>
  185. </view>
  186. </view>
  187. </view>
  188. <scroll-view class="mid-body clearfix" scroll-y="true" @scrolltolower="loadMoreData" @scroll="tapScroll">
  189. <view class="item-swiper">
  190. <swiper autoplay='true' @change="tapSwiperChange" indicator-dots="true" indicator-color='rgba(255,255,255,.3)' indicator-active-color='rgba(255,255,255,1)'>
  191. <swiper-item @tap="tapPhone('img',index)" v-for="(item,index) in data.imgs">
  192. <image class="swiper-item-img" :src="item" mode="aspectFill"></image>
  193. </swiper-item>
  194. </swiper>
  195. <view v-if="data.is_stepinto == 1" style="background: #333; color: #FFF; border-radius: 4px;font-size: 10px; margin-left: 4px;padding: 0px 4px;position: absolute;bottom: 10px;left: 10px;">跨境产品</view>
  196. <view class="swiper-count fx-r fx-bc"><text>{{swiperCurrent+1}}</text><text>/{{data.imgs.length?data.imgs.length:''}}</text></view>
  197. </view>
  198. <view class="item-info fx-r fx-bc">
  199. <view class="price"><text>¥</text>{{ data.hanging_price || 0 }}</view>
  200. <view class="fx-g1"></view>
  201. <view class="info-time" v-if="data.radd_time > 0">
  202. <text v-if="data.isToday == 1">挂售时间:{{ utils.date('H:i',data.radd_time) }} - {{ utils.date('H:i',data.rend_time) }}</text>
  203. <text v-if="data.isToday == 0">挂售日期:{{ utils.date('Y-m-d',data.radd_time) }}</text>
  204. </view>
  205. </view>
  206. <view class="goods-item fx-r">
  207. <view class="title fx-h">
  208. <view class="title">{{ data.name || "" }}</view>
  209. <view class="people fx-r fx-bc">
  210. <image src="/static/img/people.png"></image>
  211. <view class="name">归属人:{{ data.user_nickname }}</view>
  212. </view>
  213. </view>
  214. <view class="fx-g1"></view>
  215. <view class="tmr" @tap="tapHistory">
  216. <image src="/static/img/suyuan.png"></image>
  217. <view class="t">溯源</view>
  218. </view>
  219. </view>
  220. <view class="explain">
  221. <view class="explain-title">商品挂售说明</view>
  222. <view class="explain-main">
  223. <view class="explainImage-box">
  224. <image src="/static/img/au_order.png" class="explain-image-item"></image>
  225. <image src="/static/img/au_next.png" class="explain-image-jiant"></image>
  226. <image src="/static/img/au_pay.png" class="explain-image-item"></image>
  227. <image src="/static/img/au_next.png" class="explain-image-jiant"></image>
  228. <image src="/static/img/au_fang.png" class="explain-image-item"></image>
  229. <image src="/static/img/au_next.png" class="explain-image-jiant"></image>
  230. <image src="/static/img/au_torder.png" class="explain-image-item"></image>
  231. </view>
  232. <view class="explainfont-box">
  233. <view class="explain-font-item">挂售商品</view>
  234. <view class="explain-font-item">支付货款</view>
  235. <view class="explain-font-item">卖家发货</view>
  236. <view class="explain-font-item">挂售/提货</view>
  237. </view>
  238. </view>
  239. </view>
  240. <!-- 商品详情 -->
  241. <view class="item-desc">
  242. <view class="item-desc-title fx-r fx-bc fx-ac">
  243. <text class="desc-title-left"></text>
  244. <text class="desc-title">详情</text>
  245. <text class="desc-title-right"></text>
  246. </view>
  247. <view class="item-desc-img">
  248. <image @tap="tapPhone('descImg',index)" mode="widthFix" :src="item" v-for="(item,index) in data.imgDesc" />
  249. </view>
  250. </view>
  251. </scroll-view>
  252. <!-- app底部 -->
  253. <view class="app-footer fx-r fx-bc">
  254. <view class="left fx-r">
  255. <view class="item fx-h fx-bc fx-ac" @tap="tapOpen" data-url="/pages/user/detail/anticipate">
  256. <image src="/static/img/au_juan.png"></image>
  257. <view class="text">易趣卷</view>
  258. </view>
  259. <view class="line"></view>
  260. <view class="item fx-h fx-bc fx-ac" @tap="$refs.customer.open()">
  261. <image src="/static/img/au_kefu.png"></image>
  262. <view class="text">客服</view>
  263. </view>
  264. </view>
  265. <template v-if="data.isGoSale == 0">
  266. <button @tap="utils.Tip('未开售')" class="fx-g1 nt app-btn">{{ countdownTime }}</button>
  267. </template>
  268. <template v-if="data.isGoSale == 1">
  269. <button @tap="tapBuy" v-if="data.is_buy == 0" class="fx-g1 nt app-btn">立即抢购</button>
  270. <button @tap="utils.Tip('已抢购')" v-if="data.is_buy == 1" class="fx-g1 nt app-btn-no">已抢购</button>
  271. </template>
  272. </view>
  273. <customer-wiget ref="customer"></customer-wiget>
  274. </view>
  275. </template>
  276. <script>
  277. import customerWiget from '@/components/ui-public/customer-wiget.vue';
  278. import {mapState,mapMutations } from 'vuex';
  279. var idsValue = {};
  280. var buyType = "";
  281. export default {
  282. computed: mapState(['user']),
  283. components: {
  284. customerWiget
  285. },
  286. data() {
  287. return {
  288. id : 0,//产品ID
  289. auction_id : 0,
  290. topShow:false,
  291. swiperCurrent:0,
  292. barHeight:0,
  293. data:{
  294. title : '加载中..',
  295. imgDesc:[],
  296. imgs:[],
  297. radd_time : 0,
  298. rend_time : 0,
  299. is_buy : 0,
  300. isGoSale : -1
  301. },
  302. countdownTime : "00:00:00",
  303. isSubmit : false
  304. }
  305. },
  306. onLoad(option){
  307. this.id = option.id || 0;
  308. this.auction_id = option.auction_id || 0;
  309. uni.setNavigationBarTitle({title:'加载中..'});
  310. this.barHeight = this.$device.statusBarHeight;
  311. this.initView();
  312. setInterval(this.interval,1000);
  313. },
  314. methods: {
  315. /**
  316. * 加载更多
  317. * @param {Object} e
  318. */
  319. loadMoreData: function(e) {
  320. console.log(e)
  321. },
  322. /**
  323. * 下拉下载
  324. * @param {Object} e
  325. */
  326. tapScroll:function(e){
  327. let scrollTop=e.detail.scrollTop;
  328. if(scrollTop < 120 && this.topShow)
  329. this.topShow = false
  330. if(scrollTop > 120 && !this.topShow)
  331. this.topShow = true;
  332. return;
  333. },
  334. tapSwiperChange:function(ev){
  335. this.swiperCurrent = ev.detail.current;
  336. },
  337. tapHistory:function(){
  338. uni.navigateTo({
  339. url:"/pages/guild/history?proId=" + this.id
  340. })
  341. },
  342. /**
  343. *
  344. */
  345. tapBuy:function(){
  346. if(this.user == null) {
  347. uni.navigateTo({ url:"../login/index"});
  348. return;
  349. }
  350. this.submitPost();
  351. },
  352. /**
  353. * 提交数据
  354. */
  355. submitPost:function(){
  356. if(this.isSubmit) return;
  357. this.isSubmit = true;
  358. uni.showLoading({title: '抢单中..'});
  359. var post = {};
  360. post.id = this.id;
  361. post.auction_id = this.auction_id;
  362. this
  363. .request
  364. .post("auctionProRush",post)
  365. .then(res=>{
  366. uni.hideLoading();
  367. console.log(res,'88888')
  368. if(res.code == 200) {
  369. if(res.data.state == 1) {
  370. uni.redirectTo({
  371. url: "buySuccess"
  372. })
  373. } else {
  374. this.data.is_buy = 1;
  375. }
  376. uni.$emit("rushBuy",{id : this.id});
  377. } else {
  378. this.utils.showAlert({title: '系统提示',content: res.msg});
  379. }
  380. this.isSubmit = false;
  381. })
  382. .catch(err=>{
  383. console.log(err);
  384. this.isSubmit = false;
  385. uni.hideLoading();
  386. this.utils.showAlert({title: '系统提示',content: "加载失败,重新点击尝试!"});
  387. });
  388. },
  389. /**
  390. * 获取配置数据
  391. */
  392. initView: function(isPull = true) {
  393. var that = this;
  394. if(isPull) {
  395. uni.showLoading({title: '获取数据中..'});
  396. }
  397. var post = {};
  398. post.id = this.id;
  399. post.auction_id = this.auction_id;
  400. this
  401. .request
  402. .post("auctionProItem",post)
  403. .then(res=>{
  404. uni.hideLoading();
  405. if(res.code == 200) {
  406. this.data = res.data;
  407. uni.setNavigationBarTitle({title:res.data.name});
  408. this.interval();
  409. } else {
  410. this.utils.showAlert({title: '系统提示',content: res.msg});
  411. }
  412. })
  413. .catch(err=>{
  414. console.log(err);
  415. uni.hideLoading();
  416. this.utils.showAlert({title: '系统提示',content: "加载失败,重新点击尝试!"});
  417. });
  418. },
  419. interval:function(){
  420. if(this.data.isGoSale != 0) return;
  421. let time = this.data.radd_time - this.utils.strtotime();
  422. if(time >= 0) {
  423. this.countdownTime = this.utils.countdown(time);
  424. this.data.isGoSale = 0;
  425. } else {
  426. this.data.isGoSale = 1;
  427. }
  428. },
  429. /**
  430. * 打开详情
  431. * @param {Object} type
  432. * @param {Object} index
  433. */
  434. tapPhone:function(type,index){
  435. var ImgAr = [];
  436. if(type == 'img') {
  437. ImgAr = this.data.imgs;
  438. }
  439. if(type == 'descImg') {
  440. ImgAr = this.data.imgDesc;
  441. }
  442. uni.previewImage({
  443. current:index,
  444. urls:ImgAr
  445. });
  446. },
  447. /**
  448. * 打开其他主图2
  449. */
  450. tapPhone2:function(){
  451. var ImgAr = [this.selData.img];
  452. uni.previewImage({
  453. current:0,
  454. urls:ImgAr
  455. });
  456. },
  457. /**
  458. * 打开其他页面
  459. * @param {Object} ev
  460. */
  461. tapOpen: function(ev) {
  462. let url = ev.currentTarget.dataset.url;
  463. this.utils.navigateTo(url);
  464. },
  465. /**
  466. * 返回首页
  467. */
  468. tapHome:function(){
  469. uni.switchTab({
  470. url : "../index/index"
  471. });
  472. },
  473. /**
  474. * 返回上一页
  475. */
  476. tapBack: function() {
  477. uni.navigateBack({
  478. delta: 1
  479. });
  480. }
  481. }
  482. }
  483. </script>