index.vue 48 KB

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