integral_goods_details.vue 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='product-con'>
  4. <scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
  5. :style="'height:'+height+'px;'" @scroll="scroll">
  6. <view id="past0">
  7. <productConSwiper :imgUrls='imgUrls'></productConSwiper>
  8. <view class='nav acea-row row-between-wrapper'>
  9. <view class="share acea-row row-between row-bottom">
  10. <view class="money font-color">
  11. <image src="static/my-point.png" mode=""></image>
  12. <text class="num" v-text="storeInfo.price || 0"></text>积分
  13. </view>
  14. <view></view>
  15. </view>
  16. </view>
  17. <view class='wrapper'>
  18. <view class='introduce acea-row row-between'>
  19. <view class='infor'> {{storeInfo.title}}</view>
  20. </view>
  21. <view class='label acea-row row-middle'>
  22. <view class='stock'>原价:{{storeInfo.product_price}}</view>
  23. <view class='stock'>限量:
  24. {{ storeInfo.quota_show}}
  25. </view>
  26. <view class='stock'>已兑换:{{storeInfo.sales}}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="attribute" v-if='attribute.productAttr.length' @tap='selecAttr'>
  31. <view class='acea-row row-between-wrapper df'>
  32. <view><text class='atterTxt line1'>{{attr}}:{{attrValue}}</text></view>
  33. <view class='iconfont icon-jiantou'></view>
  34. </view>
  35. <view class="acea-row row-between-wrapper" style="margin-top:7px;padding-left:55px;" v-if="skuArr.length > 1">
  36. <view class="flex">
  37. <image :src="item.image" v-for="(item,index) in skuArr.slice(0,4)" :key="index" class="attrImg"></image>
  38. </view>
  39. <view class="switchTxt">共{{skuArr.length}}种规格可选</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class='product-intro' id="past2">
  44. <view class='title'>产品介绍</view>
  45. <view class='conter'>
  46. <jyf-parser :html="storeInfo.description" ref="article" :tag-style="tagStyle"></jyf-parser>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. <view class='footer acea-row row-between-wrapper'>
  51. <navigator hover-class="none" open-type="switchTab" class="item" url="/pages/index/index">
  52. <view class="iconfont icon-shouye6"></view>
  53. <view class="p_center">首页</view>
  54. </navigator>
  55. <view class="bnt acea-row"
  56. v-if="attribute.productSelect.quota > 0 && attribute.productSelect.product_stock>0">
  57. <view class="buy bnts" @tap="goCat">立即兑换</view>
  58. </view>
  59. <view class="bnt acea-row" v-else>
  60. <view class="bnts no-goods">无法兑换</view>
  61. </view>
  62. </view>
  63. </view>
  64. <product-window :attr='attribute' :limitNum='1' :cusPreviewImg='1' :type="'points'" @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
  65. @ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" @getImg="showImg" id="product-window"></product-window>
  66. <cusPreviewImg ref="cusPreviewImg" :list="skuArr" @changeSwitch="changeSwitch"></cusPreviewImg>
  67. <!-- 分享按钮 -->
  68. <kefuIcon :ids='storeInfo.product_id' :routineContact='routineContact'></kefuIcon>
  69. <!-- 发送给朋友图片 -->
  70. </view>
  71. </template>
  72. <script>
  73. const app = getApp();
  74. import {
  75. mapGetters
  76. } from "vuex";
  77. import {
  78. getIntegralProductDetail
  79. } from '@/api/activity.js';
  80. import productConSwiper from '@/components/productConSwiper/index.vue'
  81. import productWindow from '@/components/productWindow';
  82. import cusPreviewImg from '@/components/cusPreviewImg';
  83. import userEvaluation from '@/components/userEvaluation/index.vue'
  84. import kefuIcon from '@/components/kefuIcon';
  85. import parser from "@/components/jyf-parser/jyf-parser";
  86. import countDown from '@/components/countDown';
  87. import {
  88. imageBase64
  89. } from "@/api/public";
  90. import {
  91. toLogin
  92. } from '@/libs/login.js';
  93. import {
  94. silenceBindingSpread
  95. } from "@/utils";
  96. import {
  97. getUserInfo
  98. } from '@/api/user.js';
  99. // #ifdef APP-PLUS
  100. import {
  101. TOKENNAME,
  102. HTTP_REQUEST_URL
  103. } from '@/config/app.js';
  104. // #endif
  105. import colors from "@/mixins/color";
  106. export default {
  107. computed: mapGetters(['isLogin']),
  108. mixins: [colors],
  109. data() {
  110. return {
  111. dataShow: 0,
  112. id: 0,
  113. time: 0,
  114. countDownHour: "00",
  115. countDownMinute: "00",
  116. countDownSecond: "00",
  117. storeInfo: [],
  118. imgUrls: [],
  119. parameter: {
  120. 'navbar': '1',
  121. 'return': '1',
  122. 'title': '抢购详情页',
  123. 'color': false
  124. },
  125. attribute: {
  126. cartAttr: false,
  127. productAttr: [],
  128. productSelect: {}
  129. },
  130. productValue: [],
  131. isOpen: false,
  132. attr: '请选择',
  133. attrValue: '',
  134. status: 1,
  135. isAuto: false,
  136. isShowAuth: false,
  137. iShidden: false,
  138. limitNum: 1, //限制本属性产品的个数;
  139. iSplus: false,
  140. replyCount: 0, //总评论数量
  141. reply: [], //评论列表
  142. replyChance: 0,
  143. navH: "",
  144. navList: ['商品', '详情'],
  145. opacity: 0,
  146. scrollY: 0,
  147. topArr: [],
  148. toView: '',
  149. height: 0,
  150. heightArr: [],
  151. lock: false,
  152. scrollTop: 0,
  153. tagStyle: {
  154. img: 'width:100%;display:block;',
  155. table: 'width:100%',
  156. video: 'width:100%'
  157. },
  158. datatime: '',
  159. navActive: 0,
  160. meunHeight: 0,
  161. backH: '',
  162. posters: false,
  163. weixinStatus: false,
  164. posterImageStatus: false,
  165. storeImage: '', //海报产品图
  166. PromotionCode: '', //二维码图片
  167. posterImage: '', //海报路径
  168. actionSheetHidden: false,
  169. cart_num: 1,
  170. homeTop: 20,
  171. returnShow: true,
  172. H5ShareBox: false, //公众号分享图片
  173. routineContact: 0,
  174. selectSku:{},
  175. skuArr:[]
  176. }
  177. },
  178. components: {
  179. productConSwiper,
  180. 'productWindow': productWindow,
  181. cusPreviewImg,
  182. userEvaluation,
  183. kefuIcon,
  184. "jyf-parser": parser,
  185. countDown
  186. },
  187. computed: mapGetters(['isLogin']),
  188. watch: {
  189. isLogin: {
  190. handler: function(newV, oldV) {
  191. if (newV) {
  192. this.getIntegralProductDetail();
  193. }
  194. },
  195. deep: true
  196. }
  197. },
  198. onLoad(options) {
  199. let that = this
  200. let statusBarHeight = ''
  201. var pages = getCurrentPages();
  202. that.returnShow = pages.length === 1 ? false : true;
  203. //设置商品列表高度
  204. uni.getSystemInfo({
  205. success: function(res) {
  206. that.height = res.windowHeight
  207. statusBarHeight = res.statusBarHeight
  208. //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
  209. },
  210. });
  211. this.isLogin && silenceBindingSpread();
  212. // #ifndef APP-PLUS
  213. this.navH = app.globalData.navHeight
  214. // #endif
  215. // #ifdef APP-PLUS
  216. this.navH = 90
  217. // #endif
  218. // #ifdef MP
  219. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  220. this.meunHeight = menuButtonInfo.height
  221. this.backH = (that.navH / 2) + (this.meunHeight / 2)
  222. //扫码携带参数处理
  223. if (options.scene) {
  224. let value = this.$util.getUrlParams(decodeURIComponent(options.scene));
  225. if (value.id) {
  226. this.id = value.id;
  227. } else {
  228. return this.$util.Tips({
  229. title: '缺少参数无法查看商品'
  230. }, {
  231. tab: 3,
  232. url: 1
  233. });
  234. }
  235. //记录推广人uid
  236. if (value.pid) app.globalData.spid = value.pid;
  237. if (value.time) this.datatime = value.time
  238. }
  239. // #endif
  240. if (options.id) {
  241. this.id = options.id
  242. this.datatime = Number(options.time)
  243. this.status = options.status
  244. }
  245. if (this.isLogin) {
  246. this.getIntegralProductDetail();
  247. } else {
  248. toLogin();
  249. }
  250. this.$nextTick(() => {
  251. // #ifdef MP
  252. const menuButton = uni.getMenuButtonBoundingClientRect();
  253. const query = uni.createSelectorQuery().in(this);
  254. query
  255. .select('#home')
  256. .boundingClientRect(data => {
  257. this.homeTop = menuButton.top * 2 + menuButton.height - data.height;
  258. })
  259. .exec();
  260. // #endif
  261. })
  262. },
  263. onShow(){
  264. uni.removeStorageSync('form_type_cart');
  265. },
  266. methods: {
  267. //点击sku图片打开轮播图
  268. showImg(index){
  269. this.$refs.cusPreviewImg.open(this.selectSku.suk)
  270. },
  271. //滑动轮播图选择商品
  272. changeSwitch(e){
  273. let productSelect = this.skuArr[e];
  274. this.$set(this,'selectSku',productSelect);
  275. var skuList = productSelect.suk.split(',');
  276. skuList.forEach((i,index)=>{
  277. this.$set(this.attribute.productAttr[index],'index',skuList[index]);
  278. })
  279. if (productSelect) {
  280. this.$set(this.attribute.productSelect, 'image', productSelect.image);
  281. this.$set(this.attribute.productSelect, 'price', productSelect.price);
  282. this.$set(this.attribute.productSelect, 'stock', productSelect.stock);
  283. this.$set(this.attribute.productSelect, 'unique', productSelect.unique);
  284. this.$set(this.attribute.productSelect, 'cart_num', 1);
  285. this.$set(this.attribute.productSelect, 'vip_price', productSelect.vip_price);
  286. this.$set(this, 'attrValue', productSelect.suk);
  287. this.$set(this, 'attrTxt', '已选择');
  288. }
  289. },
  290. // app分享
  291. // #ifdef APP-PLUS
  292. appShare(scene) {
  293. let that = this
  294. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  295. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  296. uni.share({
  297. provider: "weixin",
  298. scene: scene,
  299. type: 0,
  300. href: `${HTTP_REQUEST_URL}${curRoute}`,
  301. title: that.storeInfo.title,
  302. summary: that.storeInfo.info,
  303. imageUrl: that.storeInfo.small_image,
  304. success: function(res) {
  305. uni.showToast({
  306. title: '分享成功',
  307. icon: 'success'
  308. })
  309. that.posters = false;
  310. },
  311. fail: function(err) {
  312. uni.showToast({
  313. title: '分享失败',
  314. icon: 'none',
  315. duration: 2000
  316. })
  317. that.posters = false;
  318. }
  319. });
  320. },
  321. // #endif
  322. /**
  323. * 购物车手动填写
  324. *
  325. */
  326. iptCartNum: function(e) {
  327. this.$set(this.attribute.productSelect, 'cart_num', e);
  328. this.$set(this, "cart_num", e);
  329. },
  330. // 后退
  331. returns: function() {
  332. uni.navigateBack()
  333. },
  334. onLoadFun: function(data) {
  335. if (this.isAuto) {
  336. this.isAuto = false;
  337. this.isShowAuth = false;
  338. this.getIntegralProductDetail();
  339. }
  340. },
  341. getIntegralProductDetail: function() {
  342. let that = this;
  343. getIntegralProductDetail(that.id).then(res => {
  344. this.dataShow = 1;
  345. let title = res.data.storeInfo.title;
  346. this.storeInfo = res.data.storeInfo;
  347. this.imgUrls = res.data.storeInfo.images;
  348. this.storeInfo.description = this.storeInfo.description.replace(/<img/gi,
  349. '<img style="max-width:100%;height:auto;float:left;display:block" ');
  350. this.attribute.productAttr = res.data.productAttr;
  351. this.productValue = res.data.productValue;
  352. for(let key in res.data.productValue){
  353. let obj = res.data.productValue[key];
  354. that.skuArr.push(obj)
  355. }
  356. this.$set(this, "selectSku", that.skuArr[0]);
  357. this.attribute.productSelect.num = res.data.storeInfo.num;
  358. this.replyCount = res.data.replyCount;
  359. this.reply = res.data.reply ? [res.data.reply] : [];
  360. this.replyChance = res.data.replyChance;
  361. that.routineContact = res.data.routine_contact_type;
  362. uni.setNavigationBarTitle({
  363. title: title.substring(0, 7) + '...'
  364. });
  365. // #ifdef H5
  366. this.PromotionCode = res.data.storeInfo.code_base
  367. that.storeImage = that.storeInfo.image
  368. // #endif
  369. that.DefaultSelect();
  370. app.globalData.openPages = '/pages/activity/goods_seckill_details/index?id=' + that.id +
  371. '&time=' + that.time +
  372. '&status=' + that.status + '&scene=' + that.storeInfo.uid;
  373. // wxParse.wxParse('description', 'html', that.data.storeInfo.description || '', that, 0);
  374. // wxh.time(that.data.time, that);
  375. }).catch(err => {
  376. that.$util.Tips({
  377. title: err
  378. }, {
  379. tab: 3
  380. })
  381. });
  382. },
  383. setShare: function() {
  384. this.$wechat.isWeixin() &&
  385. this.$wechat.wechatEvevt([
  386. "updateAppMessageShareData",
  387. "updateTimelineShareData",
  388. "onMenuShareAppMessage",
  389. "onMenuShareTimeline"
  390. ], {
  391. desc: this.storeInfo.info,
  392. title: this.storeInfo.title,
  393. link: location.href,
  394. imgUrl: this.storeInfo.image
  395. }).then(res => {
  396. }).catch(err => {
  397. console.log(err);
  398. });
  399. },
  400. /**
  401. * 默认选中属性
  402. *
  403. */
  404. DefaultSelect: function() {
  405. let self = this
  406. let productAttr = self.attribute.productAttr;
  407. let value = [];
  408. for (var key in this.productValue) {
  409. if (this.productValue[key].quota > 0) {
  410. value = this.attribute.productAttr.length ? key.split(",") : [];
  411. break;
  412. }
  413. }
  414. for (let i = 0; i < productAttr.length; i++) {
  415. this.$set(productAttr[i], "index", value[i]);
  416. }
  417. //sort();排序函数:数字-英文-汉字;
  418. let productSelect = this.productValue[value.join(",")];
  419. if (productSelect && productAttr.length) {
  420. self.$set(
  421. self.attribute.productSelect,
  422. "store_name",
  423. self.storeInfo.title
  424. );
  425. self.$set(self.attribute.productSelect, "image", productSelect.image);
  426. self.$set(self.attribute.productSelect, "price", productSelect.price);
  427. self.$set(self.attribute.productSelect, "stock", productSelect.stock);
  428. self.$set(self.attribute.productSelect, "unique", productSelect.unique);
  429. self.$set(self.attribute.productSelect, "quota", productSelect.quota);
  430. self.$set(self.attribute.productSelect, "quota_show", productSelect.quota_show);
  431. self.$set(self.attribute.productSelect, "product_stock", productSelect.product_stock);
  432. self.$set(self.attribute.productSelect, "cart_num", 1);
  433. self.$set(self, "attrValue", value.join(","));
  434. self.attrValue = value.join(",")
  435. } else if (!productSelect && productAttr.length) {
  436. self.$set(
  437. self.attribute.productSelect,
  438. "store_name",
  439. self.storeInfo.title
  440. );
  441. self.$set(self.attribute.productSelect, "image", self.storeInfo.image);
  442. self.$set(self.attribute.productSelect, "price", self.storeInfo.price);
  443. self.$set(self.attribute.productSelect, "quota", 0);
  444. self.$set(self.attribute.productSelect, "quota_show", 0);
  445. self.$set(self.attribute.productSelect, "product_stock", 0);
  446. self.$set(self.attribute.productSelect, "stock", 0);
  447. self.$set(self.attribute.productSelect, "unique", "");
  448. self.$set(self.attribute.productSelect, "cart_num", 0);
  449. self.$set(self, "attrValue", "");
  450. self.$set(self, "attrTxt", "请选择");
  451. } else if (!productSelect && !productAttr.length) {
  452. self.$set(
  453. self.attribute.productSelect,
  454. "store_name",
  455. self.storeInfo.title
  456. );
  457. self.$set(self.attribute.productSelect, "image", self.storeInfo.image);
  458. self.$set(self.attribute.productSelect, "price", self.storeInfo.price);
  459. self.$set(self.attribute.productSelect, "stock", self.storeInfo.stock);
  460. self.$set(self.attribute.productSelect, "quota", self.storeInfo.quota);
  461. self.$set(self.attribute.productSelect, "product_stock", self.storeInfo.product_stock);
  462. self.$set(
  463. self.attribute.productSelect,
  464. "unique",
  465. self.storeInfo.unique || ""
  466. );
  467. self.$set(self.attribute.productSelect, "cart_num", 1);
  468. self.$set(self.attribute.productSelect, "quota", productSelect.quota);
  469. self.$set(self.attribute.productSelect, "product_stock", productSelect.product_stock);
  470. self.$set(self, "attrValue", "");
  471. self.$set(self, "attrTxt", "请选择");
  472. }
  473. },
  474. selecAttr: function() {
  475. this.attribute.cartAttr = true
  476. },
  477. onMyEvent: function() {
  478. this.$set(this.attribute, 'cartAttr', false);
  479. this.$set(this, 'isOpen', false);
  480. },
  481. /**
  482. * 购物车数量加和数量减
  483. *
  484. */
  485. ChangeCartNum: function(changeValue) {
  486. //changeValue:是否 加|减
  487. //获取当前变动属性
  488. let productSelect = this.productValue[this.attrValue];
  489. if (this.cart_num) {
  490. productSelect.cart_num = this.cart_num;
  491. this.attribute.productSelect.cart_num = this.cart_num;
  492. }
  493. //如果没有属性,赋值给商品默认库存
  494. if (productSelect === undefined && !this.attribute.productAttr.length)
  495. productSelect = this.attribute.productSelect;
  496. //无属性值即库存为0;不存在加减;
  497. if (productSelect === undefined) return;
  498. let stock = productSelect.stock || 0;
  499. let quotaShow = productSelect.quota_show || 0;
  500. let quota = productSelect.quota || 0;
  501. let productStock = productSelect.product_stock || 0;
  502. let num = this.attribute.productSelect;
  503. let nums = this.storeInfo.num || 0;
  504. //设置默认数据
  505. if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
  506. if (changeValue) {
  507. if (num.cart_num < this.attribute.productSelect.quota) {
  508. num.cart_num++;
  509. this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
  510. this.$set(this, "cart_num", num.cart_num);
  511. this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
  512. }
  513. } else {
  514. if (num.cart_num == 1) return
  515. num.cart_num--;
  516. this.$set(this, "cart_num", num.cart_num);
  517. this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
  518. }
  519. },
  520. attrVal(val) {
  521. this.attribute.productAttr[val.indexw].index = this.attribute.productAttr[val.indexw].attr_values[val
  522. .indexn];
  523. },
  524. /**
  525. * 属性变动赋值
  526. *
  527. */
  528. ChangeAttr: function(res) {
  529. this.$set(this, 'cart_num', 1);
  530. let productSelect = this.productValue[res];
  531. if (productSelect) {
  532. this.$set(this.attribute.productSelect, "image", productSelect.image);
  533. this.$set(this.attribute.productSelect, "price", productSelect.price);
  534. this.$set(this.attribute.productSelect, "stock", productSelect.stock);
  535. this.$set(this.attribute.productSelect, "unique", productSelect.unique);
  536. this.$set(this.attribute.productSelect, "cart_num", 1);
  537. this.$set(this.attribute.productSelect, "quota", productSelect.quota);
  538. this.$set(this.attribute.productSelect, "quota_show", productSelect.quota_show);
  539. this.$set(this, "attrValue", res);
  540. this.attrTxt = "已选择"
  541. } else {
  542. this.$set(this.attribute.productSelect, "image", this.storeInfo.image);
  543. this.$set(this.attribute.productSelect, "price", this.storeInfo.price);
  544. this.$set(this.attribute.productSelect, "stock", 0);
  545. this.$set(this.attribute.productSelect, "unique", "");
  546. this.$set(this.attribute.productSelect, "cart_num", 0);
  547. this.$set(this.attribute.productSelect, "quota", 0);
  548. this.$set(this.attribute.productSelect, "quota_show", 0);
  549. this.$set(this, "attrValue", "");
  550. this.attrTxt = "已选择"
  551. }
  552. },
  553. scroll: function(e) {
  554. var that = this,
  555. scrollY = e.detail.scrollTop;
  556. var opacity = scrollY / 200;
  557. opacity = opacity > 1 ? 1 : opacity;
  558. that.opacity = opacity
  559. that.scrollY = scrollY
  560. if (that.lock) {
  561. that.lock = false
  562. return;
  563. }
  564. for (var i = 0; i < that.topArr.length; i++) {
  565. if (scrollY < that.topArr[i] - (app.globalData.navHeight / 2) + that.heightArr[i]) {
  566. that.navActive = i
  567. break
  568. }
  569. }
  570. },
  571. tap: function(item, index) {
  572. var id = item.id;
  573. var index = index;
  574. var that = this;
  575. // if (!this.data.good_list.length && id == "past2") {
  576. // id = "past3"
  577. // }
  578. this.toView = id;
  579. this.navActive = index;
  580. this.lock = true;
  581. this.scrollTop = index > 0 ? that.topArr[index] - (app.globalData.navHeight / 2) : that.topArr[index]
  582. },
  583. /*
  584. * 下订单
  585. */
  586. goCat: function() {
  587. var that = this;
  588. var productSelect = this.productValue[this.attrValue];
  589. //打开属性
  590. if (this.isOpen)
  591. this.attribute.cartAttr = true
  592. else
  593. this.attribute.cartAttr = !this.attribute.cartAttr
  594. //只有关闭属性弹窗时进行加入购物车
  595. if (this.attribute.cartAttr === true && this.isOpen == false) return this.isOpen = true
  596. //如果有属性,没有选择,提示用户选择
  597. if (this.attribute.productAttr.length && productSelect === undefined && this.isOpen == true) return app
  598. .$util.Tips({
  599. title: '请选择属性'
  600. });
  601. if (this.cart_num <= 0) {
  602. return app.$util.Tips({
  603. title: '请选择数量'
  604. });
  605. }
  606. this.isOpen = false
  607. uni.navigateTo({
  608. url: `/pages/points_mall/integral_order?unique=${productSelect.unique}&num=${this.cart_num || 1}`
  609. });
  610. },
  611. }
  612. }
  613. </script>
  614. <style lang="scss">
  615. .product-con .attribute{
  616. padding: 22rpx;
  617. }
  618. .generate-posters {
  619. width: 100%;
  620. height: 170rpx;
  621. background-color: #fff;
  622. position: fixed;
  623. left: 0;
  624. bottom: 0;
  625. z-index: 300;
  626. transform: translate3d(0, 100%, 0);
  627. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  628. border-top: 1rpx solid #eee;
  629. }
  630. .generate-posters.on {
  631. transform: translate3d(0, 0, 0);
  632. }
  633. .generate-posters .item {
  634. flex: 1;
  635. text-align: center;
  636. font-size: 30rpx;
  637. }
  638. .generate-posters .item .iconfont {
  639. font-size: 80rpx;
  640. color: #5eae72;
  641. }
  642. .generate-posters .item .iconfont.icon-haibao {
  643. color: #5391f1;
  644. }
  645. .navbar .header {
  646. height: 96rpx;
  647. font-size: 30rpx;
  648. color: #050505;
  649. background-color: #fff;
  650. /* #ifdef MP */
  651. padding-right: 95rpx;
  652. /* #endif */
  653. }
  654. .icon-xiangzuo {
  655. /* #ifdef H5 */
  656. top: 30rpx !important;
  657. /* #endif */
  658. }
  659. .navbar .header .item {
  660. position: relative;
  661. margin: 0 25rpx;
  662. }
  663. .navbar .header .item.on:before {
  664. position: absolute;
  665. width: 60rpx;
  666. height: 5rpx;
  667. background-repeat: no-repeat;
  668. content: "";
  669. background-image: linear-gradient(to right, #ff3366 0%, #ff6533 100%);
  670. bottom: -10rpx;
  671. left: 50%;
  672. margin-left: -28rpx;
  673. }
  674. .navbar {
  675. position: fixed;
  676. background-color: #fff;
  677. top: 0;
  678. left: 0;
  679. z-index: 99;
  680. width: 100%;
  681. }
  682. .navbar .navbarH {
  683. position: relative;
  684. }
  685. .navbar .navbarH .navbarCon {
  686. position: absolute;
  687. bottom: 0;
  688. height: 100rpx;
  689. width: 100%;
  690. }
  691. .icon-xiangzuo {
  692. /* color: #000;
  693. position: fixed;
  694. font-size: 40rpx;
  695. width: 100rpx;
  696. height: 56rpx;
  697. line-height: 54rpx;
  698. z-index: 1000;
  699. left: 33rpx; */
  700. }
  701. .product-con .nav {
  702. height: 100rpx;
  703. padding: 0 22rpx;
  704. box-sizing: border-box;
  705. background-color: #fff;
  706. margin: 22rpx 22rpx 0 22rpx;
  707. border-radius: 12rpx;
  708. }
  709. .product-con .nav .money {
  710. font-size: 28rpx;
  711. color: #E93323;
  712. font-weight: bold;
  713. image {
  714. width: 34rpx;
  715. height: 34rpx;
  716. }
  717. }
  718. .product-con .nav .money .num {
  719. font-size: 48rpx;
  720. padding-left: 16rpx;
  721. }
  722. .product-con .nav .money .y-money {
  723. font-size: 26rpx;
  724. margin-left: 10rpx;
  725. text-decoration: line-through;
  726. }
  727. .product-con .nav .timeItem {
  728. font-size: 20rpx;
  729. color: #fff;
  730. text-align: center;
  731. }
  732. .product-con .nav .timeItem .timeCon {
  733. margin-top: 10rpx;
  734. }
  735. .product-con .nav .timeItem .timeCon .num {
  736. padding: 0 7rpx;
  737. font-size: 22rpx;
  738. color: #ff3d3d;
  739. background-color: #fff;
  740. border-radius: 2rpx;
  741. }
  742. .product-con .nav .timeState {
  743. font-size: 28RPX;
  744. color: #FFF;
  745. }
  746. .product-con .nav .iconfont {
  747. color: #fff;
  748. font-size: 30rpx;
  749. margin-left: 20rpx;
  750. }
  751. .product-con .wrapper {
  752. padding: 22rpx;
  753. box-sizing: border-box;
  754. background-color: #fff;
  755. margin: 22rpx 22rpx 0 22rpx;
  756. border-radius: 12rpx;
  757. }
  758. .product-con .wrapper .introduce {
  759. margin: 0;
  760. }
  761. .product-con .wrapper .introduce .infor {
  762. // width: 570rpx;
  763. }
  764. .product-con .wrapper .introduce .iconfont {
  765. font-size: 37rpx;
  766. color: #515151;
  767. }
  768. .product-con .wrapper .label {
  769. display: flex;
  770. justify-content: space-between;
  771. margin: 18rpx 0 0 0;
  772. font-size: 24rpx;
  773. color: #82848f;
  774. }
  775. .product-con .wrapper .label .stock {}
  776. .product-con .footer {
  777. padding: 0 20rpx 0 30rpx;
  778. position: fixed;
  779. bottom: 0;
  780. width: 100%;
  781. box-sizing: border-box;
  782. background-color: #fff;
  783. z-index: 277;
  784. border-top: 1px solid #f0f0f0;
  785. display: flex;
  786. align-items: center;
  787. flex-wrap: nowrap;
  788. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  789. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  790. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  791. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  792. }
  793. .product-con .footer .item {
  794. width: 100rpx;
  795. font-size: 18rpx;
  796. color: #666;
  797. }
  798. .product-con .footer .item .iconfont {
  799. text-align: center;
  800. font-size: 40rpx;
  801. }
  802. .product-con .footer .item .iconfont.icon-shoucang1 {
  803. color: #f00;
  804. }
  805. .product-con .footer .item .iconfont.icon-gouwuche1 {
  806. font-size: 40rpx;
  807. position: relative;
  808. }
  809. .product-con .footer .item .iconfont.icon-gouwuche1 .num {
  810. color: #fff;
  811. position: absolute;
  812. font-size: 18rpx;
  813. padding: 2rpx 8rpx 3rpx;
  814. border-radius: 200rpx;
  815. top: -10rpx;
  816. right: -10rpx;
  817. }
  818. .product-con .footer .bnt {
  819. width: 100%;
  820. height: 76rpx;
  821. }
  822. .product-con .footer .bnt .bnts {
  823. width: 100%;
  824. text-align: center;
  825. line-height: 76rpx;
  826. color: #fff;
  827. font-size: 28rpx;
  828. }
  829. .product-con .footer .bnt .joinCart {
  830. border-radius: 50rpx 0 0 50rpx;
  831. background-image: linear-gradient(to right, #fea10f 0%, #fa8013 100%);
  832. }
  833. .product-con .footer .bnt .buy {
  834. border-radius: 50rpx;
  835. // background-image: linear-gradient(to right, #fa6514 0%, #e93323 100%);
  836. background-color: var(--view-theme);
  837. }
  838. .product-con .footer .bnt .no-goods {
  839. border-radius: 50rpx;
  840. background-color: #CCCCCC;
  841. }
  842. .product-con .conter {
  843. display: block;
  844. padding-bottom: 100rpx;
  845. }
  846. .product-con .conter img {
  847. display: block;
  848. }
  849. .bg-color-hui {
  850. background: #bbbbbb !important;
  851. }
  852. .canvas {
  853. width: 750px;
  854. height: 1190px;
  855. }
  856. .poster-pop {
  857. width: 450rpx;
  858. height: 714rpx;
  859. position: fixed;
  860. left: 50%;
  861. transform: translateX(-50%);
  862. z-index: 300;
  863. top:50%;
  864. margin-top: -559rpx;
  865. }
  866. .poster-pop image {
  867. width: 100%;
  868. height: 100%;
  869. display: block;
  870. }
  871. .poster-pop .close {
  872. width: 46rpx;
  873. height: 75rpx;
  874. position: fixed;
  875. right: 0;
  876. top: -73rpx;
  877. display: block;
  878. }
  879. .poster-pop .save-poster {
  880. background-color: #df2d0a;
  881. font-size: :22rpx;
  882. color: #fff;
  883. text-align: center;
  884. height: 76rpx;
  885. line-height: 76rpx;
  886. width: 100%;
  887. }
  888. .poster-pop .keep {
  889. color: #fff;
  890. text-align: center;
  891. font-size: 25rpx;
  892. margin-top: 10rpx;
  893. }
  894. /deep/.mask {
  895. z-index: 99 !important;
  896. }
  897. .mask1 {
  898. position: fixed;
  899. top: 0;
  900. left: 0;
  901. right: 0;
  902. bottom: 0;
  903. background-color: #000;
  904. opacity: .5;
  905. z-index: 288;
  906. }
  907. .home-nav {
  908. /* #ifdef H5 */
  909. top: 20rpx !important;
  910. /* #endif */
  911. }
  912. .home-nav {
  913. color: #fff;
  914. position: fixed;
  915. font-size: 33rpx;
  916. width: 56rpx;
  917. height: 56rpx;
  918. z-index: 99;
  919. left: 33rpx;
  920. background: rgba(190, 190, 190, 0.5);
  921. border-radius: 50%;
  922. &.on {
  923. background: unset;
  924. color: #333;
  925. }
  926. }
  927. .home-nav .line {
  928. width: 1rpx;
  929. height: 24rpx;
  930. background: rgba(255, 255, 255, 0.25);
  931. }
  932. .home-nav .icon-xiangzuo {
  933. width: auto;
  934. font-size: 28rpx;
  935. }
  936. .share-box {
  937. z-index: 1000;
  938. position: fixed;
  939. left: 0;
  940. top: 0;
  941. width: 100%;
  942. height: 100%;
  943. }
  944. .share-box image {
  945. width: 100%;
  946. height: 100%;
  947. }
  948. .df {
  949. display: flex;
  950. align-items: center;
  951. flex-wrap: nowrap;
  952. }
  953. </style>