index.vue 48 KB

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