index.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657
  1. <template>
  2. <view :style="colorStyle">
  3. <!-- 头部 -->
  4. <!-- #ifndef APP-PLUS -->
  5. <view class='navbar' :style="{height:navH+'rpx',opacity:opacity}">
  6. <view class='navbarH' :style='"height:"+navH+"rpx;"'>
  7. <view class='navbarCon acea-row row-center-wrapper'>
  8. <view class="header acea-row row-center-wrapper">
  9. <view class="item" :class="navActive === index ? 'on' : ''" v-for="(item,index) in navList"
  10. :key='index' @tap="tap(item,index)">
  11. {{ item }}
  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 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. <view class='product-con'>
  37. <scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
  38. :style="'height:'+height+'px;'" @scroll="scroll">
  39. <view id="past0">
  40. <!-- #ifdef APP-PLUS || MP -->
  41. <view class="" :style="'width:100%;' + 'height:'+sysHeight"></view>
  42. <!-- #endif -->
  43. <productConSwiper :imgUrls='imgUrls' @showSwiperImg="showSwiperImg"></productConSwiper>
  44. <view class="bg-color">
  45. <view class='nav acea-row row-between-wrapper'>
  46. <view class='money'>{{$t(`¥`)}}<text class='num'>{{storeInfo.price || ''}}</text>
  47. <text
  48. v-if="attribute.productAttr.length && (attribute.productAttr.length?attribute.productAttr[0].attr_values.length:0) > 1">{{$t(`起`)}}</text>
  49. <text class='y-money'>{{$t(`¥`)}}{{storeInfo.ot_price || ''}}</text>
  50. </view>
  51. <view class='acea-row row-middle'>
  52. <view class='timeItem' v-if="status == 1">
  53. <view>{{$t(`距秒杀结束仅剩`)}}</view>
  54. <countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '"
  55. :minute-text="' : '" :second-text="' '" :datatime="datatime"
  56. style="margin-top: 4rpx;"></countDown>
  57. </view>
  58. <!-- <view class="timeState" wx:if="{{status == 0}}">已结束</view>
  59. <view class="timeState" wx:if="{{status == 2}}">即将开始</view> -->
  60. <!-- <view class='iconfont icon-jiantou'></view> -->
  61. </view>
  62. </view>
  63. </view>
  64. <view class='wrapper'>
  65. <view class='introduce acea-row row-between'>
  66. <view class='infor'> {{storeInfo.title || ''}}</view>
  67. <!-- <button class='iconfont icon-fenxiang' open-type='share'></button> -->
  68. <view class='iconfont icon-fenxiang' @click="listenerActionSheet"></view>
  69. </view>
  70. <view class='label acea-row row-middle'>
  71. <!-- <view class='stock'>库存:{{storeInfo.stock}}{{storeInfo.unit_name}}</view> -->
  72. <view class='stock'>
  73. {{$t(`累计销售`)}}:{{storeInfo.total?storeInfo.total:0}}{{$t(storeInfo.unit_name) || ''}}
  74. </view>
  75. <view>{{$t(`限量`)}}:
  76. {{ storeInfo.quota ? storeInfo.quota : 0 }}{{$t(storeInfo.unit_name) || ''}}
  77. </view>
  78. </view>
  79. </view>
  80. <view class='attribute acea-row row-between-wrapper' @tap='selecAttr'
  81. v-if='attribute.productAttr.length'>
  82. <!-- <view>{{attr}}:<text class='atterTxt'>{{attrValue}}</text></view>
  83. <view class='iconfont icon-jiantou'></view> -->
  84. <view class="flex">
  85. <view style="display: flex; align-items: center; width: 90%">
  86. <view class="attr-txt"> {{ attr }}: </view>
  87. <view class="atterTxt line1" style="width: 82%">{{
  88. attrValue
  89. }}</view>
  90. </view>
  91. <view class="iconfont icon-jiantou"></view>
  92. </view>
  93. <view class="acea-row row-between-wrapper" style="margin-top: 7px; padding-left: 70px"
  94. v-if="skuArr.length > 1">
  95. <view class="flexs">
  96. <image :src="item.image" v-for="(item, index) in skuArr.slice(0, 4)" :key="index"
  97. class="attrImg"></image>
  98. </view>
  99. <view class="switchTxt">{{$t(`共`)}}{{ skuArr.length }}{{$t(`种规格可选`)}}</view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class='userEvaluation' id="past1" v-if="replyCount">
  104. <view class='title acea-row row-between-wrapper'>
  105. <view>{{$t(`用户评价`)}}({{replyCount}})</view>
  106. <navigator class='praise' hover-class='none'
  107. :url="'/pages/goods/goods_comment_list/index?product_id='+storeInfo.product_id">
  108. <text class='font-color'>{{replyChance}}%</text>{{$t(`好评率`)}}
  109. <text class='iconfont icon-jiantou'></text>
  110. </navigator>
  111. </view>
  112. <userEvaluation :reply="reply"></userEvaluation>
  113. </view>
  114. <view class='product-intro' id="past2">
  115. <view class='title'>{{$t(`产品介绍`)}}</view>
  116. <view class='conter'>
  117. <!-- <view class="" v-html="storeInfo.description">
  118. </view> -->
  119. <!-- #ifndef APP-PLUS -->
  120. <parser :html="storeInfo.description" ref="article" :tag-style="tagStyle"></parser>
  121. <!-- #endif -->
  122. <!-- #ifdef APP-PLUS -->
  123. <view class="description" v-html="storeInfo.description"></view>
  124. <!-- #endif -->
  125. </view>
  126. </view>
  127. </scroll-view>
  128. <view class='footer acea-row row-between-wrapper' :class="{'eject':storeInfo.id}">
  129. <navigator hover-class="none" open-type="switchTab" class="item" url="/pages/index/index">
  130. <view class="iconfont icon-shouye6"></view>
  131. <view class="p_center">{{$t(`首页`)}}</view>
  132. </navigator>
  133. <view @tap='setCollect' class='item'>
  134. <view class='iconfont icon-shoucang1' v-if="storeInfo.userCollect"></view>
  135. <view class='iconfont icon-shoucang' v-else></view>
  136. <view class="p_center">{{$t(`收藏`)}}</view>
  137. </view>
  138. <view class="bnt acea-row"
  139. v-if="status == 1 && attribute.productSelect.quota > 0 && attribute.productSelect.product_stock>0">
  140. <view class="joinCart bnts" @tap="openAlone">{{$t(`单独购买`)}}</view>
  141. <view class="buy bnts" @tap="goCat">{{$t(`立即购买`)}}</view>
  142. </view>
  143. <view class="bnt acea-row"
  144. v-if="(status == 1 && attribute.productSelect.quota <= 0) || (status == 3 && attribute.productSelect.quota <= 0) || (status == 1 && attribute.productSelect.product_stock <= 0) || (status == 3 && attribute.productSelect.product_stock <= 0)">
  145. <view class="joinCart bnts" @tap="openAlone">{{$t(`单独购买`)}}</view>
  146. <view class="buy bnts bg-color-hui">{{$t(`已售罄`)}}</view>
  147. </view>
  148. <view class="bnt acea-row" v-if="!dataShow && status == 1">
  149. <view class="joinCart bnts" @tap="openAlone">{{$t(`单独购买`)}}</view>
  150. <view class="buy bnts bg-color-hui">{{$t(`立即购买`)}}</view>
  151. </view>
  152. <view class="bnt acea-row" v-if="status == 2">
  153. <view class="joinCart bnts" @tap="openAlone">{{$t(`单独购买`)}}</view>
  154. <view class="buy bnts bg-color-hui">{{$t(`未开始`)}}</view>
  155. </view>
  156. <view class="bnt acea-row" v-if="status == 0">
  157. <view class="joinCart bnts" @tap="openAlone">{{$t(`单独购买`)}}</view>
  158. <view class="buy bnts bg-color-hui">{{$t(`已结束`)}}</view>
  159. </view>
  160. </view>
  161. </view>
  162. <cus-previewImg ref="cusPreviewImg" :list="skuArr" @changeSwitch="changeSwitch"
  163. @shareFriend="listenerActionSheet" />
  164. <product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" :type="'seckill'"
  165. @ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" @getImg="showImg">
  166. </product-window>
  167. <!-- #ifdef MP -->
  168. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth"></authorize> -->
  169. <!-- #endif -->
  170. <!-- 分享按钮 -->
  171. <view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
  172. <!-- #ifndef MP -->
  173. <button class="item" hover-class='none' v-if="weixinStatus === true" @click="H5ShareBox = true">
  174. <!-- <button class="item" hover-class='none' v-if="weixinStatus === true" @click="setShareInfoStatus"> -->
  175. <view class="iconfont icon-weixin3"></view>
  176. <view class="">{{$t(`发送给朋友`)}}</view>
  177. </button>
  178. <!-- #endif -->
  179. <!-- #ifdef MP -->
  180. <button class="item" open-type="share" hover-class='none' @click="goFriend">
  181. <view class="iconfont icon-weixin3"></view>
  182. <view class="">{{$t(`发送给朋友`)}}</view>
  183. </button>
  184. <!-- #endif -->
  185. <!-- #ifdef APP-PLUS -->
  186. <view class="item" @click="appShare('WXSceneSession')">
  187. <view class="iconfont icon-weixin3"></view>
  188. <view class="">{{$t(`微信好友`)}}</view>
  189. </view>
  190. <view class="item" @click="appShare('WXSenceTimeline')">
  191. <view class="iconfont icon-pengyouquan"></view>
  192. <view class="">{{$t(`微信朋友圈`)}}</view>
  193. </view>
  194. <!-- #endif -->
  195. <button class="item" hover-class='none' @tap="goPoster('seckill')">
  196. <view class="iconfont icon-haibao"></view>
  197. <view class="">{{$t(`生成海报`)}}</view>
  198. </button>
  199. </view>
  200. <view class="mask" v-if="posters" @click="listenerActionClose"></view>
  201. <!-- 海报展示 -->
  202. <view class='poster-pop' v-if="posterImageStatus">
  203. <image src='/static/images/poster-close.png' class='close' @click="posterImageClose"></image>
  204. <image :src='posterImage'></image>
  205. <!-- #ifndef H5 -->
  206. <view class='save-poster' @click="savePosterPath">{{$t(`保存到手机`)}}</view>
  207. <!-- #endif -->
  208. <!-- #ifdef H5 -->
  209. <view class="keep">{{$t(`长按图片可以保存到手机`)}}</view>
  210. <!-- #endif -->
  211. </view>
  212. <view class='mask1' v-if="posterImageStatus"></view>
  213. <canvas class="canvas" canvas-id='myCanvas' v-if="canvasStatus"></canvas>
  214. <kefuIcon :ids='storeInfo.product_id' :routineContact='routineContact'></kefuIcon>
  215. <!-- 发送给朋友图片 -->
  216. <view class="share-box" v-if="H5ShareBox">
  217. <image :src="imgHost + '/statics/images/share-info.png'" @click="H5ShareBox = false"></image>
  218. </view>
  219. <swiperPrevie ref="cusSwiperImg" :list="storeInfo.images"></swiperPrevie>
  220. <!-- #ifdef H5 || APP-PLUS -->
  221. <zb-code ref="qrcode" :show="codeShow" :cid="cid" :val="codeVal" :size="size" :unit="unit"
  222. :background="background" :foreground="foreground" :pdground="pdground" :icon="codeIcon" :iconSize="iconsize"
  223. :onval="onval" :loadMake="loadMake" @result="qrR" />
  224. <!-- #endif -->
  225. </view>
  226. </template>
  227. <script>
  228. const app = getApp();
  229. import {
  230. mapGetters
  231. } from "vuex";
  232. import {
  233. getSeckillDetail,
  234. seckillCode
  235. } from '@/api/activity.js';
  236. import {
  237. postCartAdd,
  238. collectAdd,
  239. collectDel
  240. } from '@/api/store.js';
  241. import productConSwiper from '@/components/productConSwiper/index.vue'
  242. import swiperPrevie from "@/components/cusPreviewImg/swiperPrevie.vue";
  243. import productWindow from '@/components/productWindow/index.vue'
  244. import userEvaluation from '@/components/userEvaluation/index.vue'
  245. import kefuIcon from '@/components/kefuIcon';
  246. // #ifdef MP
  247. import authorize from '@/components/Authorize';
  248. // #endif
  249. import countDown from '@/components/countDown';
  250. import {
  251. imageBase64
  252. } from "@/api/public";
  253. import {
  254. toLogin
  255. } from '@/libs/login.js';
  256. import {
  257. getUserInfo
  258. } from '@/api/user.js';
  259. // #ifdef APP-PLUS
  260. import {
  261. TOKENNAME
  262. } from '@/config/app.js';
  263. // #endif
  264. import colors from '@/mixins/color.js';
  265. import menuIcon from '@/components/menuIcon.vue'
  266. import parser from "@/components/jyf-parser/jyf-parser";
  267. import cusPreviewImg from "@/components/cusPreviewImg/index.vue";
  268. import {
  269. sharePoster
  270. } from "@/mixins/sharePoster";
  271. import {
  272. HTTP_REQUEST_URL
  273. } from '@/config/app';
  274. import homeList from '@/components/homeList'
  275. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  276. export default {
  277. computed: mapGetters(['isLogin']),
  278. mixins: [colors, sharePoster],
  279. components: {
  280. productConSwiper,
  281. 'productWindow': productWindow,
  282. userEvaluation,
  283. kefuIcon,
  284. menuIcon,
  285. countDown,
  286. cusPreviewImg,
  287. swiperPrevie,
  288. parser,
  289. homeList,
  290. // #ifdef MP
  291. authorize
  292. // #endif
  293. },
  294. data() {
  295. return {
  296. imgHost: HTTP_REQUEST_URL,
  297. showMenuIcon: false,
  298. dataShow: 0,
  299. id: 0,
  300. time: 0,
  301. countDownHour: "00",
  302. countDownMinute: "00",
  303. countDownSecond: "00",
  304. storeInfo: [],
  305. imgUrls: [],
  306. parameter: {
  307. 'navbar': '1',
  308. 'return': '1',
  309. 'title': this.$t(`抢购详情页`),
  310. 'color': false
  311. },
  312. attribute: {
  313. cartAttr: false,
  314. productAttr: [],
  315. productSelect: {}
  316. },
  317. productValue: [],
  318. isOpen: false,
  319. attr: this.$t(`请选择`),
  320. attrValue: '',
  321. status: 1,
  322. isAuto: false,
  323. isShowAuth: false,
  324. iShidden: false,
  325. limitNum: 1, //限制本属性产品的个数;
  326. iSplus: false,
  327. replyCount: 0, //总评论数量
  328. reply: [], //评论列表
  329. replyChance: 0,
  330. navH: "",
  331. navList: [this.$t(`商品`), this.$t(`评价`), this.$t(`详情`)],
  332. opacity: 0,
  333. scrollY: 0,
  334. topArr: [],
  335. toView: '',
  336. height: 0,
  337. heightArr: [],
  338. lock: false,
  339. scrollTop: 0,
  340. tagStyle: {
  341. img: 'width:100%;display:block;',
  342. table: 'width:100%',
  343. video: 'width:100%'
  344. },
  345. datatime: 0,
  346. navActive: 0,
  347. meunHeight: 0,
  348. backH: '',
  349. posters: false,
  350. weixinStatus: false,
  351. posterImageStatus: false,
  352. canvasStatus: false, //海报绘图标签
  353. storeImage: '', //海报产品图
  354. PromotionCode: '', //二维码图片
  355. posterImage: '', //海报路径
  356. posterbackgd: '/static/images/posterbackgd.png',
  357. actionSheetHidden: false,
  358. cart_num: '',
  359. homeTop: 20,
  360. returnShow: true,
  361. H5ShareBox: false, //公众号分享图片
  362. routineContact: 0,
  363. skuArr: [],
  364. selectSku: {},
  365. currentPage: false,
  366. sysHeight: sysHeight,
  367. }
  368. },
  369. computed: mapGetters(['isLogin']),
  370. watch: {
  371. isLogin: {
  372. handler: function(newV, oldV) {
  373. if (newV) {
  374. this.getSeckillDetail();
  375. }
  376. },
  377. deep: true
  378. }
  379. },
  380. onLoad(options) {
  381. let that = this
  382. let statusBarHeight = ''
  383. var pages = getCurrentPages();
  384. if (options.id) {
  385. this.id = options.id
  386. //记录推广人uid
  387. if (options.pid) app.globalData.spid = options.pid;
  388. // if (options.time) this.datatime = Number(options.time);
  389. }
  390. that.returnShow = pages.length === 1 ? false : true;
  391. //设置商品列表高度
  392. uni.getSystemInfo({
  393. success: function(res) {
  394. that.height = res.windowHeight
  395. statusBarHeight = res.statusBarHeight
  396. //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
  397. },
  398. });
  399. // #ifdef MP
  400. this.navH = app.globalData.navHeight;
  401. // #endif
  402. // #ifdef H5
  403. that.navH = 96;
  404. // #endif
  405. // #ifdef APP-PLUS
  406. that.navH = 30;
  407. // #endif
  408. // #ifdef MP
  409. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  410. this.meunHeight = menuButtonInfo.height
  411. this.backH = (that.navH / 2) + (this.meunHeight / 2)
  412. //扫码携带参数处理
  413. if (options.scene) {
  414. let value = this.$util.getUrlParams(decodeURIComponent(options.scene));
  415. if (value.id) {
  416. this.id = value.id;
  417. } else {
  418. return this.$util.Tips({
  419. title: this.$t(`缺少参数无法查看商品`)
  420. }, {
  421. tab: 3,
  422. url: 1
  423. });
  424. }
  425. //记录推广人uid
  426. if (value.pid) app.globalData.spid = value.pid;
  427. // if (value.time) this.datatime = value.time
  428. }
  429. // #endif
  430. if (this.isLogin) {
  431. this.getSeckillDetail();
  432. } else {
  433. toLogin();
  434. }
  435. this.$nextTick(() => {
  436. // #ifdef MP
  437. const menuButton = uni.getMenuButtonBoundingClientRect();
  438. const query = uni.createSelectorQuery().in(this);
  439. query
  440. .select('#home')
  441. .boundingClientRect(data => {
  442. this.homeTop = menuButton.top * 2 + menuButton.height - data.height;
  443. })
  444. .exec();
  445. // #endif
  446. })
  447. },
  448. onNavigationBarButtonTap(e) {
  449. this.currentPage = !this.currentPage
  450. },
  451. methods: {
  452. moreNav() {
  453. this.currentPage = !this.currentPage
  454. },
  455. // app分享
  456. // #ifdef APP-PLUS
  457. appShare(scene) {
  458. let that = this
  459. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  460. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  461. uni.share({
  462. provider: "weixin",
  463. scene: scene,
  464. type: 0,
  465. href: `${HTTP_REQUEST_URL}${curRoute}`,
  466. title: that.storeInfo.title,
  467. summary: that.storeInfo.info,
  468. imageUrl: that.storeInfo.small_image,
  469. success: function(res) {
  470. uni.showToast({
  471. title: this.$t(`分享成功`),
  472. icon: 'success'
  473. })
  474. that.posters = false;
  475. },
  476. fail: function(err) {
  477. uni.showToast({
  478. title: this.$t(`分享失败`),
  479. icon: 'none',
  480. duration: 2000
  481. })
  482. that.posters = false;
  483. }
  484. });
  485. },
  486. // #endif
  487. /**
  488. * 购物车手动填写
  489. *
  490. */
  491. iptCartNum: function(e) {
  492. this.$set(this.attribute.productSelect, 'cart_num', e);
  493. this.$set(this, "cart_num", e);
  494. },
  495. // 后退
  496. returns() {
  497. // #ifdef H5
  498. return history.back();
  499. // #endif
  500. // #ifndef H5
  501. return uni.navigateBack({
  502. delta: 1,
  503. })
  504. // #endif
  505. },
  506. onLoadFun: function(data) {
  507. if (this.isAuto) {
  508. this.isAuto = false;
  509. this.isShowAuth = false;
  510. this.getSeckillDetail();
  511. }
  512. },
  513. getSeckillDetail: function() {
  514. let that = this;
  515. getSeckillDetail(that.id, {}).then(res => {
  516. this.dataShow = 1;
  517. this.status = res.data.storeInfo.status
  518. let title = res.data.storeInfo.title;
  519. this.storeInfo = res.data.storeInfo;
  520. this.datatime = Number(res.data.storeInfo.last_time);
  521. this.imgUrls = res.data.storeInfo.images;
  522. this.storeInfo.description = this.storeInfo.description.replace(/<img/gi,
  523. '<img style="max-width:100%;height:auto;float:left;display:block" ');
  524. this.storeInfo.description = this.storeInfo.description.replace(
  525. /<video/gi,
  526. '<video style="width:100%;height:300px;display:block" '
  527. );
  528. // this.attribute.productAttr = res.data.productAttr;
  529. that.$set(that.attribute, "productAttr", res.data.productAttr);
  530. this.productValue = res.data.productValue;
  531. this.attribute.productSelect.num = res.data.storeInfo.num;
  532. this.attribute.productSelect.once_num = res.data.storeInfo.once_num;
  533. this.replyCount = res.data.replyCount;
  534. this.reply = res.data.reply ? [res.data.reply] : [];
  535. this.replyChance = res.data.replyChance;
  536. that.routineContact = Number(res.data.routine_contact_type);
  537. uni.setNavigationBarTitle({
  538. title: title.substring(0, 7) + '...'
  539. });
  540. for (let key in res.data.productValue) {
  541. let obj = res.data.productValue[key];
  542. that.skuArr.push(obj);
  543. }
  544. this.$set(this, "selectSku", that.skuArr[0]);
  545. var navList = [that.$t(`商品`), that.$t(`详情`)];
  546. if (res.data.replyCount) {
  547. navList.splice(1, 0, that.$t(`评价`));
  548. }
  549. that.$set(that, 'navList', navList);
  550. // #ifdef H5 || APP-PLUS
  551. // this.PromotionCode = res.data.storeInfo.code_base
  552. that.storeImage = that.storeInfo.image
  553. that.getImageBase64();
  554. // #endif
  555. if (!this.storeInfo.wechat_code) {
  556. // #ifdef H5
  557. this.codeVal = window.location.origin +
  558. '/pages/activity/goods_seckill_details/index?id=' +
  559. that.id + '&spid=' + that.storeInfo.uid
  560. // #endif
  561. // #ifdef APP-PLUS
  562. this.codeVal = HTTP_REQUEST_URL + '/pages/activity/goods_seckill_details/index?id=' +
  563. that
  564. .id + '&spid=' + that.storeInfo.uid
  565. // #endif
  566. } else {
  567. that.$set(that, "PromotionCode", this.storeInfo.wechat_code);
  568. }
  569. // #ifdef APP-PLUS
  570. uni.downloadFile({
  571. url: that.setDomain(res.data.storeInfo.wechat_code),
  572. success: function(res) {
  573. that.PromotionCode = res.tempFilePath;
  574. },
  575. fail: function() {
  576. return that.$util.Tips({
  577. title: that.$t(`二维码获取失败`)
  578. });
  579. },
  580. });
  581. that.downloadFilestoreImage();
  582. // #endif
  583. // #ifdef H5
  584. that.setShare();
  585. // #endif
  586. // #ifndef H5 || APP-PLUS
  587. that.downloadFilestoreImage();
  588. // that.downloadFilePromotionCode();
  589. // #endif
  590. that.DefaultSelect();
  591. setTimeout(() => {
  592. that.infoScroll();
  593. }, 500);
  594. app.globalData.openPages = '/pages/activity/goods_seckill_details/index?id=' + that.id +
  595. '&spid=' + that.storeInfo.uid;
  596. // wxParse.wxParse('description', 'html', that.data.storeInfo.description || '', that, 0);
  597. // wxh.time(that.data.time, that);
  598. }).catch(err => {
  599. that.$util.Tips({
  600. title: err
  601. })
  602. });
  603. },
  604. /**
  605. * 获取产品分销二维码
  606. * @param function successFn 下载完成回调
  607. *
  608. */
  609. downloadFilePromotionCode: function(successFn) {
  610. let that = this;
  611. // #ifdef MP
  612. seckillCode(that.id)
  613. .then((res) => {
  614. uni.downloadFile({
  615. url: that.setDomain(res.data.code),
  616. success: function(res) {
  617. that.$set(that, "isDown", false);
  618. that.$set(that, "PromotionCode", res.tempFilePath)
  619. if (typeof successFn == "function")
  620. successFn && successFn(res.tempFilePath);
  621. },
  622. fail: function() {
  623. that.$set(that, "isDown", false);
  624. that.$set(that, "PromotionCode", "");
  625. },
  626. });
  627. })
  628. .catch((err) => {
  629. that.$set(that, "isDown", false);
  630. that.$set(that, "PromotionCode", "");
  631. });
  632. // #endif
  633. // #ifdef APP-PLUS
  634. uni.downloadFile({
  635. url: that.setDomain(that.PromotionCode),
  636. success: function(res) {
  637. that.$set(that, "isDown", false);
  638. if (typeof successFn == "function")
  639. successFn && successFn(res.tempFilePath);
  640. else that.$set(that, "PromotionCode", res.tempFilePath);
  641. },
  642. fail: function() {
  643. that.$set(that, "isDown", false);
  644. that.$set(that, "PromotionCode", "");
  645. },
  646. });
  647. // #endif
  648. },
  649. setShare() {
  650. this.$wechat.isWeixin() &&
  651. this.$wechat.wechatEvevt([
  652. "updateAppMessageShareData",
  653. "updateTimelineShareData",
  654. "onMenuShareAppMessage",
  655. "onMenuShareTimeline"
  656. ], {
  657. desc: this.storeInfo.info,
  658. title: this.storeInfo.title,
  659. link: location.href,
  660. imgUrl: this.storeInfo.image
  661. }).then(res => {}).catch(err => {});
  662. },
  663. /**
  664. * 默认选中属性
  665. *
  666. */
  667. DefaultSelect: function() {
  668. let self = this
  669. let productAttr = self.attribute.productAttr;
  670. let value = [];
  671. for (var key in this.productValue) {
  672. if (this.productValue[key].quota > 0) {
  673. value = this.attribute.productAttr.length ? key.split(",") : [];
  674. break;
  675. }
  676. }
  677. for (let i = 0; i < productAttr.length; i++) {
  678. this.$set(productAttr[i], "index", value[i]);
  679. }
  680. //sort();排序函数:数字-英文-汉字;
  681. let productSelect = this.productValue[value.join(",")];
  682. if (productSelect && productAttr.length) {
  683. self.$set(
  684. self.attribute.productSelect,
  685. "store_name",
  686. self.storeInfo.title
  687. );
  688. self.$set(self.attribute.productSelect, "image", productSelect.image);
  689. self.$set(self.attribute.productSelect, "price", productSelect.price);
  690. self.$set(self.attribute.productSelect, "stock", productSelect.stock);
  691. self.$set(self.attribute.productSelect, "unique", productSelect.unique);
  692. self.$set(self.attribute.productSelect, "quota", productSelect.quota);
  693. self.$set(self.attribute.productSelect, "quota_show", productSelect.quota_show);
  694. self.$set(self.attribute.productSelect, "product_stock", productSelect.product_stock);
  695. self.$set(self.attribute.productSelect, "cart_num", 1);
  696. self.$set(self, "attrValue", value.join(","));
  697. self.attrValue = value.join(",")
  698. } else if (!productSelect && productAttr.length) {
  699. self.$set(
  700. self.attribute.productSelect,
  701. "store_name",
  702. self.storeInfo.title
  703. );
  704. self.$set(self.attribute.productSelect, "image", self.storeInfo.image);
  705. self.$set(self.attribute.productSelect, "price", self.storeInfo.price);
  706. self.$set(self.attribute.productSelect, "quota", 0);
  707. self.$set(self.attribute.productSelect, "quota_show", 0);
  708. self.$set(self.attribute.productSelect, "product_stock", 0);
  709. self.$set(self.attribute.productSelect, "stock", 0);
  710. self.$set(self.attribute.productSelect, "unique", "");
  711. self.$set(self.attribute.productSelect, "cart_num", 0);
  712. self.$set(self, "attrValue", "");
  713. self.$set(self, "attrTxt", this.$t(`请选择`));
  714. } else if (!productSelect && !productAttr.length) {
  715. self.$set(
  716. self.attribute.productSelect,
  717. "store_name",
  718. self.storeInfo.title
  719. );
  720. self.$set(self.attribute.productSelect, "image", self.storeInfo.image);
  721. self.$set(self.attribute.productSelect, "price", self.storeInfo.price);
  722. self.$set(self.attribute.productSelect, "stock", self.storeInfo.stock);
  723. self.$set(self.attribute.productSelect, "quota", self.storeInfo.quota);
  724. self.$set(self.attribute.productSelect, "product_stock", self.storeInfo.product_stock);
  725. self.$set(
  726. self.attribute.productSelect,
  727. "unique",
  728. self.storeInfo.unique || ""
  729. );
  730. self.$set(self.attribute.productSelect, "cart_num", 1);
  731. self.$set(self.attribute.productSelect, "quota", productSelect.quota);
  732. self.$set(self.attribute.productSelect, "product_stock", productSelect.product_stock);
  733. self.$set(self, "attrValue", "");
  734. self.$set(self, "attrTxt", this.$t(`请选择`));
  735. }
  736. },
  737. selecAttr: function() {
  738. this.attribute.cartAttr = true
  739. },
  740. onMyEvent: function() {
  741. this.$set(this.attribute, 'cartAttr', false);
  742. this.$set(this, 'isOpen', false);
  743. },
  744. /**
  745. * 购物车数量加和数量减
  746. *
  747. */
  748. ChangeCartNum: function(changeValue) {
  749. //changeValue:是否 加|减
  750. //获取当前变动属性
  751. let productSelect = this.productValue[this.attrValue];
  752. if (this.cart_num) {
  753. productSelect.cart_num = this.cart_num;
  754. this.attribute.productSelect.cart_num = this.cart_num;
  755. }
  756. //如果没有属性,赋值给商品默认库存
  757. if (productSelect === undefined && !this.attribute.productAttr.length)
  758. productSelect = this.attribute.productSelect;
  759. //无属性值即库存为0;不存在加减;
  760. if (productSelect === undefined) return;
  761. let stock = productSelect.stock || 0;
  762. let quotaShow = productSelect.quota_show || 0;
  763. let quota = productSelect.quota || 0;
  764. let productStock = productSelect.product_stock || 0;
  765. let num = this.attribute.productSelect;
  766. let nums = this.storeInfo.num || 0;
  767. let onceNum = this.storeInfo.once_num || 0;
  768. //设置默认数据
  769. if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
  770. if (changeValue) {
  771. num.cart_num++;
  772. let arrMin = [];
  773. arrMin.push(nums);
  774. arrMin.push(onceNum);
  775. arrMin.push(quota);
  776. arrMin.push(productStock);
  777. let minN = Math.min.apply(null, arrMin);
  778. if (num.cart_num >= minN) {
  779. this.$set(this.attribute.productSelect, "cart_num", minN ? minN : 1);
  780. this.$set(this, "cart_num", minN ? minN : 1);
  781. }
  782. // if(quotaShow >= productStock){
  783. // if (num.cart_num > productStock) {
  784. // this.$set(this.attribute.productSelect, "cart_num", productStock);
  785. // this.$set(this, "cart_num", productStock);
  786. // }
  787. // }else{
  788. // if (num.cart_num > quotaShow) {
  789. // this.$set(this.attribute.productSelect, "cart_num", quotaShow);
  790. // this.$set(this, "cart_num", quotaShow);
  791. // }
  792. // }
  793. this.$set(this, "cart_num", num.cart_num);
  794. this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
  795. } else {
  796. num.cart_num--;
  797. if (num.cart_num < 1) {
  798. this.$set(this.attribute.productSelect, "cart_num", 1);
  799. this.$set(this, "cart_num", 1);
  800. }
  801. this.$set(this, "cart_num", num.cart_num);
  802. this.$set(this.attribute.productSelect, "cart_num", num.cart_num);
  803. }
  804. },
  805. attrVal(val) {
  806. this.attribute.productAttr[val.indexw].index = this.attribute.productAttr[val.indexw].attr_values[val
  807. .indexn];
  808. },
  809. /**
  810. * 属性变动赋值
  811. *
  812. */
  813. ChangeAttr: function(res) {
  814. this.$set(this, 'cart_num', 1);
  815. let productSelect = this.productValue[res];
  816. this.$set(this, "selectSku", productSelect);
  817. if (productSelect) {
  818. this.$set(this.attribute.productSelect, "image", productSelect.image);
  819. this.$set(this.attribute.productSelect, "price", productSelect.price);
  820. this.$set(this.attribute.productSelect, "stock", productSelect.stock);
  821. this.$set(this.attribute.productSelect, "unique", productSelect.unique);
  822. this.$set(this.attribute.productSelect, "cart_num", 1);
  823. this.$set(this.attribute.productSelect, "quota", productSelect.quota);
  824. this.$set(this.attribute.productSelect, "quota_show", productSelect.quota_show);
  825. this.$set(this, "attrValue", res);
  826. this.attrTxt = this.$t(`已选择`)
  827. } else {
  828. this.$set(this.attribute.productSelect, "image", this.storeInfo.image);
  829. this.$set(this.attribute.productSelect, "price", this.storeInfo.price);
  830. this.$set(this.attribute.productSelect, "stock", 0);
  831. this.$set(this.attribute.productSelect, "unique", "");
  832. this.$set(this.attribute.productSelect, "cart_num", 0);
  833. this.$set(this.attribute.productSelect, "quota", 0);
  834. this.$set(this.attribute.productSelect, "quota_show", 0);
  835. this.$set(this, "attrValue", "");
  836. this.attrTxt = this.$t(`已选择`)
  837. }
  838. },
  839. scroll: function(e) {
  840. var that = this,
  841. scrollY = e.detail.scrollTop;
  842. var opacity = scrollY / 200;
  843. opacity = opacity > 1 ? 1 : opacity;
  844. that.opacity = opacity
  845. that.scrollY = scrollY
  846. that.currentPage = false;
  847. that.$set(that, 'showMenuIcon', false);
  848. if (that.lock) {
  849. that.lock = false
  850. return;
  851. }
  852. for (var i = 0; i < that.topArr.length; i++) {
  853. if (scrollY < that.topArr[i] - (app.globalData.navHeight / 2) + that.heightArr[i]) {
  854. that.navActive = i
  855. break
  856. }
  857. }
  858. },
  859. open(data) {
  860. this.showMenuIcon = data
  861. },
  862. tap: function(item, index) {
  863. var id = item.id;
  864. var index = index;
  865. var that = this;
  866. if (!this.replyCount && id == "past1") {
  867. id = "past2"
  868. }
  869. this.toView = id;
  870. this.navActive = index;
  871. this.lock = true;
  872. this.scrollTop = index > 0 ? that.topArr[index] - (app.globalData.navHeight / 2) : that.topArr[index]
  873. },
  874. infoScroll: function() {
  875. var that = this,
  876. topArr = [],
  877. heightArr = [];
  878. for (var i = 0; i < that.navList.length; i++) { //productList
  879. //获取元素所在位置
  880. var query = wx.createSelectorQuery().in(this);
  881. var idView = "#past" + i;
  882. if (!this.replyCount && i == 1) {
  883. idView = "#past" + 2;
  884. }
  885. query.select(idView).boundingClientRect();
  886. query.exec(function(res) {
  887. var top = res[0].top;
  888. var height = res[0].height;
  889. topArr.push(top);
  890. heightArr.push(height);
  891. that.topArr = topArr
  892. that.heightArr = heightArr
  893. });
  894. };
  895. },
  896. /**
  897. * 收藏商品
  898. */
  899. setCollect: function() {
  900. var that = this;
  901. if (this.storeInfo.userCollect) {
  902. collectDel([this.storeInfo.product_id]).then(res => {
  903. that.storeInfo.userCollect = !that.storeInfo.userCollect
  904. })
  905. } else {
  906. collectAdd(this.storeInfo.product_id).then(res => {
  907. that.storeInfo.userCollect = !that.storeInfo.userCollect
  908. })
  909. }
  910. },
  911. /*
  912. * 单独购买
  913. */
  914. openAlone: function() {
  915. uni.navigateTo({
  916. url: `/pages/goods_details/index?id=${this.storeInfo.product_id}`
  917. })
  918. },
  919. /*
  920. * 下订单
  921. */
  922. goCat: function() {
  923. var that = this;
  924. that.currentPage = false;
  925. var productSelect = this.productValue[this.attrValue];
  926. //打开属性
  927. if (this.isOpen)
  928. this.attribute.cartAttr = true
  929. else
  930. this.attribute.cartAttr = !this.attribute.cartAttr
  931. //只有关闭属性弹窗时进行加入购物车
  932. if (this.attribute.cartAttr === true && this.isOpen == false) return this.isOpen = true
  933. //如果有属性,没有选择,提示用户选择
  934. if (this.attribute.productAttr.length && productSelect === undefined && this.isOpen == true) return app
  935. .$util.Tips({
  936. title: that.$t(`请选择属性`)
  937. });
  938. postCartAdd({
  939. productId: that.storeInfo.product_id,
  940. secKillId: that.id,
  941. bargainId: 0,
  942. combinationId: 0,
  943. cartNum: that.cart_num,
  944. uniqueId: productSelect !== undefined ? productSelect.unique : '',
  945. 'new': 1
  946. }).then(res => {
  947. this.isOpen = false
  948. uni.navigateTo({
  949. url: '/pages/goods/order_confirm/index?new=1&cartId=' + res.data.cartId
  950. });
  951. }).catch(err => {
  952. return this.$util.Tips({
  953. title: err
  954. });
  955. });
  956. },
  957. /**
  958. * 分享打开
  959. *
  960. */
  961. listenerActionSheet: function() {
  962. if (this.isLogin === false) {
  963. toLogin();
  964. } else {
  965. // #ifdef H5
  966. if (this.$wechat.isWeixin() === true) {
  967. this.weixinStatus = true;
  968. }
  969. // #endif
  970. this.posters = true;
  971. }
  972. },
  973. // 分享关闭
  974. listenerActionClose: function() {
  975. this.posters = false;
  976. },
  977. //隐藏海报
  978. posterImageClose: function() {
  979. this.posterImageStatus = false
  980. },
  981. //替换安全域名
  982. setDomain: function(url) {
  983. url = url ? url.toString() : '';
  984. //本地调试打开,生产请注销
  985. if (url.indexOf("https://") > -1) return url;
  986. else return url.replace('http://', 'https://');
  987. },
  988. // 小程序关闭分享弹窗;
  989. goFriend: function() {
  990. this.posters = false;
  991. },
  992. /*
  993. * 保存到手机相册
  994. */
  995. // #ifdef MP
  996. savePosterPath: function() {
  997. let that = this;
  998. uni.getSetting({
  999. success(res) {
  1000. if (!res.authSetting['scope.writePhotosAlbum']) {
  1001. uni.authorize({
  1002. scope: 'scope.writePhotosAlbum',
  1003. success() {
  1004. uni.saveImageToPhotosAlbum({
  1005. filePath: that.posterImage,
  1006. success: function(res) {
  1007. that.posterImageClose();
  1008. that.$util.Tips({
  1009. title: that.$t(`保存成功`),
  1010. icon: 'success'
  1011. });
  1012. },
  1013. fail: function(res) {
  1014. that.$util.Tips({
  1015. title: that.$t(`保存失败`)
  1016. });
  1017. }
  1018. })
  1019. }
  1020. })
  1021. } else {
  1022. uni.saveImageToPhotosAlbum({
  1023. filePath: that.posterImage,
  1024. success: function(res) {
  1025. that.posterImageClose();
  1026. that.$util.Tips({
  1027. title: that.$t(`保存成功`),
  1028. icon: 'success'
  1029. });
  1030. },
  1031. fail: function(res) {
  1032. that.$util.Tips({
  1033. title: that.$t(`保存失败`)
  1034. });
  1035. },
  1036. })
  1037. }
  1038. }
  1039. })
  1040. },
  1041. // #endif
  1042. //#ifdef APP-PLUS
  1043. savePosterPath() {
  1044. let that = this
  1045. uni.saveImageToPhotosAlbum({
  1046. filePath: that.posterImage,
  1047. success: function(res) {
  1048. that.posterImageClose();
  1049. that.$util.Tips({
  1050. title: that.$t(`保存成功`),
  1051. icon: 'success'
  1052. });
  1053. },
  1054. fail: function(res) {
  1055. that.$util.Tips({
  1056. title: that.$t(`保存失败`)
  1057. });
  1058. }
  1059. });
  1060. },
  1061. // #endif
  1062. setShareInfoStatus: function() {
  1063. let data = this.storeInfo;
  1064. let href = location.href;
  1065. if (this.$wechat.isWeixin()) {
  1066. this.posters = true;
  1067. getUserInfo().then(res => {
  1068. href =
  1069. href.indexOf("?") === -1 ?
  1070. href + "?spread=" + res.data.uid :
  1071. href + "&spread=" + res.data.uid;
  1072. let configAppMessage = {
  1073. desc: data.store_info,
  1074. title: data.store_name,
  1075. link: href,
  1076. imgUrl: data.image
  1077. };
  1078. this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"],
  1079. configAppMessage)
  1080. });
  1081. }
  1082. },
  1083. //点击sku图片打开轮播图
  1084. showImg(index) {
  1085. this.$refs.cusPreviewImg.open(this.selectSku.suk);
  1086. },
  1087. //滑动轮播图选择商品
  1088. changeSwitch(e) {
  1089. let productSelect = this.skuArr[e];
  1090. this.$set(this, "selectSku", productSelect);
  1091. var skuList = productSelect.suk.split(",");
  1092. this.$set(this.attribute.productAttr[0], "index", skuList[0]);
  1093. if (skuList.length == 2) {
  1094. this.$set(this.attribute.productAttr[0], "index", skuList[0]);
  1095. this.$set(this.attribute.productAttr[1], "index", skuList[1]);
  1096. } else if (skuList.length == 3) {
  1097. this.$set(this.attribute.productAttr[0], "index", skuList[0]);
  1098. this.$set(this.attribute.productAttr[1], "index", skuList[1]);
  1099. this.$set(this.attribute.productAttr[2], "index", skuList[2]);
  1100. } else if (skuList.length == 4) {
  1101. this.$set(this.attribute.productAttr[0], "index", skuList[0]);
  1102. this.$set(this.attribute.productAttr[1], "index", skuList[1]);
  1103. this.$set(this.attribute.productAttr[2], "index", skuList[2]);
  1104. this.$set(this.attribute.productAttr[3], "index", skuList[3]);
  1105. }
  1106. if (productSelect) {
  1107. this.$set(this.attribute.productSelect, "image", productSelect.image);
  1108. this.$set(this.attribute.productSelect, "price", productSelect.price);
  1109. this.$set(this.attribute.productSelect, "stock", productSelect.stock);
  1110. this.$set(this.attribute.productSelect, "unique", productSelect.id);
  1111. this.$set(this.attribute.productSelect, "vipPrice", productSelect.vipPrice);
  1112. this.$set(this, "attrTxt", this.$t(`已选择`));
  1113. this.$set(this, "attrValue", productSelect.suk);
  1114. }
  1115. },
  1116. showSwiperImg(index) {
  1117. this.$refs.cusSwiperImg.open(index);
  1118. },
  1119. },
  1120. //#ifdef MP
  1121. onShareAppMessage() {
  1122. return {
  1123. title: this.storeInfo.title,
  1124. path: app.globalData.openPages,
  1125. imageUrl: this.storeInfo.image
  1126. };
  1127. }
  1128. //#endif
  1129. }
  1130. </script>
  1131. <style lang="scss">
  1132. .generate-posters {
  1133. width: 100%;
  1134. height: 170rpx;
  1135. background-color: #fff;
  1136. position: fixed;
  1137. left: 0;
  1138. bottom: 0;
  1139. z-index: 300;
  1140. transform: translate3d(0, 100%, 0);
  1141. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  1142. border-top: 1rpx solid #eee;
  1143. }
  1144. .generate-posters.on {
  1145. transform: translate3d(0, 0, 0);
  1146. }
  1147. .generate-posters .item {
  1148. flex: 1;
  1149. text-align: center;
  1150. font-size: 30rpx;
  1151. }
  1152. .generate-posters .item .iconfont {
  1153. font-size: 80rpx;
  1154. color: #5eae72;
  1155. }
  1156. .generate-posters .item .iconfont.icon-haibao {
  1157. color: #5391f1;
  1158. }
  1159. .navbar .header {
  1160. height: 96rpx;
  1161. font-size: 30rpx;
  1162. color: #050505;
  1163. background-color: #fff;
  1164. /* #ifdef APP-PLUS */
  1165. width: 100%;
  1166. /* #endif */
  1167. }
  1168. .home {
  1169. /* #ifdef H5 */
  1170. top: 20rpx !important;
  1171. /* #endif */
  1172. }
  1173. .navbar .header .item {
  1174. position: relative;
  1175. margin: 0 25rpx;
  1176. }
  1177. .navbar .header .item.on:before {
  1178. position: absolute;
  1179. width: 60rpx;
  1180. height: 5rpx;
  1181. background-repeat: no-repeat;
  1182. content: '';
  1183. // background-image: linear-gradient(to right, #ff3366 0%, #ff6533 100%);
  1184. background-color: var(--view-theme);
  1185. bottom: -10rpx;
  1186. left: 50%;
  1187. margin-left: -28rpx;
  1188. }
  1189. .navbar {
  1190. position: fixed;
  1191. background-color: #fff;
  1192. top: 0;
  1193. left: 0;
  1194. z-index: 99;
  1195. width: 100%;
  1196. }
  1197. .navbar .navbarH {
  1198. position: relative;
  1199. }
  1200. .navbar .navbarH .navbarCon {
  1201. position: absolute;
  1202. bottom: 0;
  1203. height: 100rpx;
  1204. width: 100%;
  1205. /* #ifndef APP-PLUS || H5 || MP-ALIPAY */
  1206. // justify-content: flex-end;
  1207. // padding-left: 48px;
  1208. /* #endif */
  1209. }
  1210. .home {
  1211. color: #333;
  1212. position: fixed;
  1213. /* #ifdef MP */
  1214. width: 126rpx;
  1215. left: 15rpx;
  1216. /* #endif */
  1217. /* #ifndef MP */
  1218. width: 56rpx;
  1219. left: 33rpx;
  1220. /* #endif */
  1221. height: 56rpx;
  1222. z-index: 99;
  1223. background: rgba(255, 255, 255, 0.3);
  1224. border: 1px solid rgba(0, 0, 0, 0.1);
  1225. border-radius: 40rpx;
  1226. font-size: 33rpx;
  1227. &.right {
  1228. right: 33rpx;
  1229. left: unset
  1230. }
  1231. &.on {
  1232. background: unset;
  1233. color: #333;
  1234. }
  1235. &.homeIndex {
  1236. /* #ifdef MP */
  1237. width: 98rpx;
  1238. /* #endif */
  1239. /* #ifndef MP */
  1240. border-color: rgba(255, 255, 255, 0);
  1241. /* #endif */
  1242. }
  1243. }
  1244. .home .iconfont {
  1245. width: 58rpx;
  1246. text-align: center;
  1247. }
  1248. .home .line {
  1249. width: 1rpx;
  1250. height: 34rpx;
  1251. background: #B3B3B3;
  1252. }
  1253. .home .icon-xiangzuo {
  1254. font-size: 28rpx;
  1255. }
  1256. .product-con .nav {
  1257. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAABkCAMAAADud0VvAAAAeFBMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////GqOSsAAAAKHRSTlMAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnEt6j2gAACYZJREFUeNrtnel2qzoMhSUPzOnpef+HvD1NmonB90eShoTRBoMBaXWltV06wNfdLSEAYaMhdjtEAAQAfHtTAAraX04/KVB0BCLCbffeXyofdk/0Xev3AzGxzSPh7yJAUAiqvLfUfUrBDfqGF/XzkxPM3aEUw3YcsXOi51ov1hFgk7hHO6+O8vK+aYY9OxwVodwvCobGMKPhX0Uz67BF3DFJRBPl3fJ+OZyIYg3egY8r4ybkM/z9pK3hzpOYNVLeJe/FaX8lhPUiZ8ySjPeT+BLrm8PdSwJspbxN3vPDniy7gcArPpWMd7C+MdzD2ANspbxF3tPvA1l2s4w1uwv8aDLeU9dZdW4zuGMU8xvYrZTfZ9+JP30fidshAo+WqjPYyDrWqdNGcOdR9Py/1ibv99nHvrq9P3xfiNlhAs/Z2DKObbretLgJ3GXs9zYxv/L+IL74/keWfXjGWiPwdqx7M+vbwN2PRW/KX+UdFaRfe7LsoxiaQjDr1h2Rtf9ZrB13DEOuYWLe5P309UOgjhVZ7Sn88cjHSh1ma7jzMEA9E1OSd7X/jyz7qAKfCrRl3bGam9blqmvGXQYeNvPcIe/511dGhI6csaa85ODHs+7IWE9rv17cvVDcd5KBvF//+ybLbiNjLQQb2bo/WUe1VdzRD9gvv1omBgDg9B9ZdnsCL0a07v11fcW4M99HNDQxCg5fZNmtCrzEcaw7cqbbWbBC3IUvjU0MFP+oym5b4K9CDLfuPVivMTerw136HE1NDKT/qMo+QWS5N6wPHm8pL2ofrHXhjtJnpiYG4UiNMVMJ/EWa98Ejr2v+2h7ueHcxRoV2dfhHl59OF+mbwPclnzHeXLvvVvv14M49jgBmJgby/XdBDE4ZxVkKXeuOnA+8YHUtuAvJQafl8WU23f+QZZ9P4PtZd8Y4e5VyA/RxFXtOSqy7g0bt1PssXL7PxN484Ykng6233EBe6SBGhQBvKvUuWmqF6o5CQrdVb5B3OO7Jss8W16eDb2tf5xxH0uXFqzsTvE3L2+U9/zmQZZ9Xqzzefpsl5AJfQG1T9y61XzruXCAamhiE9ECFRwcOoY/1oN90veJhXt5vCnfOWSfljeBfDtQr4IjAi1rrjuJZc6z2UW4Od8HQ1MSAOv1Qe687R9Jv0vUu3HVz1aWmqnj7yzfrFsiPR7LsDkWW+6KswCh4w3nT10vmt5KqIkdjEwPZke5751xI73H3VMYfF7U+K+vYoO3a6r5E3G8XJZoV2uF6pPveOXlQAw4IKAS+1l70cO/CHxcIu2klBlCdj9Te62p4wd3DNBv2wbgvzbuj+XUbWJxO1Cvg7IEVXDV0Orao/bq9O/YX8spsdqLCo7us3/y659UpeCvueuZ9Ubj3orwe/OuJCo+Osw4AwAIG3YZ9a7hryru6nKnw6D7rNwf/aJNURrh34L8wM2OSo6rzhSy7q6zzCpEsZPVsYy2zm8C9P/j5hQqPDrNeAyz4HuFuJO+Qnanw6CbrkjUTKkoOvu0DffO+VNz71GfU9UqW3cWDKF/9ehVYDLzmssyGcNeQ9+JKLmYBrDcAK0LWI0/dDu4d8p5fqfDoJOu8J6EPgW937rrmfXFNBL1OMmUpWXZXWe8tyCLCmjNLFWA3gnsz+GlKhUf3WG/OTZsIxdAD6BL3lePeJe8qJRfjNOs6hMqo08vomfcF414HfkEuxkHWud6Z/tKQhfKF07qby6wb92Z5hyKjwqNbwYTkoN2mWx57IbYYd103s/D7zJR7fbOcLLtbrP/mpgPimkUjMrrIq5lq3lROLsZd1geoOwB40WjqvnTcH7CTi3GL9dfcFJQ5oQDAYtFGq8YXXyjuL8gXBbkYt1jnw+S8uhwG2AzrynF/lfeChN0x1ge7l5plHost4/4LOwm7c6yPwndlGIY9cW/74gu9z8y95ZGE3UnWreAO4tfBq+3hXvNrUszIusdG5/t9jGFYi3vH1svHHZBYd4p1bkPOq2ORcH3cy2Oko0UxmHU77qVmjFFAuFPMzLo9vitDmfABWxPujqUkyzFpzGvJTe2pPcYB4b4C1m+wqyWyPiXuAHKHhPvCbQFTd9jVIlgXU/JduUgj9g23JtxdEPYy7Mp51mtz0ylxB+UnaLS1INhm54e/PJMC1QJYn/vnvKSJZ5odUcwYnONT1t2W9xLrk8t5dbks8L23JnWf1cUI9lT0oc8dmpT1+cNI4EndZyRIcCgru7vJKvM8MbucV4dBjL22plR1/hCCNcCuXGQdHMQd2E7qbU24zxNSYjPsyiXWfe6IWa8d3gWecHfZxUgJbbC7gjvz23JTN/DnidTYmnCfvhbj8y7YlXusu4o7QBhh762pMjO1i/HZbfdj68v8rIul9O+crrveFJO6Txnoe9it7HPL+411d+W8OoxC6Lc14T6li/GgJ+xqRtYbc1N3cQe+44S7Wy4mkKo/7Gp21gcjOOlfw5vAE+7zhh8ILdjV/Kw7LefVZZn06HAg3Kew7GHAdGFXk7MuluRe6h7oFAeEuwOWPfJRH3Y1OeuL47syljvWsTXhbjm8yAMj2KfinXu+WKacV8dPgSfc54gw5qawT4I7HzM3dWH5IfCE+/S5Xxwyc9jVFKyLxfNdceeJ37JMZ1VthUhCANVx8rT5rKqagPU17na1vySsuWhAXFoJP/HBXNlt3+iVryQ3rR+y2G9aJtwtBEaJVMawK8uwv+j6KviujL2ENdxmkuAc3bLvYmau7JafzfDuYdaJO7BEEu5ThNzF8HahtcZLbhV27vvSIUKtfi8/xpplSlVHjfAjUKX+Xs0ENcutsh44drA7Op2HLV/SisCTuo97+JKP2i6wfspe2IT9yfpK3UvtA50iJDNjjaiPHW8+QdoFe57aexIJD8p+fcV8vw/57v33JjMzTnifMarui5MaPiFL1TSsbyvyrzB+nSHcx4job9DvjFLdtEqtwc6Dam66qXi/sI/MzHDL/vEpNXu/SoPikllj/ebXN+Re6sZRRGZmvBCff5hur8BzkF1yu6xTHK+JIHUfJ/y/H8ZnlKBIL8UErG9c3QEgDh9Dwn1AxH+j+4416RW4XJR91rfJ9/tQ7O4PdCLcB1h27/YwY6PTp+erJdYlyXnNMA6QcB/A1Z9Phr+7Txf29JzaYn1RhE74vcSOEe6G4X0miM9n1WvCfj7nNlgPBcl5yxhjnyozJhH9CfF1r2rUZYrzaXzLzkOqw3SF2l8SRuqua9l3f+Ttn6KJvKens01dJzlvXWbx/9o+Ua+lzl/DAAAAAElFTkSuQmCC');
  1258. background-repeat: no-repeat;
  1259. background-size: 100% 100%;
  1260. width: 100%;
  1261. height: 100rpx;
  1262. padding: 0 30rpx;
  1263. box-sizing: border-box;
  1264. }
  1265. .product-con .nav /deep/.time .styleAll {
  1266. padding: 0 6rpx;
  1267. font-size: 22rpx;
  1268. color: var(--view-theme);
  1269. background-color: #fff;
  1270. border-radius: 2rpx
  1271. }
  1272. .product-con .nav .money {
  1273. font-size: 28rpx;
  1274. color: #fff;
  1275. }
  1276. .product-con .nav .money .num {
  1277. font-size: 48rpx;
  1278. }
  1279. .product-con .nav .money .y-money {
  1280. font-size: 26rpx;
  1281. margin-left: 10rpx;
  1282. text-decoration: line-through;
  1283. }
  1284. .product-con .nav .timeItem {
  1285. font-size: 20rpx;
  1286. color: #fff;
  1287. text-align: center;
  1288. }
  1289. .product-con .nav .timeItem .timeCon {
  1290. margin-top: 10rpx;
  1291. }
  1292. .product-con .nav .timeItem .timeCon .num {
  1293. padding: 0 7rpx;
  1294. font-size: 22rpx;
  1295. color: #ff3d3d;
  1296. background-color: #fff;
  1297. border-radius: 2rpx;
  1298. }
  1299. .product-con .nav .timeState {
  1300. font-size: 28RPX;
  1301. color: #FFF;
  1302. }
  1303. .product-con .nav .iconfont {
  1304. color: #fff;
  1305. font-size: 30rpx;
  1306. margin-left: 20rpx;
  1307. }
  1308. .product-con .wrapper {
  1309. padding: 32rpx;
  1310. width: 100%;
  1311. box-sizing: border-box;
  1312. }
  1313. .product-con .wrapper .introduce {
  1314. margin: 0;
  1315. }
  1316. .product-con .wrapper .introduce .infor {
  1317. width: 570rpx;
  1318. }
  1319. .product-con .wrapper .introduce .iconfont {
  1320. font-size: 37rpx;
  1321. color: #515151;
  1322. }
  1323. .product-con .wrapper .label {
  1324. margin: 18rpx 0 0 0;
  1325. font-size: 24rpx;
  1326. color: #82848f;
  1327. display: flex;
  1328. justify-content: space-between;
  1329. }
  1330. .product-con .wrapper .label .stock {
  1331. width: 255rpx;
  1332. margin-right: 28rpx;
  1333. }
  1334. .product-con .footer {
  1335. padding: 0 20rpx 0 30rpx;
  1336. position: fixed;
  1337. bottom: 0;
  1338. width: 100%;
  1339. box-sizing: border-box;
  1340. background-color: rgba(255, 255, 255, 0.85);
  1341. backdrop-filter: blur(10px);
  1342. z-index: 277;
  1343. border-top: 1rpx solid #f0f0f0;
  1344. height: 100rpx;
  1345. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1346. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1347. transform: translate3d(0, 100%, 0);
  1348. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  1349. }
  1350. .product-con .footer .item {
  1351. font-size: 18rpx;
  1352. color: #666;
  1353. }
  1354. .product-con .footer .item .iconfont {
  1355. text-align: center;
  1356. font-size: 40rpx;
  1357. }
  1358. .product-con .footer .item .iconfont.icon-shoucang1 {
  1359. color: var(--view-theme);
  1360. }
  1361. .product-con .footer .item .iconfont.icon-gouwuche1 {
  1362. font-size: 40rpx;
  1363. position: relative;
  1364. }
  1365. .product-con .footer .item .iconfont.icon-gouwuche1 .num {
  1366. color: #fff;
  1367. position: absolute;
  1368. font-size: 18rpx;
  1369. padding: 2rpx 8rpx 3rpx;
  1370. border-radius: 200rpx;
  1371. top: -10rpx;
  1372. right: -10rpx;
  1373. }
  1374. .product-con .footer .bnt {
  1375. width: 540rpx;
  1376. height: 76rpx;
  1377. }
  1378. .product-con .footer .bnt .bnts {
  1379. width: 270rpx;
  1380. text-align: center;
  1381. line-height: 76rpx;
  1382. color: #fff;
  1383. font-size: 28rpx;
  1384. }
  1385. .product-con .footer .bnt .joinCart {
  1386. border-radius: 50rpx 0 0 50rpx;
  1387. // background-image: linear-gradient(to right, #fea10f 0%, #fa8013 100%);
  1388. background-color: var(--view-bntColor);
  1389. }
  1390. .product-con .footer .bnt .buy {
  1391. border-radius: 0 50rpx 50rpx 0;
  1392. background-color: var(--view-theme);
  1393. // background-image: linear-gradient(to right, #fa6514 0%, #e93323 100%);
  1394. }
  1395. .product-con .conter {
  1396. display: block;
  1397. padding-bottom: 100rpx;
  1398. }
  1399. .product-con .conter img {
  1400. display: block;
  1401. }
  1402. .setCollectBox {
  1403. font-size: 18rpx;
  1404. color: #666;
  1405. }
  1406. .bg-color-hui {
  1407. background: #bbbbbb !important;
  1408. }
  1409. .canvas {
  1410. width: 750px;
  1411. height: 1190px;
  1412. }
  1413. .poster-pop {
  1414. width: 450rpx;
  1415. height: 714rpx;
  1416. position: fixed;
  1417. left: 50%;
  1418. transform: translateX(-50%);
  1419. z-index: 300;
  1420. top: 50%;
  1421. margin-top: -377rpx;
  1422. }
  1423. .poster-pop image {
  1424. width: 100%;
  1425. height: 100%;
  1426. display: block;
  1427. }
  1428. .poster-pop .close {
  1429. width: 46rpx;
  1430. height: 75rpx;
  1431. position: fixed;
  1432. right: 0;
  1433. top: -73rpx;
  1434. display: block;
  1435. }
  1436. .poster-pop .save-poster {
  1437. background-color: #df2d0a;
  1438. font-size: :22rpx;
  1439. color: #fff;
  1440. text-align: center;
  1441. height: 76rpx;
  1442. line-height: 76rpx;
  1443. width: 100%;
  1444. }
  1445. .poster-pop .keep {
  1446. color: #fff;
  1447. text-align: center;
  1448. font-size: 25rpx;
  1449. margin-top: 10rpx;
  1450. }
  1451. /deep/.mask {
  1452. z-index: 99 !important;
  1453. }
  1454. .mask1 {
  1455. position: fixed;
  1456. top: 0;
  1457. left: 0;
  1458. right: 0;
  1459. bottom: 0;
  1460. background-color: #000;
  1461. opacity: .5;
  1462. z-index: 288;
  1463. }
  1464. .home-nav {
  1465. /* #ifdef H5 */
  1466. top: 20rpx !important;
  1467. /* #endif */
  1468. }
  1469. .home-nav {
  1470. color: #333;
  1471. position: fixed;
  1472. /* #ifdef MP */
  1473. width: 126rpx;
  1474. left: 15rpx;
  1475. /* #endif */
  1476. /* #ifndef MP */
  1477. width: 56rpx;
  1478. left: 33rpx;
  1479. /* #endif */
  1480. height: 56rpx;
  1481. font-size: 33rpx;
  1482. z-index: 99;
  1483. background: rgba(255, 255, 255, 0.3);
  1484. border: 1px solid rgba(0, 0, 0, 0.1);
  1485. border-radius: 40rpx;
  1486. &.right {
  1487. right: 33rpx;
  1488. left: unset
  1489. }
  1490. &.on {
  1491. background: unset;
  1492. color: #333;
  1493. }
  1494. &.homeIndex {
  1495. /* #ifdef MP */
  1496. width: 98rpx;
  1497. /* #endif */
  1498. /* #ifndef MP */
  1499. border-color: rgba(255, 255, 255, 0);
  1500. /* #endif */
  1501. }
  1502. }
  1503. .home-nav .iconfont {
  1504. width: 58rpx;
  1505. text-align: center;
  1506. }
  1507. .home-nav .line {
  1508. width: 1rpx;
  1509. height: 34rpx;
  1510. background: #B3B3B3;
  1511. }
  1512. .home-nav .icon-xiangzuo {
  1513. width: auto;
  1514. font-size: 28rpx;
  1515. }
  1516. .share-box {
  1517. z-index: 1000;
  1518. position: fixed;
  1519. left: 0;
  1520. top: 0;
  1521. width: 100%;
  1522. height: 100%;
  1523. }
  1524. .share-box image {
  1525. width: 100%;
  1526. height: 100%;
  1527. }
  1528. .attrImg {
  1529. width: 66rpx;
  1530. height: 66rpx;
  1531. border-radius: 6rpx;
  1532. display: block;
  1533. margin-right: 14rpx;
  1534. }
  1535. .switchTxt {
  1536. height: 60rpx;
  1537. flex: 1;
  1538. line-height: 60rpx;
  1539. box-sizing: border-box;
  1540. background: #eeeeee;
  1541. padding: 0 10rpx;
  1542. border-radius: 8rpx;
  1543. text-align: center;
  1544. }
  1545. .attribute {
  1546. padding: 10rpx 30rpx;
  1547. .line1 {
  1548. width: 600rpx;
  1549. }
  1550. }
  1551. .flex {
  1552. display: flex;
  1553. justify-content: space-between;
  1554. width: 100%;
  1555. }
  1556. .flexs {
  1557. display: flex;
  1558. }
  1559. .attr-txt {
  1560. display: flex;
  1561. flex-wrap: nowrap;
  1562. width: 130rpx;
  1563. }
  1564. </style>