integral_goods_details.vue 28 KB

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