index.vue 49 KB

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