integral_goods_details.vue 31 KB

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