index.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656
  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. <view class="uni-p-b-98"></view>
  128. </scroll-view>
  129. <view class='footer acea-row row-between-wrapper' :class="{'eject':storeInfo.id}">
  130. <navigator hover-class="none" open-type="switchTab" class="item" url="/pages/index/index">
  131. <view class="iconfont icon-shouye6"></view>
  132. <view class="p_center">{{$t(`首页`)}}</view>
  133. </navigator>
  134. <view @tap='setCollect' class='item'>
  135. <view class='iconfont icon-shoucang1' v-if="storeInfo.userCollect"></view>
  136. <view class='iconfont icon-shoucang' v-else></view>
  137. <view class="p_center">{{$t(`收藏`)}}</view>
  138. </view>
  139. <view class="bnt acea-row"
  140. v-if="status == 1 && attribute.productSelect.quota > 0 && attribute.productSelect.product_stock>0">
  141. <view class="joinCart bnts" @tap="openAlone" v-if="storeInfo.product_is_show">{{$t(`单独购买`)}}</view>
  142. <view class="buy bnts" :class="!storeInfo.product_is_show ? 'long-btn' : ''" @tap="goCat">{{$t(`立即购买`)}}</view>
  143. </view>
  144. <view class="bnt acea-row"
  145. 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)">
  146. <view class="joinCart bnts" @tap="openAlone" v-if="storeInfo.product_is_show">{{$t(`单独购买`)}}</view>
  147. <view class="buy bnts bg-color-hui" :class="!storeInfo.product_is_show ? 'long-btn' : ''">{{$t(`已售罄`)}}</view>
  148. </view>
  149. <view class="bnt acea-row" v-if="!dataShow && status == 1">
  150. <view class="joinCart bnts" @tap="openAlone" v-if="storeInfo.product_is_show">{{$t(`单独购买`)}}</view>
  151. <view class="buy bnts bg-color-hui" :class="!storeInfo.product_is_show ? 'long-btn' : ''">{{$t(`立即购买`)}}</view>
  152. </view>
  153. <view class="bnt acea-row" v-if="status == 2">
  154. <view class="joinCart bnts" @tap="openAlone" v-if="storeInfo.product_is_show">{{$t(`单独购买`)}}</view>
  155. <view class="buy bnts bg-color-hui" :class="!storeInfo.product_is_show ? 'long-btn' : ''">{{$t(`未开始`)}}</view>
  156. </view>
  157. <view class="bnt acea-row" v-if="status == 0">
  158. <view class="joinCart bnts" @tap="openAlone" v-if="storeInfo.product_is_show">{{$t(`单独购买`)}}</view>
  159. <view class="buy bnts bg-color-hui" :class="!storeInfo.product_is_show ? 'long-btn' : ''">{{$t(`已结束`)}}</view>
  160. </view>
  161. </view>
  162. </view>
  163. <cus-previewImg ref="cusPreviewImg" :list="skuArr" @changeSwitch="changeSwitch"
  164. @shareFriend="listenerActionSheet" />
  165. <product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" :type="'seckill'"
  166. @ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" @getImg="showImg">
  167. </product-window>
  168. <!-- #ifdef MP -->
  169. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth"></authorize> -->
  170. <!-- #endif -->
  171. <!-- 分享按钮 -->
  172. <view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
  173. <!-- #ifndef MP -->
  174. <button class="item" hover-class='none' v-if="weixinStatus === true" @click="H5ShareBox = true">
  175. <!-- <button class="item" hover-class='none' v-if="weixinStatus === true" @click="setShareInfoStatus"> -->
  176. <view class="iconfont icon-weixin3"></view>
  177. <view class="">{{$t(`发送给朋友`)}}</view>
  178. </button>
  179. <!-- #endif -->
  180. <!-- #ifdef MP -->
  181. <button class="item" open-type="share" hover-class='none' @click="goFriend">
  182. <view class="iconfont icon-weixin3"></view>
  183. <view class="">{{$t(`发送给朋友`)}}</view>
  184. </button>
  185. <!-- #endif -->
  186. <!-- #ifdef APP-PLUS -->
  187. <view class="item" @click="appShare('WXSceneSession')">
  188. <view class="iconfont icon-weixin3"></view>
  189. <view class="">{{$t(`微信好友`)}}</view>
  190. </view>
  191. <view class="item" @click="appShare('WXSenceTimeline')">
  192. <view class="iconfont icon-pengyouquan"></view>
  193. <view class="">{{$t(`微信朋友圈`)}}</view>
  194. </view>
  195. <!-- #endif -->
  196. <button class="item" hover-class='none' @tap="goPoster('seckill')">
  197. <view class="iconfont icon-haibao"></view>
  198. <view class="">{{$t(`生成海报`)}}</view>
  199. </button>
  200. </view>
  201. <view class="mask" v-if="posters" @click="listenerActionClose"></view>
  202. <!-- 海报展示 -->
  203. <view class='poster-pop' v-if="posterImageStatus">
  204. <image src='/static/images/poster-close.png' class='close' @click="posterImageClose"></image>
  205. <image class="poster-img" :src='posterImage'></image>
  206. <!-- #ifndef H5 -->
  207. <view class='save-poster' @click="savePosterPath">{{$t(`保存到手机`)}}</view>
  208. <!-- #endif -->
  209. <!-- #ifdef H5 -->
  210. <view class="keep">{{$t(`长按图片可以保存到手机`)}}</view>
  211. <!-- #endif -->
  212. </view>
  213. <view class='mask1' v-if="posterImageStatus"></view>
  214. <canvas class="canvas" canvas-id='myCanvas' v-if="canvasStatus"></canvas>
  215. <kefuIcon :ids='storeInfo.product_id' :routineContact='routineContact'></kefuIcon>
  216. <!-- 发送给朋友图片 -->
  217. <view class="share-box" v-if="H5ShareBox">
  218. <image :src="imgHost + '/statics/images/share-info.png'" @click="H5ShareBox = false"></image>
  219. </view>
  220. <swiperPrevie ref="cusSwiperImg" :list="storeInfo.images"></swiperPrevie>
  221. <!-- #ifdef H5 || APP-PLUS -->
  222. <zb-code ref="qrcode" :show="codeShow" :cid="cid" :val="codeVal" :size="size" :unit="unit"
  223. :background="background" :foreground="foreground" :pdground="pdground" :icon="codeIcon" :iconSize="iconsize"
  224. :onval="onval" :loadMake="loadMake" @result="qrR" />
  225. <!-- #endif -->
  226. </view>
  227. </template>
  228. <script>
  229. const app = getApp();
  230. import {
  231. mapGetters
  232. } from "vuex";
  233. import {
  234. getSeckillDetail,
  235. seckillCode
  236. } from '@/api/activity.js';
  237. import {
  238. postCartAdd,
  239. collectAdd,
  240. collectDel
  241. } from '@/api/store.js';
  242. import productConSwiper from '@/components/productConSwiper/index.vue'
  243. import swiperPrevie from "@/components/cusPreviewImg/swiperPrevie.vue";
  244. import productWindow from '@/components/productWindow/index.vue'
  245. import userEvaluation from '@/components/userEvaluation/index.vue'
  246. import kefuIcon from '@/components/kefuIcon';
  247. // #ifdef MP
  248. import authorize from '@/components/Authorize';
  249. // #endif
  250. import countDown from '@/components/countDown';
  251. import {
  252. imageBase64
  253. } from "@/api/public";
  254. import {
  255. toLogin
  256. } from '@/libs/login.js';
  257. import {
  258. getUserInfo
  259. } from '@/api/user.js';
  260. // #ifdef APP-PLUS
  261. import {
  262. TOKENNAME
  263. } from '@/config/app.js';
  264. // #endif
  265. import colors from '@/mixins/color.js';
  266. import menuIcon from '@/components/menuIcon.vue'
  267. import parser from "@/components/jyf-parser/jyf-parser";
  268. import cusPreviewImg from "@/components/cusPreviewImg/index.vue";
  269. import {
  270. sharePoster
  271. } from "@/mixins/sharePoster";
  272. import {
  273. HTTP_REQUEST_URL
  274. } from '@/config/app';
  275. import homeList from '@/components/homeList'
  276. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  277. export default {
  278. computed: mapGetters(['isLogin']),
  279. mixins: [colors, sharePoster],
  280. components: {
  281. productConSwiper,
  282. 'productWindow': productWindow,
  283. userEvaluation,
  284. kefuIcon,
  285. menuIcon,
  286. countDown,
  287. cusPreviewImg,
  288. swiperPrevie,
  289. parser,
  290. homeList,
  291. // #ifdef MP
  292. authorize
  293. // #endif
  294. },
  295. data() {
  296. return {
  297. imgHost: HTTP_REQUEST_URL,
  298. showMenuIcon: false,
  299. dataShow: 0,
  300. id: 0,
  301. time: 0,
  302. countDownHour: "00",
  303. countDownMinute: "00",
  304. countDownSecond: "00",
  305. storeInfo: [],
  306. imgUrls: [],
  307. parameter: {
  308. 'navbar': '1',
  309. 'return': '1',
  310. 'title': this.$t(`抢购详情页`),
  311. 'color': false
  312. },
  313. attribute: {
  314. cartAttr: false,
  315. productAttr: [],
  316. productSelect: {}
  317. },
  318. productValue: [],
  319. isOpen: false,
  320. attr: this.$t(`请选择`),
  321. attrValue: '',
  322. status: 1,
  323. isAuto: false,
  324. isShowAuth: false,
  325. iShidden: false,
  326. limitNum: 1, //限制本属性产品的个数;
  327. iSplus: false,
  328. replyCount: 0, //总评论数量
  329. reply: [], //评论列表
  330. replyChance: 0,
  331. navH: "",
  332. navList: [this.$t(`商品`), this.$t(`评价`), this.$t(`详情`)],
  333. opacity: 0,
  334. scrollY: 0,
  335. topArr: [],
  336. toView: '',
  337. height: 0,
  338. heightArr: [],
  339. lock: false,
  340. scrollTop: 0,
  341. tagStyle: {
  342. img: 'width:100%;display:block;',
  343. table: 'width:100%',
  344. video: 'width:100%'
  345. },
  346. datatime: 0,
  347. navActive: 0,
  348. meunHeight: 0,
  349. backH: '',
  350. posters: false,
  351. weixinStatus: false,
  352. posterImageStatus: false,
  353. canvasStatus: false, //海报绘图标签
  354. storeImage: '', //海报产品图
  355. PromotionCode: '', //二维码图片
  356. posterImage: '', //海报路径
  357. posterbackgd: '/static/images/posterbackgd.png',
  358. actionSheetHidden: false,
  359. cart_num: '',
  360. homeTop: 20,
  361. returnShow: true,
  362. H5ShareBox: false, //公众号分享图片
  363. routineContact: 0,
  364. skuArr: [],
  365. selectSku: {},
  366. currentPage: false,
  367. sysHeight: sysHeight,
  368. }
  369. },
  370. computed: mapGetters(['isLogin']),
  371. watch: {
  372. isLogin: {
  373. handler: function(newV, oldV) {
  374. if (newV) {
  375. this.getSeckillDetail();
  376. }
  377. },
  378. deep: true
  379. }
  380. },
  381. onLoad(options) {
  382. let that = this
  383. let statusBarHeight = ''
  384. var pages = getCurrentPages();
  385. if (options.id) {
  386. this.id = options.id
  387. //记录推广人uid
  388. if (options.pid) app.globalData.spid = options.pid;
  389. // if (options.time) this.datatime = Number(options.time);
  390. }
  391. that.returnShow = pages.length === 1 ? false : true;
  392. //设置商品列表高度
  393. uni.getSystemInfo({
  394. success: function(res) {
  395. that.height = res.windowHeight
  396. statusBarHeight = res.statusBarHeight
  397. //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
  398. },
  399. });
  400. // #ifdef MP
  401. this.navH = app.globalData.navHeight;
  402. // #endif
  403. // #ifdef H5
  404. that.navH = 96;
  405. // #endif
  406. // #ifdef APP-PLUS
  407. that.navH = 30;
  408. // #endif
  409. // #ifdef MP
  410. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  411. this.meunHeight = menuButtonInfo.height
  412. this.backH = (that.navH / 2) + (this.meunHeight / 2)
  413. //扫码携带参数处理
  414. if (options.scene) {
  415. let value = this.$util.getUrlParams(decodeURIComponent(options.scene));
  416. if (value.id) {
  417. this.id = value.id;
  418. } else {
  419. return this.$util.Tips({
  420. title: this.$t(`缺少参数无法查看商品`)
  421. }, {
  422. tab: 3,
  423. url: 1
  424. });
  425. }
  426. //记录推广人uid
  427. if (value.pid) app.globalData.spid = value.pid;
  428. // if (value.time) this.datatime = value.time
  429. }
  430. // #endif
  431. if (this.isLogin) {
  432. this.getSeckillDetail();
  433. } else {
  434. toLogin();
  435. }
  436. this.$nextTick(() => {
  437. // #ifdef MP
  438. const menuButton = uni.getMenuButtonBoundingClientRect();
  439. const query = uni.createSelectorQuery().in(this);
  440. query
  441. .select('#home')
  442. .boundingClientRect(data => {
  443. this.homeTop = menuButton.top * 2 + menuButton.height - data.height;
  444. })
  445. .exec();
  446. // #endif
  447. })
  448. },
  449. onNavigationBarButtonTap(e) {
  450. this.currentPage = !this.currentPage
  451. },
  452. methods: {
  453. moreNav() {
  454. this.currentPage = !this.currentPage
  455. },
  456. // app分享
  457. // #ifdef APP-PLUS
  458. appShare(scene) {
  459. let that = this
  460. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  461. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  462. uni.share({
  463. provider: "weixin",
  464. scene: scene,
  465. type: 0,
  466. href: `${HTTP_REQUEST_URL}${curRoute}`,
  467. title: that.storeInfo.title,
  468. summary: that.storeInfo.info,
  469. imageUrl: that.storeInfo.small_image,
  470. success: function(res) {
  471. uni.showToast({
  472. title: this.$t(`分享成功`),
  473. icon: 'success'
  474. })
  475. that.posters = false;
  476. },
  477. fail: function(err) {
  478. uni.showToast({
  479. title: this.$t(`分享失败`),
  480. icon: 'none',
  481. duration: 2000
  482. })
  483. that.posters = false;
  484. }
  485. });
  486. },
  487. // #endif
  488. /**
  489. * 购物车手动填写
  490. *
  491. */
  492. iptCartNum: function(e) {
  493. this.$set(this.attribute.productSelect, 'cart_num', e);
  494. this.$set(this, "cart_num", e);
  495. },
  496. // 后退
  497. returns() {
  498. // #ifdef H5
  499. return history.back();
  500. // #endif
  501. // #ifndef H5
  502. return uni.navigateBack({
  503. delta: 1,
  504. })
  505. // #endif
  506. },
  507. onLoadFun: function(data) {
  508. if (this.isAuto) {
  509. this.isAuto = false;
  510. this.isShowAuth = false;
  511. this.getSeckillDetail();
  512. }
  513. },
  514. getSeckillDetail: function() {
  515. let that = this;
  516. getSeckillDetail(that.id, {}).then(res => {
  517. this.dataShow = 1;
  518. this.status = res.data.storeInfo.status
  519. let title = res.data.storeInfo.title;
  520. this.storeInfo = res.data.storeInfo;
  521. this.datatime = Number(res.data.storeInfo.last_time);
  522. this.imgUrls = res.data.storeInfo.images;
  523. this.storeInfo.description = this.storeInfo.description.replace(/<img/gi,
  524. '<img style="max-width:100%;height:auto;float:left;display:block" ');
  525. this.storeInfo.description = this.storeInfo.description.replace(
  526. /<video/gi,
  527. '<video style="width:100%;height:300px;display:block" '
  528. );
  529. // this.attribute.productAttr = res.data.productAttr;
  530. that.$set(that.attribute, "productAttr", res.data.productAttr);
  531. this.productValue = res.data.productValue;
  532. this.attribute.productSelect.num = res.data.storeInfo.num;
  533. this.attribute.productSelect.once_num = res.data.storeInfo.once_num;
  534. this.replyCount = res.data.replyCount;
  535. this.reply = res.data.reply ? [res.data.reply] : [];
  536. this.replyChance = res.data.replyChance;
  537. that.routineContact = Number(res.data.routine_contact_type);
  538. uni.setNavigationBarTitle({
  539. title: title.substring(0, 7) + '...'
  540. });
  541. for (let key in res.data.productValue) {
  542. let obj = res.data.productValue[key];
  543. that.skuArr.push(obj);
  544. }
  545. this.$set(this, "selectSku", that.skuArr[0]);
  546. var navList = [that.$t(`商品`), that.$t(`详情`)];
  547. if (res.data.replyCount) {
  548. navList.splice(1, 0, that.$t(`评价`));
  549. }
  550. that.$set(that, 'navList', navList);
  551. // #ifdef H5 || APP-PLUS
  552. // this.PromotionCode = res.data.storeInfo.code_base
  553. that.storeImage = that.storeInfo.image
  554. that.getImageBase64();
  555. // #endif
  556. if (!this.storeInfo.wechat_code) {
  557. // #ifdef H5
  558. this.codeVal = window.location.origin +
  559. '/pages/activity/goods_seckill_details/index?id=' +
  560. that.id + '&spid=' + that.storeInfo.uid
  561. // #endif
  562. // #ifdef APP-PLUS
  563. this.codeVal = HTTP_REQUEST_URL + '/pages/activity/goods_seckill_details/index?id=' +
  564. that
  565. .id + '&spid=' + that.storeInfo.uid
  566. // #endif
  567. } else {
  568. that.$set(that, "PromotionCode", this.storeInfo.wechat_code);
  569. }
  570. // #ifdef APP-PLUS
  571. uni.downloadFile({
  572. url: that.setDomain(res.data.storeInfo.wechat_code),
  573. success: function(res) {
  574. that.PromotionCode = res.tempFilePath;
  575. },
  576. fail: function() {
  577. return that.$util.Tips({
  578. title: that.$t(`二维码获取失败`)
  579. });
  580. },
  581. });
  582. that.downloadFilestoreImage();
  583. // #endif
  584. // #ifdef H5
  585. that.setShare();
  586. // #endif
  587. // #ifndef H5 || APP-PLUS
  588. that.downloadFilestoreImage();
  589. // that.downloadFilePromotionCode();
  590. // #endif
  591. that.DefaultSelect();
  592. setTimeout(() => {
  593. that.infoScroll();
  594. }, 500);
  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. showSwiperImg(index) {
  1114. this.$refs.cusSwiperImg.open(index);
  1115. },
  1116. },
  1117. //#ifdef MP
  1118. onShareAppMessage() {
  1119. return {
  1120. title: this.storeInfo.title,
  1121. path: '/pages/activity/goods_seckill_details/index?id=' + this.id + '&spid=' + this.$store.state.app.uid,
  1122. imageUrl: this.storeInfo.image
  1123. };
  1124. }
  1125. //#endif
  1126. }
  1127. </script>
  1128. <style lang="scss">
  1129. .generate-posters {
  1130. width: 100%;
  1131. height: 170rpx;
  1132. background-color: #fff;
  1133. position: fixed;
  1134. left: 0;
  1135. bottom: 0;
  1136. z-index: 300;
  1137. transform: translate3d(0, 100%, 0);
  1138. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  1139. border-top: 1rpx solid #eee;
  1140. }
  1141. .generate-posters.on {
  1142. transform: translate3d(0, 0, 0);
  1143. }
  1144. .generate-posters .item {
  1145. flex: 1;
  1146. text-align: center;
  1147. font-size: 30rpx;
  1148. }
  1149. .generate-posters .item .iconfont {
  1150. font-size: 80rpx;
  1151. color: #5eae72;
  1152. }
  1153. .generate-posters .item .iconfont.icon-haibao {
  1154. color: #5391f1;
  1155. }
  1156. .navbar .header {
  1157. height: 96rpx;
  1158. font-size: 30rpx;
  1159. color: #050505;
  1160. background-color: #fff;
  1161. /* #ifdef APP-PLUS */
  1162. width: 100%;
  1163. /* #endif */
  1164. }
  1165. .home {
  1166. /* #ifdef H5 */
  1167. top: 20rpx !important;
  1168. /* #endif */
  1169. }
  1170. .navbar .header .item {
  1171. position: relative;
  1172. margin: 0 25rpx;
  1173. }
  1174. .navbar .header .item.on:before {
  1175. position: absolute;
  1176. width: 60rpx;
  1177. height: 5rpx;
  1178. background-repeat: no-repeat;
  1179. content: '';
  1180. // background-image: linear-gradient(to right, #ff3366 0%, #ff6533 100%);
  1181. background-color: var(--view-theme);
  1182. bottom: -10rpx;
  1183. left: 50%;
  1184. margin-left: -28rpx;
  1185. }
  1186. .navbar {
  1187. position: fixed;
  1188. background-color: #fff;
  1189. top: 0;
  1190. left: 0;
  1191. z-index: 99;
  1192. width: 100%;
  1193. }
  1194. .navbar .navbarH {
  1195. position: relative;
  1196. }
  1197. .navbar .navbarH .navbarCon {
  1198. position: absolute;
  1199. bottom: 0;
  1200. height: 100rpx;
  1201. width: 100%;
  1202. /* #ifndef APP-PLUS || H5 || MP-ALIPAY */
  1203. // justify-content: flex-end;
  1204. // padding-left: 48px;
  1205. /* #endif */
  1206. }
  1207. .home {
  1208. color: #333;
  1209. position: fixed;
  1210. /* #ifdef MP */
  1211. width: 126rpx;
  1212. left: 15rpx;
  1213. /* #endif */
  1214. /* #ifndef MP */
  1215. width: 56rpx;
  1216. left: 33rpx;
  1217. /* #endif */
  1218. height: 56rpx;
  1219. z-index: 99;
  1220. background: rgba(255, 255, 255, 0.3);
  1221. border: 1px solid rgba(0, 0, 0, 0.1);
  1222. border-radius: 40rpx;
  1223. font-size: 33rpx;
  1224. &.right {
  1225. right: 33rpx;
  1226. left: unset
  1227. }
  1228. &.on {
  1229. background: unset;
  1230. color: #333;
  1231. }
  1232. &.homeIndex {
  1233. /* #ifdef MP */
  1234. width: 98rpx;
  1235. /* #endif */
  1236. /* #ifndef MP */
  1237. border-color: rgba(255, 255, 255, 0);
  1238. /* #endif */
  1239. }
  1240. }
  1241. .home .iconfont {
  1242. width: 58rpx;
  1243. text-align: center;
  1244. }
  1245. .home .line {
  1246. width: 1rpx;
  1247. height: 34rpx;
  1248. background: #B3B3B3;
  1249. }
  1250. .home .icon-xiangzuo {
  1251. font-size: 28rpx;
  1252. }
  1253. .product-con .nav {
  1254. 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');
  1255. background-repeat: no-repeat;
  1256. background-size: 100% 100%;
  1257. width: 100%;
  1258. height: 100rpx;
  1259. padding: 0 30rpx;
  1260. box-sizing: border-box;
  1261. }
  1262. .product-con .nav /deep/.time .styleAll {
  1263. padding: 0 6rpx;
  1264. font-size: 22rpx;
  1265. color: var(--view-theme);
  1266. background-color: #fff;
  1267. border-radius: 2rpx
  1268. }
  1269. .product-con .nav .money {
  1270. font-size: 28rpx;
  1271. color: #fff;
  1272. }
  1273. .product-con .nav .money .num {
  1274. font-size: 48rpx;
  1275. }
  1276. .product-con .nav .money .y-money {
  1277. font-size: 26rpx;
  1278. margin-left: 10rpx;
  1279. text-decoration: line-through;
  1280. }
  1281. .product-con .nav .timeItem {
  1282. font-size: 20rpx;
  1283. color: #fff;
  1284. text-align: center;
  1285. }
  1286. .product-con .nav .timeItem .timeCon {
  1287. margin-top: 10rpx;
  1288. }
  1289. .product-con .nav .timeItem .timeCon .num {
  1290. padding: 0 7rpx;
  1291. font-size: 22rpx;
  1292. color: #ff3d3d;
  1293. background-color: #fff;
  1294. border-radius: 2rpx;
  1295. }
  1296. .product-con .nav .timeState {
  1297. font-size: 28RPX;
  1298. color: #FFF;
  1299. }
  1300. .product-con .nav .iconfont {
  1301. color: #fff;
  1302. font-size: 30rpx;
  1303. margin-left: 20rpx;
  1304. }
  1305. .product-con .wrapper {
  1306. padding: 32rpx;
  1307. width: 100%;
  1308. box-sizing: border-box;
  1309. }
  1310. .product-con .wrapper .introduce {
  1311. margin: 0;
  1312. }
  1313. .product-con .wrapper .introduce .infor {
  1314. width: 570rpx;
  1315. }
  1316. .product-con .wrapper .introduce .iconfont {
  1317. font-size: 37rpx;
  1318. color: #515151;
  1319. }
  1320. .product-con .wrapper .label {
  1321. margin: 18rpx 0 0 0;
  1322. font-size: 24rpx;
  1323. color: #82848f;
  1324. display: flex;
  1325. justify-content: space-between;
  1326. }
  1327. .product-con .wrapper .label .stock {
  1328. width: 255rpx;
  1329. margin-right: 28rpx;
  1330. }
  1331. .product-con .footer {
  1332. padding: 0 20rpx 0 30rpx;
  1333. position: fixed;
  1334. bottom: 0;
  1335. width: 100%;
  1336. box-sizing: border-box;
  1337. background-color: rgba(255, 255, 255, 0.85);
  1338. backdrop-filter: blur(10px);
  1339. z-index: 277;
  1340. border-top: 1rpx solid #f0f0f0;
  1341. height: 100rpx;
  1342. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1343. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1344. transform: translate3d(0, 100%, 0);
  1345. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  1346. }
  1347. .product-con .footer .item {
  1348. font-size: 18rpx;
  1349. color: #666;
  1350. }
  1351. .product-con .footer .item .iconfont {
  1352. text-align: center;
  1353. font-size: 40rpx;
  1354. }
  1355. .product-con .footer .item .iconfont.icon-shoucang1 {
  1356. color: var(--view-theme);
  1357. }
  1358. .product-con .footer .item .iconfont.icon-gouwuche1 {
  1359. font-size: 40rpx;
  1360. position: relative;
  1361. }
  1362. .product-con .footer .item .iconfont.icon-gouwuche1 .num {
  1363. color: #fff;
  1364. position: absolute;
  1365. font-size: 18rpx;
  1366. padding: 2rpx 8rpx 3rpx;
  1367. border-radius: 200rpx;
  1368. top: -10rpx;
  1369. right: -10rpx;
  1370. }
  1371. .product-con .footer .bnt {
  1372. width: 540rpx;
  1373. height: 76rpx;
  1374. }
  1375. .product-con .footer .bnt .bnts.long-btn{
  1376. width: 540rpx;
  1377. border-radius: 50px;
  1378. }
  1379. .product-con .footer .bnt .bnts {
  1380. width: 270rpx;
  1381. text-align: center;
  1382. line-height: 76rpx;
  1383. color: #fff;
  1384. font-size: 28rpx;
  1385. }
  1386. .product-con .footer .bnt .joinCart {
  1387. border-radius: 50rpx 0 0 50rpx;
  1388. // background-image: linear-gradient(to right, #fea10f 0%, #fa8013 100%);
  1389. background-color: var(--view-bntColor);
  1390. }
  1391. .product-con .footer .bnt .buy {
  1392. border-radius: 0 50rpx 50rpx 0;
  1393. background-color: var(--view-theme);
  1394. // background-image: linear-gradient(to right, #fa6514 0%, #e93323 100%);
  1395. }
  1396. .product-con .conter {
  1397. display: block;
  1398. padding-bottom: 100rpx;
  1399. }
  1400. .product-con .conter img {
  1401. display: block;
  1402. }
  1403. .setCollectBox {
  1404. font-size: 18rpx;
  1405. color: #666;
  1406. }
  1407. .bg-color-hui {
  1408. background: #bbbbbb !important;
  1409. }
  1410. .canvas {
  1411. width: 750px;
  1412. height: 1190px;
  1413. }
  1414. .poster-pop {
  1415. width: 450rpx;
  1416. height: 714rpx;
  1417. position: fixed;
  1418. left: 50%;
  1419. transform: translateX(-50%);
  1420. z-index: 300;
  1421. top: 50%;
  1422. margin-top: -377rpx;
  1423. }
  1424. .poster-pop image {
  1425. width: 100%;
  1426. height: 100%;
  1427. display: block;
  1428. }
  1429. .poster-pop .close {
  1430. width: 46rpx;
  1431. height: 75rpx;
  1432. position: fixed;
  1433. right: 0;
  1434. top: -73rpx;
  1435. display: block;
  1436. }
  1437. .poster-pop .save-poster {
  1438. background-color: #df2d0a;
  1439. font-size: :22rpx;
  1440. color: #fff;
  1441. text-align: center;
  1442. height: 76rpx;
  1443. line-height: 76rpx;
  1444. width: 100%;
  1445. }
  1446. .poster-pop .keep {
  1447. color: #fff;
  1448. text-align: center;
  1449. font-size: 25rpx;
  1450. margin-top: 10rpx;
  1451. }
  1452. /deep/.mask {
  1453. z-index: 99 !important;
  1454. }
  1455. .mask1 {
  1456. position: fixed;
  1457. top: 0;
  1458. left: 0;
  1459. right: 0;
  1460. bottom: 0;
  1461. background-color: #000;
  1462. opacity: .5;
  1463. z-index: 288;
  1464. }
  1465. .home-nav {
  1466. /* #ifdef H5 */
  1467. top: 20rpx !important;
  1468. /* #endif */
  1469. }
  1470. .home-nav {
  1471. color: #333;
  1472. position: fixed;
  1473. /* #ifdef MP */
  1474. width: 126rpx;
  1475. left: 15rpx;
  1476. /* #endif */
  1477. /* #ifndef MP */
  1478. width: 56rpx;
  1479. left: 33rpx;
  1480. /* #endif */
  1481. height: 56rpx;
  1482. font-size: 33rpx;
  1483. z-index: 99;
  1484. background: rgba(255, 255, 255, 0.3);
  1485. border: 1px solid rgba(0, 0, 0, 0.1);
  1486. border-radius: 40rpx;
  1487. &.right {
  1488. right: 33rpx;
  1489. left: unset
  1490. }
  1491. &.on {
  1492. background: unset;
  1493. color: #333;
  1494. }
  1495. &.homeIndex {
  1496. /* #ifdef MP */
  1497. width: 98rpx;
  1498. /* #endif */
  1499. /* #ifndef MP */
  1500. border-color: rgba(255, 255, 255, 0);
  1501. /* #endif */
  1502. }
  1503. }
  1504. .home-nav .iconfont {
  1505. width: 58rpx;
  1506. text-align: center;
  1507. }
  1508. .home-nav .line {
  1509. width: 1rpx;
  1510. height: 34rpx;
  1511. background: #B3B3B3;
  1512. }
  1513. .home-nav .icon-xiangzuo {
  1514. width: auto;
  1515. font-size: 28rpx;
  1516. }
  1517. .share-box {
  1518. z-index: 1000;
  1519. position: fixed;
  1520. left: 0;
  1521. top: 0;
  1522. width: 100%;
  1523. height: 100%;
  1524. }
  1525. .share-box image {
  1526. width: 100%;
  1527. height: 100%;
  1528. }
  1529. .attrImg {
  1530. width: 66rpx;
  1531. height: 66rpx;
  1532. border-radius: 6rpx;
  1533. display: block;
  1534. margin-right: 14rpx;
  1535. }
  1536. .switchTxt {
  1537. height: 60rpx;
  1538. flex: 1;
  1539. line-height: 60rpx;
  1540. box-sizing: border-box;
  1541. background: #eeeeee;
  1542. padding: 0 10rpx;
  1543. border-radius: 8rpx;
  1544. text-align: center;
  1545. }
  1546. .attribute {
  1547. padding: 10rpx 30rpx;
  1548. .line1 {
  1549. width: 600rpx;
  1550. }
  1551. }
  1552. .flex {
  1553. display: flex;
  1554. justify-content: space-between;
  1555. width: 100%;
  1556. }
  1557. .flexs {
  1558. display: flex;
  1559. }
  1560. .attr-txt {
  1561. display: flex;
  1562. flex-wrap: nowrap;
  1563. width: 130rpx;
  1564. }
  1565. </style>