index.vue 49 KB

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