integral_goods_details.vue 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  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. <!-- #ifdef MP -->
  70. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  71. <!-- #endif -->
  72. </view>
  73. </template>
  74. <script>
  75. const app = getApp();
  76. import {
  77. mapGetters
  78. } from "vuex";
  79. import {
  80. getIntegralProductDetail
  81. } from '@/api/activity.js';
  82. import productConSwiper from '@/components/productConSwiper/index.vue'
  83. import productWindow from '@/components/productWindow';
  84. import cusPreviewImg from '@/components/cusPreviewImg';
  85. import kefuIcon from '@/components/kefuIcon';
  86. import parser from "@/components/jyf-parser/jyf-parser";
  87. import countDown from '@/components/countDown';
  88. import {
  89. imageBase64
  90. } from "@/api/public";
  91. import {
  92. toLogin
  93. } from '@/libs/login.js';
  94. import {
  95. silenceBindingSpread
  96. } from "@/utils";
  97. import {
  98. getUserInfo
  99. } from '@/api/user.js';
  100. // #ifdef APP-PLUS
  101. import {
  102. TOKENNAME,
  103. HTTP_REQUEST_URL
  104. } from '@/config/app.js';
  105. // #endif
  106. import colors from "@/mixins/color";
  107. export default {
  108. computed: mapGetters(['isLogin']),
  109. mixins: [colors],
  110. data() {
  111. return {
  112. dataShow: 0,
  113. id: 0,
  114. time: 0,
  115. countDownHour: "00",
  116. countDownMinute: "00",
  117. countDownSecond: "00",
  118. storeInfo: [],
  119. imgUrls: [],
  120. parameter: {
  121. 'navbar': '1',
  122. 'return': '1',
  123. 'title': '抢购详情页',
  124. 'color': false
  125. },
  126. attribute: {
  127. cartAttr: false,
  128. productAttr: [],
  129. productSelect: {}
  130. },
  131. productValue: [],
  132. isOpen: false,
  133. attr: '请选择',
  134. attrValue: '',
  135. status: 1,
  136. isAuto: false,
  137. isShowAuth: false,
  138. iShidden: false,
  139. limitNum: 1, //限制本属性产品的个数;
  140. iSplus: false,
  141. replyCount: 0, //总评论数量
  142. reply: [], //评论列表
  143. replyChance: 0,
  144. navH: "",
  145. navList: ['商品', '详情'],
  146. opacity: 0,
  147. scrollY: 0,
  148. topArr: [],
  149. toView: '',
  150. height: 0,
  151. heightArr: [],
  152. lock: false,
  153. scrollTop: 0,
  154. tagStyle: {
  155. img: 'width:100%;display:block;',
  156. table: 'width:100%',
  157. video: 'width:100%'
  158. },
  159. datatime: '',
  160. navActive: 0,
  161. meunHeight: 0,
  162. backH: '',
  163. posters: false,
  164. weixinStatus: false,
  165. posterImageStatus: false,
  166. storeImage: '', //海报产品图
  167. PromotionCode: '', //二维码图片
  168. posterImage: '', //海报路径
  169. actionSheetHidden: false,
  170. cart_num: 1,
  171. homeTop: 20,
  172. returnShow: true,
  173. H5ShareBox: false, //公众号分享图片
  174. routineContact: 0,
  175. selectSku:{},
  176. skuArr:[]
  177. }
  178. },
  179. components: {
  180. productConSwiper,
  181. 'productWindow': productWindow,
  182. cusPreviewImg,
  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. this.getIntegralProductDetail();
  246. this.$nextTick(() => {
  247. // #ifdef MP
  248. const menuButton = uni.getMenuButtonBoundingClientRect();
  249. const query = uni.createSelectorQuery().in(this);
  250. query
  251. .select('#home')
  252. .boundingClientRect(data => {
  253. this.homeTop = menuButton.top * 2 + menuButton.height - data.height;
  254. })
  255. .exec();
  256. // #endif
  257. })
  258. },
  259. onShow(){
  260. uni.removeStorageSync('form_type_cart');
  261. },
  262. methods: {
  263. // 授权关闭
  264. authColse: function(e) {
  265. this.isShowAuth = e;
  266. },
  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. let num = parseInt(this.attribute.productSelect.quota)>=parseInt(e)?parseInt(e):parseInt(this.attribute.productSelect.quota);
  328. if(e=='' || e==null || e==undefined){
  329. num = 1
  330. }
  331. this.$set(this.attribute.productSelect, 'cart_num', num);
  332. this.$set(this, "cart_num", num);
  333. },
  334. // 后退
  335. returns: function() {
  336. uni.navigateBack()
  337. },
  338. onLoadFun: function(data) {
  339. this.isShowAuth = false;
  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. if(this.isLogin){
  588. var that = this;
  589. var productSelect = this.productValue[this.attrValue];
  590. //打开属性
  591. if (this.isOpen)
  592. this.attribute.cartAttr = true
  593. else
  594. this.attribute.cartAttr = !this.attribute.cartAttr
  595. //只有关闭属性弹窗时进行加入购物车
  596. if (this.attribute.cartAttr === true && this.isOpen == false) return this.isOpen = true
  597. //如果有属性,没有选择,提示用户选择
  598. if (this.attribute.productAttr.length && productSelect === undefined && this.isOpen == true) return app
  599. .$util.Tips({
  600. title: '请选择属性'
  601. });
  602. if (this.cart_num <= 0) {
  603. return app.$util.Tips({
  604. title: '请选择数量'
  605. });
  606. }
  607. this.isOpen = false
  608. uni.navigateTo({
  609. url: `/pages/points_mall/integral_order?unique=${productSelect.unique}&num=${this.cart_num || 1}`
  610. });
  611. }else{
  612. // #ifndef MP
  613. toLogin()
  614. // #endif
  615. // #ifdef MP
  616. this.isShowAuth = true;
  617. // #endif
  618. }
  619. },
  620. }
  621. }
  622. </script>
  623. <style lang="scss">
  624. .product-con .attribute{
  625. padding: 22rpx;
  626. }
  627. .generate-posters {
  628. width: 100%;
  629. height: 170rpx;
  630. background-color: #fff;
  631. position: fixed;
  632. left: 0;
  633. bottom: 0;
  634. z-index: 300;
  635. transform: translate3d(0, 100%, 0);
  636. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  637. border-top: 1rpx solid #eee;
  638. }
  639. .generate-posters.on {
  640. transform: translate3d(0, 0, 0);
  641. }
  642. .generate-posters .item {
  643. flex: 1;
  644. text-align: center;
  645. font-size: 30rpx;
  646. }
  647. .generate-posters .item .iconfont {
  648. font-size: 80rpx;
  649. color: #5eae72;
  650. }
  651. .generate-posters .item .iconfont.icon-haibao {
  652. color: #5391f1;
  653. }
  654. .navbar .header {
  655. height: 96rpx;
  656. font-size: 30rpx;
  657. color: #050505;
  658. background-color: #fff;
  659. /* #ifdef MP */
  660. padding-right: 95rpx;
  661. /* #endif */
  662. }
  663. .icon-xiangzuo {
  664. /* #ifdef H5 */
  665. top: 30rpx !important;
  666. /* #endif */
  667. }
  668. .navbar .header .item {
  669. position: relative;
  670. margin: 0 25rpx;
  671. }
  672. .navbar .header .item.on:before {
  673. position: absolute;
  674. width: 60rpx;
  675. height: 5rpx;
  676. background-repeat: no-repeat;
  677. content: "";
  678. background-image: linear-gradient(to right, #ff3366 0%, #ff6533 100%);
  679. bottom: -10rpx;
  680. left: 50%;
  681. margin-left: -28rpx;
  682. }
  683. .navbar {
  684. position: fixed;
  685. background-color: #fff;
  686. top: 0;
  687. left: 0;
  688. z-index: 99;
  689. width: 100%;
  690. }
  691. .navbar .navbarH {
  692. position: relative;
  693. }
  694. .navbar .navbarH .navbarCon {
  695. position: absolute;
  696. bottom: 0;
  697. height: 100rpx;
  698. width: 100%;
  699. }
  700. .icon-xiangzuo {
  701. /* color: #000;
  702. position: fixed;
  703. font-size: 40rpx;
  704. width: 100rpx;
  705. height: 56rpx;
  706. line-height: 54rpx;
  707. z-index: 1000;
  708. left: 33rpx; */
  709. }
  710. .product-con .nav {
  711. height: 100rpx;
  712. padding: 0 22rpx;
  713. box-sizing: border-box;
  714. background-color: #fff;
  715. margin: 22rpx 22rpx 0 22rpx;
  716. border-radius: 12rpx;
  717. }
  718. .product-con .nav .money {
  719. font-size: 28rpx;
  720. color: #E93323;
  721. font-weight: bold;
  722. image {
  723. width: 34rpx;
  724. height: 34rpx;
  725. }
  726. }
  727. .product-con .nav .money .num {
  728. font-size: 48rpx;
  729. padding-left: 16rpx;
  730. }
  731. .product-con .nav .money .y-money {
  732. font-size: 26rpx;
  733. margin-left: 10rpx;
  734. text-decoration: line-through;
  735. }
  736. .product-con .nav .timeItem {
  737. font-size: 20rpx;
  738. color: #fff;
  739. text-align: center;
  740. }
  741. .product-con .nav .timeItem .timeCon {
  742. margin-top: 10rpx;
  743. }
  744. .product-con .nav .timeItem .timeCon .num {
  745. padding: 0 7rpx;
  746. font-size: 22rpx;
  747. color: #ff3d3d;
  748. background-color: #fff;
  749. border-radius: 2rpx;
  750. }
  751. .product-con .nav .timeState {
  752. font-size: 28RPX;
  753. color: #FFF;
  754. }
  755. .product-con .nav .iconfont {
  756. color: #fff;
  757. font-size: 30rpx;
  758. margin-left: 20rpx;
  759. }
  760. .product-con .wrapper {
  761. padding: 22rpx;
  762. box-sizing: border-box;
  763. background-color: #fff;
  764. margin: 22rpx 22rpx 0 22rpx;
  765. border-radius: 12rpx;
  766. }
  767. .product-con .wrapper .introduce {
  768. margin: 0;
  769. }
  770. .product-con .wrapper .introduce .infor {
  771. // width: 570rpx;
  772. }
  773. .product-con .wrapper .introduce .iconfont {
  774. font-size: 37rpx;
  775. color: #515151;
  776. }
  777. .product-con .wrapper .label {
  778. display: flex;
  779. justify-content: space-between;
  780. margin: 18rpx 0 0 0;
  781. font-size: 24rpx;
  782. color: #82848f;
  783. }
  784. .product-con .wrapper .label .stock {}
  785. .product-con .footer {
  786. padding: 0 20rpx 0 30rpx;
  787. position: fixed;
  788. bottom: 0;
  789. width: 100%;
  790. box-sizing: border-box;
  791. background-color: #fff;
  792. z-index: 277;
  793. border-top: 1px solid #f0f0f0;
  794. display: flex;
  795. align-items: center;
  796. flex-wrap: nowrap;
  797. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  798. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  799. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  800. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  801. }
  802. .product-con .footer .item {
  803. width: 100rpx;
  804. font-size: 18rpx;
  805. color: #666;
  806. }
  807. .product-con .footer .item .iconfont {
  808. text-align: center;
  809. font-size: 40rpx;
  810. }
  811. .product-con .footer .item .iconfont.icon-shoucang1 {
  812. color: #f00;
  813. }
  814. .product-con .footer .item .iconfont.icon-gouwuche1 {
  815. font-size: 40rpx;
  816. position: relative;
  817. }
  818. .product-con .footer .item .iconfont.icon-gouwuche1 .num {
  819. color: #fff;
  820. position: absolute;
  821. font-size: 18rpx;
  822. padding: 2rpx 8rpx 3rpx;
  823. border-radius: 200rpx;
  824. top: -10rpx;
  825. right: -10rpx;
  826. }
  827. .product-con .footer .bnt {
  828. width: 100%;
  829. height: 76rpx;
  830. }
  831. .product-con .footer .bnt .bnts {
  832. width: 100%;
  833. text-align: center;
  834. line-height: 76rpx;
  835. color: #fff;
  836. font-size: 28rpx;
  837. }
  838. .product-con .footer .bnt .joinCart {
  839. border-radius: 50rpx 0 0 50rpx;
  840. background-image: linear-gradient(to right, #fea10f 0%, #fa8013 100%);
  841. }
  842. .product-con .footer .bnt .buy {
  843. border-radius: 50rpx;
  844. // background-image: linear-gradient(to right, #fa6514 0%, #e93323 100%);
  845. background-color: var(--view-theme);
  846. }
  847. .product-con .footer .bnt .no-goods {
  848. border-radius: 50rpx;
  849. background-color: #CCCCCC;
  850. }
  851. .product-con .conter {
  852. display: block;
  853. padding-bottom: 100rpx;
  854. }
  855. .product-con .conter img {
  856. display: block;
  857. }
  858. .bg-color-hui {
  859. background: #bbbbbb !important;
  860. }
  861. .canvas {
  862. width: 750px;
  863. height: 1190px;
  864. }
  865. .poster-pop {
  866. width: 450rpx;
  867. height: 714rpx;
  868. position: fixed;
  869. left: 50%;
  870. transform: translateX(-50%);
  871. z-index: 300;
  872. top:50%;
  873. margin-top: -559rpx;
  874. }
  875. .poster-pop image {
  876. width: 100%;
  877. height: 100%;
  878. display: block;
  879. }
  880. .poster-pop .close {
  881. width: 46rpx;
  882. height: 75rpx;
  883. position: fixed;
  884. right: 0;
  885. top: -73rpx;
  886. display: block;
  887. }
  888. .poster-pop .save-poster {
  889. background-color: #df2d0a;
  890. font-size: :22rpx;
  891. color: #fff;
  892. text-align: center;
  893. height: 76rpx;
  894. line-height: 76rpx;
  895. width: 100%;
  896. }
  897. .poster-pop .keep {
  898. color: #fff;
  899. text-align: center;
  900. font-size: 25rpx;
  901. margin-top: 10rpx;
  902. }
  903. /deep/.mask {
  904. z-index: 99 !important;
  905. }
  906. .mask1 {
  907. position: fixed;
  908. top: 0;
  909. left: 0;
  910. right: 0;
  911. bottom: 0;
  912. background-color: #000;
  913. opacity: .5;
  914. z-index: 288;
  915. }
  916. .home-nav {
  917. /* #ifdef H5 */
  918. top: 20rpx !important;
  919. /* #endif */
  920. }
  921. .home-nav {
  922. color: #fff;
  923. position: fixed;
  924. font-size: 33rpx;
  925. width: 56rpx;
  926. height: 56rpx;
  927. z-index: 99;
  928. left: 33rpx;
  929. background: rgba(190, 190, 190, 0.5);
  930. border-radius: 50%;
  931. &.on {
  932. background: unset;
  933. color: #333;
  934. }
  935. }
  936. .home-nav .line {
  937. width: 1rpx;
  938. height: 24rpx;
  939. background: rgba(255, 255, 255, 0.25);
  940. }
  941. .home-nav .icon-xiangzuo {
  942. width: auto;
  943. font-size: 28rpx;
  944. }
  945. .share-box {
  946. z-index: 1000;
  947. position: fixed;
  948. left: 0;
  949. top: 0;
  950. width: 100%;
  951. height: 100%;
  952. }
  953. .share-box image {
  954. width: 100%;
  955. height: 100%;
  956. }
  957. .df {
  958. display: flex;
  959. align-items: center;
  960. flex-wrap: nowrap;
  961. }
  962. </style>