goods.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <view class="container">
  3. <view class="product">
  4. <view class="u-bg-fff pb40">
  5. <view class="pic">
  6. <!-- <image src="../../../static/delImg/product2.png" mode="aspectFill"></image> -->
  7. <swiper class="swiper" indicator-dots="true" autoplay="true" interval="5000" duration="1500" circular="true">
  8. <swiper-item v-if="dataForm.video_url">
  9. <video :src="dataForm.video_url" style="height:100%"></video>
  10. </swiper-item>
  11. <swiper-item v-for="(item, index) in imglist" :key="index">
  12. <image :src="item" mode="aspectFill"></image>
  13. </swiper-item>
  14. </swiper>
  15. <view class="p-price">
  16. <view class="pd24 u-flex-center">
  17. <view class="u-FFF u-font36" v-if="type == 1">
  18. <rich-text :nodes="$mUtil.priceBigSmall(dataForm.min_sale_price)"></rich-text>
  19. </view>
  20. <view class="u-FFF u-font36" v-if="type == 2 || type == 3">
  21. <rich-text :nodes="$mUtil.priceBigSmall(dataForm.min_price)"></rich-text>
  22. </view>
  23. <view class="u-FFF u-font36" v-if="type == 5">
  24. {{ dataForm.min_exchange_point }}积分
  25. <!-- <rich-text :nodes="$mUtil.priceBigSmall(dataForm.min_sale_price)"></rich-text> -->
  26. </view>
  27. <text class="discount u-font24 u-ml20 u-del" v-if="type == 1">¥{{ dataForm.max_market_price }}</text>
  28. <text class="discount u-font24 u-ml20 u-del"
  29. v-if="type == 2 || type == 3">¥{{ dataForm.max_sale_price }}</text>
  30. </view>
  31. <view class="p-ab u-flex-center" v-if="type == 2 || type == 3">
  32. <view class="triangle-bottomright"></view>
  33. <view class="seckill u-text-center u-font28">
  34. <!-- active_state 0:未开始 * 1:进行中 * 2:已结束 -->
  35. <view class="u-bold" v-if="dataForm.active_state == 2">已结束</view>
  36. <view class="u-bold" v-if="dataForm.active_state == 1">距结束</view>
  37. <view class="u-bold" v-if="dataForm.active_state == 0">离开抢</view>
  38. <view v-if="dataForm.active_state != 2">
  39. <uni-countdown :backgroundColor="'none'" @timeup="overDown1" :color="'#00321e'"
  40. :splitorColor="'#00321e'" :show-day="time1[0] > 0" :day="time1[0]" :hour="time1[1]"
  41. :minute="time1[2]" :second="time1[3]"></uni-countdown>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="mt80 u-plr30">
  47. <view>
  48. <text class="u-font34 u-bold u-1A1A1A">{{ dataForm.title }}</text>
  49. </view>
  50. <view class="u-font24 u-mt15 u-999" v-if="type==1 ">
  51. <text>已售
  52. <text class="u-FF0000">{{ dataForm.result_sale_num }}</text>件,仅剩<text class="u-FF0000">{{
  53. dataForm.residual_inventory
  54. }}</text>件</text>
  55. </view>
  56. <view class="u-font24 u-mt15 u-999" v-else>
  57. <text>已售
  58. <text class="u-FF0000">{{ dataForm.result_sale_num }}</text>件</text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="u-bg-fff u-mt10">
  64. <view class="u-plr30 u-flex-center-sb pt-pb35">
  65. <view class="u-flex-center">
  66. <view>
  67. <image class="u-avatar104" :src="shop.logo"></image>
  68. </view>
  69. <view class="u-ml25">
  70. <view class="u-font28 u-1A1A1A u-bold">{{ shop.shop_name }}</view>
  71. <view class="u-999 u-font24 u-mt5 u-text2">
  72. <text class="iconfont u-193E2C">&#xe64b;</text>
  73. {{ shop.province_name }}{{ shop.city_name }}{{ shop.area_name
  74. }}{{ shop.address }}
  75. </view>
  76. </view>
  77. </view>
  78. <!-- <view class="iconfont">&#xe6c7;</view> -->
  79. </view>
  80. </view>
  81. </view>
  82. <view class="bottom-btn u-bg-fff">
  83. <view class="pt-pb30 u-plr30 u-flex-center-sb">
  84. <view class="u-flex-center">
  85. <button class="buy-btn u-DCCDA4 u-font30" @click="open(0)">
  86. 查看更多
  87. </button> <button class="buy-btn u-DCCDA4 u-font30" @click="open(1)">
  88. 下载App
  89. </button>
  90. </view>
  91. </view>
  92. </view>
  93. <ldLoading isFullScreen :active="loading"></ldLoading>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. components: {},
  99. data() {
  100. return {
  101. config: {
  102. back: false, //false是tolbar页面 是则不写
  103. title: "商品详情",
  104. color: "#FFFFFF",
  105. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  106. backgroundColor: [1, "#00321E"],
  107. statusBarFontColor: "#FFFFFF",
  108. backTabPage: "",
  109. },
  110. imglist: [], //详情图片数组
  111. dataForm: {}, //商品详情
  112. shop: {}, //店铺信息
  113. cover: "",
  114. loading: true,
  115. btnText: "打开App",
  116. time1: [0, 0, 0, 0],
  117. type: null,
  118. };
  119. },
  120. props: {
  121. options: {
  122. type: Object,
  123. default: null,
  124. },
  125. },
  126. watch: {
  127. options(n) {
  128. this.options = n;
  129. },
  130. },
  131. created() {
  132. this.type = this.options.type;
  133. if ((this.options.type == 1 || this.options.type == 5) && this.options.id) {
  134. this.getDefaultDetailInfo(this.options.id);
  135. }
  136. if (this.options.type == 2 && this.options.id) {
  137. this.getSeckillDetail(this.options.id);
  138. }
  139. if (this.options.type == 3 && this.options.id) {
  140. this.getGroupsDetailInfo(this.options.id);
  141. }
  142. if (this.options.type == 4 && this.options.id) {
  143. this.getserviceDetailInfo(this.options.id);
  144. }
  145. },
  146. onShow() {},
  147. onLoad(options) {},
  148. methods: {
  149. open(number) {
  150. if (number == 0) {
  151. window.location.href = "lida://&pageType=1&type=" + this.type + "&id=" + this.goodsId + "&shareId=" + this
  152. .options.shareId + '&teamId=' + this.options.teamId;
  153. } else {
  154. uni.navigateTo({
  155. url: "/pages/down",
  156. });
  157. }
  158. },
  159. // 获取主页数据
  160. getIndexList(shopid) {
  161. this.$http.get("/yxt/shop/info/" + shopid).then((res) => {
  162. uni.stopPullDownRefresh();
  163. this.loading = false;
  164. if (res.data && res.code == 200) {
  165. this.shop = res.data;
  166. }
  167. });
  168. },
  169. //普通商品
  170. getDefaultDetailInfo(id) {
  171. this.$http.get("/goods/info/" + id).then((res) => {
  172. this.loading = false;
  173. if (res && res.code == 200) {
  174. this.dataForm = res.data;
  175. this.goodsId = res.data.id;
  176. this.imglist = res.data.images;
  177. this.shareImg = res.data.cover;
  178. this.shareTitle = res.data.title;
  179. if (res.data.point_goods) {
  180. this.type = 5;
  181. }
  182. this.getIndexList(res.data.shop_id);
  183. }
  184. });
  185. },
  186. /**组团商品*/
  187. getGroupsDetailInfo(id) {
  188. this.$http.get("/groupbuy/activitygoods/goodsInfo/" + id).then((res) => {
  189. this.loading = false;
  190. if (res && res.code == 200) {
  191. this.dataForm = res.data;
  192. this.goodsId = res.data.id;
  193. this.imglist = res.data.cover.split(",");
  194. this.getIndexList(res.data.shop_id);
  195. if (res.data.active_state == 0) {
  196. this.time1 = this.$mUtil
  197. .countDown(res.data.activity_start_time)
  198. .split(":");
  199. } else {
  200. this.time1 = this.$mUtil
  201. .countDown(res.data.finish_time)
  202. .split(":")
  203. .map((val) => Number(val));
  204. }
  205. }
  206. });
  207. },
  208. getSeckillDetail(id) {
  209. this.$http
  210. .get("/marketing/seckillActivityGoods/info/" + id)
  211. .then((res) => {
  212. this.loading = false;
  213. if (res && res.code == 200) {
  214. this.dataForm = res.data;
  215. this.goodsId = res.data.id;
  216. this.$http.get("/yxt/shop/info/" + res.data.shop_id).then((res) => {
  217. if (res.data && res.code == 200) {
  218. this.shop = res.data;
  219. }
  220. });
  221. this.imglist = res.data.cover.split(",");
  222. if (res.data.active_state == 0) {
  223. this.time1 = this.$mUtil
  224. .countDown(res.data.activity_start_time)
  225. .split(":");
  226. } else {
  227. this.time1 = this.$mUtil
  228. .countDown(res.data.finish_time)
  229. .split(":");
  230. }
  231. }
  232. });
  233. },
  234. getserviceDetailInfo(id) {
  235. this.$http.get("/service/goods/info/" + id).then((res) => {
  236. this.loading = false;
  237. if (res && res.code == 200) {
  238. this.dataForm = res.data;
  239. this.goodsId = res.data.id;
  240. this.imglist = res.data.images;
  241. this.shareImg = res.data.cover;
  242. this.shareTitle = res.data.title;
  243. this.getIndexList(res.data.shop_id);
  244. }
  245. });
  246. },
  247. },
  248. };
  249. </script>
  250. <style lang="scss">
  251. page {
  252. background-color: #f5f5f5;
  253. }
  254. .pd24 {
  255. padding: 24rpx;
  256. }
  257. .pd20 {
  258. padding: 20rpx;
  259. }
  260. .pt20-pb14 {
  261. padding-top: 20rpx;
  262. padding-bottom: 14rpx;
  263. }
  264. .pt28-pb18 {
  265. padding-top: 28rpx;
  266. padding-bottom: 18rpx;
  267. }
  268. .pb30 {
  269. padding-bottom: 30rpx;
  270. }
  271. .pb40 {
  272. padding-bottom: 40rpx;
  273. }
  274. .pb50 {
  275. padding-bottom: 50rpx;
  276. }
  277. .pt-pb30 {
  278. padding-top: 30rpx;
  279. padding-bottom: 30rpx;
  280. }
  281. .pt-pb35 {
  282. padding-top: 35rpx;
  283. padding-bottom: 35rpx;
  284. }
  285. .ml54 {
  286. margin-left: 54rpx;
  287. }
  288. .ml138 {
  289. margin-left: 138rpx;
  290. }
  291. .br-rd10 {
  292. border-radius: 10rpx;
  293. }
  294. .br-rd20 {
  295. border-radius: 20rpx;
  296. }
  297. .stb-btn {
  298. padding: 8rpx 18rpx;
  299. border-radius: 10rpx;
  300. }
  301. .br-FF0000 {
  302. border: 1rpx solid #ff0000;
  303. border-radius: 24rpx;
  304. padding: 6rpx 12rpx;
  305. }
  306. .bg-FFF6EE {
  307. background-color: #fff6ee;
  308. }
  309. .mt80 {
  310. margin-top: 80rpx;
  311. }
  312. .product {
  313. padding-bottom: 150rpx;
  314. }
  315. .pic {
  316. width: 100%;
  317. position: relative;
  318. .swiper {
  319. height: 620rpx;
  320. video {
  321. width: 100%;
  322. height: 620rpx;
  323. }
  324. image {
  325. width: 100%;
  326. height: 620rpx;
  327. }
  328. }
  329. .p-price {
  330. width: 100%;
  331. position: absolute;
  332. top: 580rpx;
  333. background: linear-gradient(left, #00321e, #284534);
  334. border-radius: 20rpx 20rpx 0px 0px;
  335. position: relative;
  336. top: 0px;
  337. z-index: 9999;
  338. .discount {
  339. color: #89a895;
  340. }
  341. .p-ab {
  342. position: absolute;
  343. top: -5px;
  344. right: 0;
  345. }
  346. }
  347. }
  348. .richText {
  349. padding: 30rpx;
  350. }
  351. //秒杀,拼团样式
  352. .p-ab {
  353. position: absolute;
  354. top: 448rpx;
  355. }
  356. .stb-list {
  357. padding-bottom: 10rpx;
  358. }
  359. .triangle-bottomright {
  360. width: 0;
  361. height: 0;
  362. border-bottom: 108rpx solid #dccda4;
  363. border-left: 60rpx solid transparent;
  364. }
  365. .seckill {
  366. background-color: #dccda4;
  367. color: #00321e;
  368. padding: 16rpx;
  369. padding-right: 28rpx;
  370. border-radius: 5rpx 20rpx 0px 0px;
  371. }
  372. .seckill-btn {
  373. width: 86%;
  374. }
  375. .br-284534 {
  376. border-bottom: 1rpx solid rgba($color: #284534, $alpha: 0.3);
  377. }
  378. .gb-te {
  379. padding-top: 20rpx;
  380. padding-bottom: 15rpx;
  381. }
  382. .gb-btn {
  383. padding: 18rpx 80rpx 8rpx;
  384. line-height: 30rpx;
  385. }
  386. .btn-bg-dccda4 {
  387. background: #dccda4;
  388. border-radius: 48rpx 0rpx 0rpx 48rpx;
  389. }
  390. .btn-bg-00321E {
  391. background: #00321e;
  392. border-radius: 0px 48px 48px 0px;
  393. }
  394. .tab {
  395. padding-top: 38rpx;
  396. .active {
  397. font-size: 30rpx;
  398. color: #00321e;
  399. font-weight: 700;
  400. border-bottom: 1rpx solid #00321e;
  401. }
  402. }
  403. .bottom-btn {
  404. width: 100%;
  405. position: fixed;
  406. bottom: 0;
  407. border-top: 1rpx solid #e6e6e6;
  408. .cart {
  409. position: relative;
  410. .number {
  411. position: absolute;
  412. top: -10rpx;
  413. left: 45rpx;
  414. padding: 4rpx 8rpx;
  415. background-color: #ff0000;
  416. border: 4rpx solid #ffffff;
  417. border-radius: 40rpx;
  418. }
  419. }
  420. .cart-btn {
  421. width: 230rpx;
  422. height: 85rpx;
  423. background: #dccda4;
  424. border-radius: 43rpx 0rpx 0rpx 43rpx;
  425. }
  426. .buy-btn {
  427. width: 340rpx;
  428. height: 85rpx;
  429. color: #fff;
  430. line-height: 85rpx;
  431. background: #3775F6;
  432. border-radius: 43rpx;
  433. }
  434. }
  435. .flex-sb {
  436. display: flex;
  437. justify-content: space-between;
  438. }
  439. //弹窗
  440. .spec {
  441. border-radius: 18rpx 18rpx 0rpx 0rpx;
  442. padding-top: 30rpx;
  443. max-height: 900rpx;
  444. overflow-y: auto;
  445. .spec-item {
  446. background-color: #f6f6f6;
  447. border: 1px solid #f6f6f6;
  448. padding: 12rpx 30rpx;
  449. font-size: 24rpx;
  450. color: #1a1a1a;
  451. border-radius: 4px;
  452. }
  453. .activeColor {
  454. background-color: #e1e6e3;
  455. border: 1px solid #01321d;
  456. color: #01321d;
  457. border-radius: 4px;
  458. }
  459. .spec-item:not(:last-child) {
  460. margin-right: 24rpx;
  461. }
  462. //减号
  463. .minus {
  464. width: 50rpx;
  465. height: 50rpx;
  466. line-height: 50rpx;
  467. text-align: center;
  468. background: #dedede;
  469. border-radius: 8rpx 0rpx 0rpx 8rpx;
  470. }
  471. .num {
  472. width: 74rpx;
  473. height: 46rpx;
  474. line-height: 46rpx;
  475. text-align: center;
  476. border: 1px solid #dedede;
  477. }
  478. //加号
  479. .plus-sign {
  480. width: 50rpx;
  481. height: 50rpx;
  482. line-height: 50rpx;
  483. text-align: center;
  484. background: #dedede;
  485. border-radius: 0rpx 8rpx 8rpx 0rpx;
  486. }
  487. .specOpen-btn {
  488. margin-top: 68rpx;
  489. padding-bottom: 34rpx;
  490. button {
  491. background-color: #01331f;
  492. color: #ffffff;
  493. }
  494. }
  495. }
  496. </style>