goods_des.vue 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812
  1. <template>
  2. <view class="pageBg" style="background-color: #f7f7f7;">
  3. <!-- 商品图片 -->
  4. <!-- productImages -->
  5. <view class="goods_img_box">
  6. <swiper
  7. class="swiper"
  8. interval="5000"
  9. duration="500"
  10. autoplay="true"
  11. circular="true"
  12. :indicator-dots="base.productImages!==undefined&&base.productImages.length>1"
  13. indicator-color="#E5E5E5"
  14. indicator-active-color="#888888"
  15. >
  16. <block v-if="base.productImages!==undefined&&base.productImages.length>0">
  17. <swiper-item v-for="(item, index) in base.productImages" :key="index">
  18. <image class="image" mode="widthFix" :src="item.large" @tap="roopHeadImage(item.large)"></image>
  19. </swiper-item>
  20. </block>
  21. <block v-else>
  22. <swiper-item><image class="image" mode="widthFix" :src="base.thumbnail || 'http://139.9.103.171:1888/img/image/goods_def.png'"></image></swiper-item>
  23. </block>
  24. </swiper>
  25. </view>
  26. <!-- 商品信息 -->
  27. <view class="goods_info_box margin-bottom-10">
  28. <view class="goods_time_title" style="padding-top: 20rpx;justify-content: space-between;">
  29. <text class="goods_title" selectable="true">{{ base.name ? base.name : '' }}</text>
  30. <image style="width: 76rpx;height: 76rpx;padding-left: 20rpx;" class="share_icon_btn" @tap="shareDrawer" src="http://139.9.103.171:1888/img/image/share_icon.png" mode="widthFix"></image>
  31. </view>
  32. <view class="goods_des">{{ base.caption ? base.caption : '' }}</view>
  33. <view style="padding:0rpx 0 20rpx 30rpx;box-sizing: border-box;" class="flex justify-between">
  34. <view class="">
  35. <text class="text-price" style="color: #2f7ff5;padding-right: 30rpx;font-size: 46rpx;font-weight: 600;">{{ base.price ? base.price : '' }}</text>
  36. <text class="text-price text-gray text-df text-line-through">{{ base.marketPrice ? base.marketPrice : '' }}</text>
  37. </view>
  38. <view class="margin-right-30 padding-top-20 text-gray text-sm">
  39. 库存:{{ defaultAvailableStock }}
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 是否包邮 -->
  44. <view
  45. style="margin-top: 0;"
  46. class="get_coupon"
  47. v-if="
  48. (base != null && base.promotion != null && base.promotion.freeShipping != null && base.promotion.freeShipping.isenabled) ||
  49. (moneyOffsList != null && moneyOffsList.length > 0)
  50. "
  51. >
  52. <view class="get_coupon_text">促销活动</view>
  53. <view class="coupon">
  54. <view class="coupon_list">
  55. <view class="coupon_item">包邮</view>
  56. <view class="coupon_list" v-for="(item, index) in moneyOffsList" :key="index">
  57. <!-- 统一处理方式 -->
  58. <view class="coupon_item" v-if="item.promotionNames.length > 0">{{ item.promotionNames }}</view>
  59. <!-- <view class="coupon_item" v-if="item.discounttype == 0">满{{item.minprice}}减{{item.discounvalue}}</view> -->
  60. <!-- 固定价格 -->
  61. <!-- <view class="coupon_item" v-if="item.discounttype == 1">满{{item.minprice}}减{{item.discounvalue}}</view> -->
  62. <!-- 金额减免 -->
  63. <!-- <view class="coupon_item" v-if="item.discounttype == 2">{{item.minprice > 0 ? '满' + item.minprice : ''}} {{item.discounvalue}}折</view> -->
  64. <!-- 百分比减免 -->
  65. <!-- <view class="coupon_item" v-if="item.discounttype == 3">满{{item.minprice}}减{{item.discounvalue}}</view> -->
  66. <!-- 重复金额减免 -->
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 满减 -->
  72. <!-- <view class="get_coupon" v-if="">
  73. <view class="get_coupon_text">满减</view>
  74. <view class="coupon">
  75. <view class="coupon_list" v-for="(item,index) in moneyOffsList" :key="index">
  76. <view class="coupon_item">满{{item.minprice}}减{{item.discounvalue}}</view>
  77. </view>
  78. </view>
  79. </view> -->
  80. <!-- 赠品 -->
  81. <view class="get_coupon" v-if="giftsList != null && giftsList.length > 0">
  82. <view class="get_coupon_text">赠品</view>
  83. <view class="coupon">
  84. <view class="coupon_list" v-for="(item, index) in giftsList" :key="index">
  85. <view class="coupon_item">{{ item.name }}</view>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 领取优惠券-->
  90. <view class="get_coupon" v-if="base.promotion&&base.promotion.coupon!==undefined&&couponList.length > 0">
  91. <view class="get_coupon_text">领取优惠券</view>
  92. <view class="coupon" @tap="showCouponBox">
  93. <view class="coupon_list">
  94. <view class="coupon_item">{{ base.promotion.coupon.name }}</view>
  95. </view>
  96. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  97. </view>
  98. </view>
  99. <!-- 保障 -->
  100. <view class="get_coupon">
  101. <view class="get_coupon_text ">保障</view>
  102. <view class="coupon">
  103. <view style="font-size: 24upx;margin-right: 20upx;color: #484848;">
  104. 24小时无理由退换货
  105. </view>
  106. </view>
  107. </view>
  108. <!-- 商品详细信息 -->
  109. <view class="goods_detail_info_box">
  110. <view class="goods_detail_tab">
  111. <view :class="['goods_tab_item', current == 0 ? 'good_tab_item_active cur' : '']" @tap="tapTabItem(0)">图文详情</view>
  112. <view :class="['goods_tab_item', current == 1 ? 'good_tab_item_active' : '']" @tap="tapTabItem(1)">商品参数</view>
  113. <view :class="['goods_tab_item', current == 2 ? 'good_tab_item_active' : '']" @tap="tapTabItem(2)">
  114. 商品评价
  115. <text v-if="reviewProdCount > 0">({{ reviewProdCount }})</text>
  116. </view>
  117. </view>
  118. <swiper class="tab_content" :current="current" duration="300" @change="switchTab" :style="{ height: swiper_height }">
  119. <swiper-item>
  120. <view id="start0"></view>
  121. <view class="tab1" v-if="info"><rich-text :nodes="info"></rich-text></view>
  122. <view class="no_data_wrap" v-else><DtNoData msg="暂无数据" /></view>
  123. <view id="end0"></view>
  124. </swiper-item>
  125. <swiper-item>
  126. <view id="start1"></view>
  127. <view class="tab2" v-if="introduction.length > 0">
  128. <view class="goods_params_list">
  129. <view class="goods_params_item" v-for="(item, index) in introduction" :key="index">
  130. <view class="goods_params_title">【{{ item.name }}】</view>
  131. <view class="goods_params_des">{{ item.value }}</view>
  132. </view>
  133. </view>
  134. <view class="check_btn" @tap="jumpmanual">查看完整说明书</view>
  135. </view>
  136. <view class="no_data_wrap" v-else><DtNoData msg="暂无数据" /></view>
  137. <view id="<end1></end1>"></view>
  138. </swiper-item>
  139. <swiper-item>
  140. <view id="start2"></view>
  141. <view class="tab3" v-if="reviewDatas.length > 0">
  142. <DtGoodsComment :dataList="reviewDatas" @tapImage="roopImageClick" />
  143. <view class="check_btn" @tap="moreGoodsComment">查看更多的评价</view>
  144. </view>
  145. <view class="no_data_wrap" v-else><DtNoData msg="暂无数据" /></view>
  146. <view id="end2"></view>
  147. </swiper-item>
  148. </swiper>
  149. </view>
  150. <!--推荐商品-->
  151. <view clsss="recommend" style="background:#F2F2F2">
  152. <DtRecommendWrap title="为您推荐" />
  153. <DtRecommendGoodsList :height="150" :dataList="recommendGoodsList" />
  154. </view>
  155. <!-- 工具栏 -->
  156. <view class="tool_height" :style="footSafe"></view>
  157. <view class="goods_sell_out_tip" v-if="!base.isMarketable">该商品正在补货中,先瞧瞧别的吧~</view>
  158. <view class="goods_tool" :style="footSafe">
  159. <view class="left">
  160. <button
  161. class="item item_btn"
  162. open-type="contact"
  163. session-from="weapp"
  164. :send-message-title="base.name"
  165. :send-message-path="'pagesM/pages/goods_des?id=' + loadOptions.id"
  166. :show-message-card="true"
  167. >
  168. <image src="http://139.9.103.171:1888/img/image/service_concat_icon.png" style="margin-top: -10upx;"></image>
  169. <text>咨询</text>
  170. </button>
  171. <view class="item" @tap="setProductFavorite">
  172. <image src="http://139.9.103.171:1888/img/image/collection_success_icon.png" v-if="isFavorite"></image>
  173. <image src="http://139.9.103.171:1888/img/image/collection_icon.png" v-else></image>
  174. <text>收藏</text>
  175. </view>
  176. <view class="item shop_car" @tap="goToShopCar">
  177. <image src="http://139.9.103.171:1888/img/image/shop_icon.png"></image>
  178. <text>购物车</text>
  179. <view class="tip_count" v-if="shopCartNum > 0">{{ shopCartNum }}</view>
  180. </view>
  181. </view>
  182. <view class="right">
  183. <view class="sell_out" v-if="!base.isMarketable">已售罄</view>
  184. <block v-else>
  185. <view class="item add_shop_car" @tap="joinShopCar">加入购物车</view>
  186. <view class="item buy" @tap="buyNow">{{ base.drugType == 'RX' ? '提交需求' : '立即购买' }}</view>
  187. <!-- <view class="item buy" @tap="buyNow">立即购买</view> -->
  188. </block>
  189. </view>
  190. </view>
  191. <FootGoodsBook
  192. ref="footBook"
  193. :number.sync="number"
  194. :specifications="specifications"
  195. :selectSpecificationValueMaps="selectSpecificationValueMaps"
  196. :base="base"
  197. :selectSkuItemObj="selectSkuItemObj"
  198. @selectsku="selectSku"
  199. @goodsnum="onGoodsNumChange"
  200. @goodsnumblur="blurInputNumber"
  201. @confirm="confirmAddOrBuy"
  202. />
  203. <view v-if="showDistributorCoupon" class="drawer_screen" ></view>
  204. <view v-if="showDistributorCoupon" style="padding: 40upx;width: 400upx;height: 400upx;position: fixed;top: 0;left: 0;right: 0;bottom: 0; margin: auto;background-color: #fc7700;z-index: 10000;border-radius: 20upx;">
  205. <image src="http://139.9.103.171:1888/img/image/close2.png" style="width: 50upx;position: absolute;top: -100upx;right: 0;" mode="widthFix" @tap="showDistributorCoupon=false"></image>
  206. <view style="color: #fff;text-align: center;margin-bottom: 20upx;font-size: 34upx;">恭喜您获得优惠券</view>
  207. <view style="display: flex;position: relative;">
  208. <image src="http://139.9.103.171:1888/img/image/coupon_img_white.png" style="width: 100%;display: block;" mode="widthFix"></image>
  209. <view style="position: absolute;top:0;left:0;right:0;padding: 20upx;display: flex;justify-content: space-between;">
  210. <view>
  211. <view style="font-size: 28upx;line-height: 60upx;">{{distributorCoupon.name}}</view>
  212. <view style="font-size: 20upx;color: gray;line-height: 60upx;">{{distributorCoupon.beginDate}}-{{distributorCoupon.endDate}}</view>
  213. </view>
  214. <view style="margin-right: 20upx;">
  215. <view style="color: red;font-size: 32upx;line-height: 60upx;">¥{{distributorCoupon.amt}}</view>
  216. <view style="font-size: 22upx;color: gray;line-height: 60upx;">{{distributorCoupon.type}}</view>
  217. </view>
  218. </view>
  219. </view>
  220. <button @tap="onRecieve(distributorCoupon)" style="border-radius: 25px;line-height: 80upx;margin-top: 90upx;text-align: center;background-color: #fed116;color: #fc7700;">立即领取</button>
  221. </view>
  222. <!-- 产品优惠券列表 -->
  223. <FootGoodsCoupon ref="footCoupon" :dataList="couponList" @visible="onVisible" @receive="onRecieve" />
  224. <!-- 使用animation属性指定需要执行的动画 -->
  225. <view class="drawer_screen" @tap="closeDrawer" v-if="bg"></view>
  226. <view :animation="animationData" class="drawer_attr_box" v-if="sharediv">
  227. <view class="drawer_content">
  228. <button open-type="share" class="btn">发送给好友</button>
  229. <button @tap="showPoster" class="btn">生成海报</button>
  230. <button @tap="closeDrawer" class="btn detail-cancel-btn">取消</button>
  231. </view>
  232. </view>
  233. <!-- 生成二维码 -->
  234. <tki-qrcode ref="tki_qrcode" :qrval="qrval" @onQrPath="onQrPath"></tki-qrcode>
  235. <!-- 生成海报 -->
  236. <cover-view class="imagePathBox" :hidden="maskHidden == false" v-if="maskHidden">
  237. <cover-view class="shengcheng">
  238. <cover-image src="http://139.9.103.171:1888/img/image/close2.png" class="shareClose" @tap="closePoster"></cover-image>
  239. <cover-image v-if="imagePosterPath" :src="imagePosterPath" class="shengcheng" mode="aspectFill"></cover-image>
  240. </cover-view>
  241. <button class="save" @tap="picdown">保存图片</button>
  242. </cover-view>
  243. <cover-view :hidden="maskHidden == false" class="mask"></cover-view>
  244. <DtPoster ref="dtPoster" id="poster" :config="posterConfig" @success="onPosterSuccess" @fail="onPosterFail" />
  245. <DtLogin ref="dialogLogin" @signIn="onSignIn"/>
  246. </view>
  247. </template>
  248. <script>
  249. import DtGoodsComment from '../comps/dt_goods_comment.vue';
  250. import DtRecommendWrap from '../comps/dt_recommend_wrap.vue';
  251. import DtRecommendGoodsList from '../comps/dt_recommend_goods_list.vue';
  252. import DtNoData from '../comps/dt_no_data.vue';
  253. import DtPoster from '../comps/canvas/poster.vue';
  254. import DtLogin from '../comps/dt_login.vue';
  255. import FootGoodsCoupon from '../comps/foot_goods_coupon.vue';
  256. import FootGoodsBook from '../comps/foot_goods_book.vue';
  257. import tkiQrcode from '../comps/tki_qrcode.vue';
  258. export default {
  259. components: {
  260. DtGoodsComment,
  261. DtNoData,
  262. DtRecommendWrap,
  263. DtRecommendGoodsList,
  264. DtPoster,
  265. DtLogin,
  266. FootGoodsCoupon,
  267. FootGoodsBook,
  268. tkiQrcode
  269. },
  270. data() {
  271. return {
  272. srcollTop:0,
  273. isAutoHeight: true,
  274. selectedTab: 0,
  275. isLogin: false,
  276. imageURL:'http://139.9.103.171:1888/img/image/coupon_img_white.png',
  277. swiper_height: 0,
  278. space: '\xa0\xa0',
  279. isWaitShow: false,
  280. current: 0,
  281. content: '',
  282. showToastBox: false,
  283. bg: false,
  284. sharediv: false,
  285. animationData: '',
  286. posterConfig: {},
  287. imagePosterPath: '',
  288. maskHidden: false,
  289. isclick: false,
  290. reviewProdCount: 0,
  291. productId: 0,
  292. base: {},
  293. reviewDatas: [],
  294. couponList: [],
  295. moneyOffsList: [],
  296. giftsList: [],
  297. goodsDetailInfo: {},
  298. recommendGoodsList: [],
  299. defaultAvailableStock: 0,
  300. isFavorite: false, //是否收藏
  301. number: 1, //购买数量
  302. operationType: 1, //1添加购物车 2立即购买
  303. shopCartNum: 0, //购物车种类数量
  304. skus: [], //选中所有sku的不同情况数组
  305. specifications: [], //所有sku
  306. selectSpecificationValueMaps: {}, //选中sku
  307. selectSkuItemObj: {}, //选中sku对应的情况
  308. waitShow: false,
  309. manual: [],
  310. srcs: [],
  311. imgBox: [],
  312. inviteCode:null, //邀请码id (分销优惠券参数)
  313. showDistributorCoupon:false,
  314. distributorCoupon:null,
  315. qrval:'',
  316. };
  317. },
  318. computed: {
  319. footSafe() {
  320. return 'padding-bottom:' + this.safeAreaBottom + 'px';
  321. },
  322. info() {
  323. let info = this.goodsDetailInfo.info;
  324. if (!info) {
  325. return '';
  326. }
  327. info = info.replace(/style=\"(.*?)\"/gi, '').replace(/<img/g, '<img style="width:100%;"');
  328. return info;
  329. },
  330. introduction() {
  331. let entriesList = [];
  332. if (this.goodsDetailInfo.introduction && this.goodsDetailInfo.introduction.length > 0) {
  333. this.goodsDetailInfo.introduction.forEach(introduction => {
  334. introduction.entries.forEach(item => {
  335. entriesList.push(item);
  336. });
  337. });
  338. }
  339. this.manual = entriesList;
  340. return entriesList.slice(0, 5);
  341. }
  342. },
  343. methods: {
  344. //查看详情
  345. onVisible(ev, idx) {
  346. let couponList = this.couponList.slice(0);
  347. couponList[idx].isShowDetail = !couponList[idx].isShowDetail;
  348. console.log(330, couponList);
  349. this.$set(this, 'couponList', couponList);
  350. },
  351. // 领取优惠券
  352. async onRecieve(item) {
  353. console.log('get Voucher', item);
  354. let memberId = this.$auth.getMemberId();
  355. let resp = await this.$api.couponExchange({
  356. _isShowLoading: true,
  357. memberId: memberId,
  358. couponId: item.id
  359. });
  360. if (resp.result) {
  361. this.showDistributorCoupon = false;
  362. this.$dialog.success('领取成功');
  363. this.getCouponByProductId();
  364. } else {
  365. this.$dialog.error('领取失败');
  366. }
  367. },
  368. /**
  369. * 获取选中的sku对应的对象
  370. * @param {Object} selectSpecificationValueMaps
  371. * @return {Number} -1:组合不存在;1:选择成功;2:库存不足
  372. */
  373. selectSkusItem(selectSpecificationValueMaps) {
  374. let isSelectAll = this.isSelectAllSku(selectSpecificationValueMaps);
  375. if (!isSelectAll) return 1;
  376. let skuItemObjArr = [];
  377. for (let sku of this.skus) {
  378. let num = 0;
  379. for (let spc of sku.specificationValues) {
  380. for (let key in selectSpecificationValueMaps) {
  381. let item = selectSpecificationValueMaps[key];
  382. if (item.id + item.value == spc.id + spc.value) {
  383. num++;
  384. break;
  385. }
  386. }
  387. }
  388. if (num == sku.specificationValues.length) {
  389. if(sku.availableStock <= 0){
  390. return 2;
  391. }
  392. this.selectSkuItemObj = sku;
  393. this.number = sku.wholesaleNumStart;
  394. return 1;
  395. }
  396. }
  397. return -1;
  398. },
  399. selectSku(skuIndex, item) {
  400. if (this.skus != null && this.skus.length > 0) {
  401. let isOk = 0;
  402. for (let sku of this.skus) {
  403. if (sku.specificationValues != null && sku.specificationValues.length > 0) {
  404. for (let s of sku.specificationValues) {
  405. if (s.id + s.value == item.id + item.value) {
  406. let json = JSON.stringify(this.selectSpecificationValueMaps);
  407. let temp = JSON.parse(json);
  408. temp[skuIndex + ''] = { id: item.id, value: item.value };
  409. if(skuIndex == 0 && temp['1'] != null){
  410. this.selectSkuItemObj = {};
  411. this.selectSkuItemObj[skuIndex + ''] = { id: item.id, value: item.value };
  412. this.selectSpecificationValueMaps = {};
  413. this.selectSpecificationValueMaps[skuIndex + ''] = { id: item.id, value: item.value };
  414. this.number = 0;
  415. this.$forceUpdate();
  416. return;
  417. }
  418. isOk = this.selectSkusItem(temp);
  419. if (isOk == 1) {
  420. this.selectSpecificationValueMaps[skuIndex + ''] = { id: item.id, value: item.value };
  421. break;
  422. }else if(isOk == 2) break;
  423. }
  424. }
  425. }
  426. if (isOk > 0) break;
  427. }
  428. if (isOk == -1) uni.showToast({icon: 'none',title: '暂无此商品'});
  429. if (isOk == 2) uni.showToast({icon: 'none',title: '库存不足'});
  430. this.$forceUpdate();
  431. }
  432. },
  433. //是否选完sku的规格
  434. isSelectAllSku(maps) {
  435. if (maps == null) maps = this.selectSpecificationValueMaps;
  436. let length = 0;
  437. for (let key in maps) {
  438. if (maps[key] != null) length++;
  439. }
  440. return length == this.specifications.length;
  441. },
  442. async confirmAddOrBuy() {
  443. if (!this.isSelectAllSku()) {
  444. this.$dialog.toast('请选择所有相关选项!');
  445. return;
  446. }
  447. this.$refs.footBook.hide();
  448. if (this.operationType == 1) {
  449. if (this.shopCartNum >= 100) {
  450. this.$dialog.toast('购物车已满');
  451. return;
  452. }
  453. let dataArr = [];
  454. let data = {};
  455. data.skuId = this.selectSkuItemObj.id;
  456. data.quantity = this.number;
  457. dataArr.push(data);
  458. let res = await this.$api.cartAdds(dataArr);
  459. this.$dialog.toast('添加购物车成功');
  460. this.cartKindCount();
  461. this.$util.refreshPage(['pages/shop_car']);
  462. }
  463. if (this.operationType == 2) {
  464. let data = {};
  465. data.skuId = this.selectSkuItemObj.id;
  466. data.quantity = this.number;
  467. let paramsStr = JSON.stringify(data);
  468. let isCanBuy = await this.$api.checkCartBuy(data);
  469. this.$refs.footBook.hide();
  470. if (isCanBuy) {
  471. let params = {
  472. params: paramsStr,
  473. flag: this.$global.orderFlag.normal
  474. };
  475. uni.navigateTo({
  476. url: '/pagesM/pages/order_confirm?' + this.$util.serialize(params)
  477. });
  478. }
  479. }
  480. this.closeToastBox();
  481. },
  482. //加入购物车
  483. joinShopCar() {
  484. let inviteCode = this.$auth.getInviteCode()
  485. if (!this.$auth.isAuth) {
  486. this.showLogin()
  487. return
  488. }else if(inviteCode!==null){//针对已登录情况
  489. this.showLogin();
  490. return
  491. }
  492. if (this.specifications.length == 0) {
  493. this.$dialog.toast('暂无规格可选');
  494. return;
  495. }
  496. // this.showToastBox = true;
  497. this.$refs.footBook.show();
  498. this.operationType = 1;
  499. },
  500. //立即购买
  501. buyNow() {
  502. let inviteCode = this.$auth.getInviteCode()
  503. if (!this.$auth.isAuth) {
  504. this.showLogin()
  505. return
  506. }else if(inviteCode!==null){//针对已登录情况
  507. this.showLogin();
  508. return
  509. }
  510. if (this.specifications.length == 0) {
  511. this.$dialog.toast('暂无规格可选');
  512. return;
  513. }
  514. // this.showToastBox = true;
  515. this.operationType = 2;
  516. this.$refs.footBook.show();
  517. },
  518. //跳转购物车
  519. goToShopCar() {
  520. let inviteCode = this.$auth.getInviteCode()
  521. if (!this.$auth.isAuth) {
  522. this.showLogin()
  523. return
  524. }else if(inviteCode!==null){//针对已登录情况
  525. this.showLogin();
  526. return
  527. }
  528. uni.navigateTo({
  529. url:'/pagesM/pages/shop_car'
  530. })
  531. },
  532. //领取优惠券
  533. showCouponBox() {
  534. let inviteCode = this.$auth.getInviteCode()
  535. if (!this.$auth.isAuth) {
  536. this.showLogin()
  537. return
  538. }else if(inviteCode!==null){//针对已登录情况
  539. this.showLogin();
  540. return
  541. }
  542. // this.showCouponToastBox = true;
  543. // console.log(this.$refs)
  544. this.$refs.footCoupon.show();
  545. },
  546. //设置收藏
  547. async setProductFavorite() {
  548. let inviteCode = this.$auth.getInviteCode()
  549. if (!this.$auth.isAuth) {
  550. this.showLogin()
  551. return
  552. }else if(inviteCode!==null){//针对已登录情况
  553. this.showLogin();
  554. return
  555. }
  556. let data = {};
  557. data.productId = this.productId;
  558. data.memberId = this.$auth.getMemberId();
  559. let res = await this.$api.setProductFavorite(data);
  560. this.$util.refreshPage(['pages/mine_collection']);
  561. this.isFavorite = res.result;
  562. this.$dialog.toast(res.result ? '收藏成功' : '取消收藏');
  563. },
  564. switchTab(e) {
  565. this.current = e.detail.current;
  566. this.autoHeight();
  567. },
  568. tapTabItem(current) {
  569. this.current = current;
  570. },
  571. autoHeight() {
  572. if(!this.isAutoHeight) return;
  573. let current = this.current;
  574. let _this = this;
  575. uni.createSelectorQuery()
  576. .select('#end' + current)
  577. .boundingClientRect()
  578. .select('#start' + current)
  579. .boundingClientRect()
  580. .exec(rect => {
  581. let top1 = rect == null || rect[0] == null || rect[0].top == null ? 0 : rect[0].top;
  582. let top2 = rect == null || rect[1] == null || rect[1].top == null ? 0 : rect[1].top;
  583. let _space = Math.abs(top1 - top2);
  584. _space = _space === 0 ? '100%' : _space + 'px';
  585. const h = _this.swiper_height;
  586. if(_this.selectedTab != current){
  587. _this.selectedTab = current;
  588. _this.swiper_height = parseFloat(_space) < 500 ? '500px' : _space;
  589. }else if (parseFloat(_this.swiper_height) <= parseFloat(_space)) _this.swiper_height = _space;
  590. // Log.e(`================${_this.base.name}>>>h = ${h}; top1 = ${top1}; top2 = ${top2}; _space = ${_space}`);
  591. _this.$forceUpdate();
  592. setTimeout(() => {
  593. // _this.isAutoHeight = false;
  594. _this.autoHeight();
  595. }, 500);
  596. // if (h != _space) {
  597. // setTimeout(() => {
  598. // _this.isAutoHeight = parseFloat(h) < 500;
  599. // _this.autoHeight();
  600. // }, 400);
  601. // } else if (parseFloat(h) < 500) {
  602. // if (_this.isAutoHeight) {
  603. // setTimeout(() => {
  604. // _this.isAutoHeight = false;
  605. // _this.autoHeight();
  606. // }, 400);
  607. // }
  608. // }
  609. });
  610. },
  611. onGoodsNumChange(delta) {
  612. if (delta < 0) {
  613. if (this.number == 1) {
  614. return;
  615. }
  616. if (this.number <= this.selectSkuItemObj.wholesaleNumStart) {
  617. this.$dialog.toast('该商品起批量为' + this.selectSkuItemObj.wholesaleNumStart);
  618. return;
  619. }
  620. this.number--;
  621. } else {
  622. if (this.number >= this.selectSkuItemObj.purchaseLimit && this.selectSkuItemObj.purchaseLimit > 0) {
  623. return;
  624. }
  625. if (this.number >= this.selectSkuItemObj.availableStock) {
  626. this.$dialog.toast('该商品库存不足');
  627. return;
  628. }
  629. this.number++;
  630. }
  631. },
  632. lessAction() {
  633. if (this.number == 1) {
  634. return;
  635. }
  636. if (this.number <= this.selectSkuItemObj.wholesaleNumStart) {
  637. this.$dialog.toast('该商品起批量为' + this.selectSkuItemObj.wholesaleNumStart);
  638. return;
  639. }
  640. this.number--;
  641. },
  642. addAction() {
  643. if (this.number >= this.selectSkuItemObj.purchaseLimit && this.selectSkuItemObj.purchaseLimit > 0) {
  644. return;
  645. }
  646. if (this.number >= this.selectSkuItemObj.availableStock) {
  647. this.$dialog.toast('该商品库存不足');
  648. return;
  649. }
  650. this.number++;
  651. },
  652. blurInputNumber(e) {
  653. let number = e.detail.value ? e.detail.value : 1;
  654. if (this.selectSkuItemObj.wholesaleNumStart) {
  655. let wholesaleNumStart = this.selectSkuItemObj.wholesaleNumStart;
  656. let availableStock = this.selectSkuItemObj.availableStock;
  657. if (number < wholesaleNumStart) {
  658. this.number = wholesaleNumStart;
  659. this.$dialog.toast('该商品起批量为' + wholesaleNumStart);
  660. return;
  661. }
  662. if (number > availableStock) {
  663. this.number = wholesaleNumStart;
  664. this.$dialog.toast('该商品库存不足');
  665. return;
  666. }
  667. this.number = number;
  668. } else {
  669. this.number = number;
  670. }
  671. },
  672. closeToastBox() {
  673. this.showToastBox = false;
  674. },
  675. shareDrawer() {
  676. this.animationDrawer("open")
  677. // this.shareFriend();
  678. },
  679. closeDrawer() {
  680. this.isclick = false;
  681. this.animationDrawer('close');
  682. },
  683. shareFriend() {
  684. this.bg = false;
  685. this.sharediv = false;
  686. this.isclick = false;
  687. uni.showShareMenu({
  688. withShareTicket: true
  689. });
  690. },
  691. animationDrawer(currentStatu) {
  692. /* 动画部分 */
  693. // 第1步:创建动画实例
  694. var animation = wx.createAnimation({
  695. duration: 200, //动画时长
  696. timingFunction: 'linear', //线性
  697. delay: 0 //0则不延迟
  698. });
  699. // 第2步:这个动画实例赋给当前的动画实例
  700. this.animation = animation;
  701. // 第3步:执行第一组动画:Y轴偏移240px后(盒子高度是240px),停
  702. animation.translateY(240).step();
  703. // 第4步:导出动画对象赋给数据对象储存
  704. this.animationData = animation.export();
  705. // 第5步:设置定时器到指定时候后,执行第二组动画
  706. setTimeout(
  707. function() {
  708. // 执行第二组动画:Y轴不偏移,停
  709. animation.translateY(0).step();
  710. // 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
  711. this.animationData = animation;
  712. //关闭抽屉
  713. if (currentStatu == 'close') {
  714. this.bg = false;
  715. this.sharediv = false;
  716. }
  717. }.bind(this),
  718. 200
  719. );
  720. // 显示抽屉
  721. if (currentStatu == 'open') {
  722. this.bg = true;
  723. this.sharediv = true;
  724. }
  725. },
  726. showPoster() {
  727. this.$u.toast('未开放')
  728. return
  729. if (this.isclick) {
  730. return;
  731. }
  732. this.isclick = true;
  733. // 获取页面path
  734. let pages = getCurrentPages(); //获取加载的页面
  735. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  736. let inviteCode = null;
  737. let resp = this.$auth.getMemberInfo();
  738. if(this.$auth.isPromoter(true)){
  739. inviteCode = this.$auth.getMemberId();
  740. }
  741. let path = `https://wap.lezhuapp.com/wapp/qrcode/`;
  742. let param = encodeURI(`type=share&id=${this.base.id}&storeId=${this.base.store.id}&path=${currentPage.route}&inviteCode=${inviteCode}`)
  743. this.qrval = path + param;
  744. this.$refs.tki_qrcode.ifQrcode()
  745. },
  746. onQrPath(res){
  747. console.log(res)
  748. this.drawPoster(res);
  749. },
  750. drawPoster(res) {
  751. this.$set(this, 'posterConfig', {
  752. width: 750,
  753. height: 1334,
  754. backgroundColor: '#ffffff',
  755. debug: true,
  756. pixelRatio: 2,
  757. preload: true,
  758. images: [
  759. {
  760. x: 35,
  761. y: 60,
  762. width: 680,
  763. height: 850,
  764. url: this.base.thumbnail || 'http://139.9.103.171:1888/img/image/goods_def.png',
  765. zIndex: 2
  766. },
  767. {
  768. x: 510,
  769. y: 1000,
  770. width: 200,
  771. height: 200,
  772. url: res,
  773. zIndex: 2,
  774. type:'qrcode'
  775. }
  776. ],
  777. texts: [
  778. {
  779. x: 35,
  780. y: 1000,
  781. text: this.base.name,
  782. fontSize: 30,
  783. color: '#333333',
  784. lineHeight: 50,
  785. lineNum: 3,
  786. textAlign: 'left',
  787. fontFamily: 'SourceHanSansRegular',
  788. zIndex: 11,
  789. width: 400
  790. },
  791. {
  792. x: 35,
  793. y: 1200,
  794. text: '¥' + this.base.price,
  795. fontSize: 60,
  796. color: '#D32222',
  797. lineHeight: 50,
  798. lineNum: 3,
  799. textAlign: 'left',
  800. fontFamily: 'SourceHanSansRegular',
  801. zIndex: 11,
  802. width: 400
  803. }
  804. ]
  805. });
  806. this.$nextTick(() => {
  807. this.$refs.dtPoster.onCreate();
  808. });
  809. },
  810. closePoster() {
  811. this.maskHidden = false;
  812. this.isclick = false;
  813. this.$refs.tki_qrcode.ifQrcode()
  814. },
  815. onPosterSuccess(path) {
  816. this.imagePosterPath = path;
  817. this.maskHidden = true;
  818. this.isclick = false;
  819. },
  820. onPosterFail(e) {
  821. this.isclick = false;
  822. },
  823. picdown() {
  824. uni.saveImageToPhotosAlbum({
  825. filePath: this.imagePosterPath,
  826. success: res => {
  827. console.log(res);
  828. this.$dialog.success('图片已保存到相册,赶紧晒一下吧');
  829. this.maskHidden = false;
  830. this.sharediv = false;
  831. this.bg = false;
  832. this.isclick = false;
  833. },
  834. fail: res => {
  835. if (res.errMsg == 'saveImageToPhotosAlbum:fail cancel') {
  836. return;
  837. }
  838. if (res.errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
  839. this.$dialog.confirm({
  840. content: '需要使用保存图片或视频到系统相册功能,请确认授权打开',
  841. showCancel: false,
  842. success: confirmRes => {}
  843. });
  844. }
  845. }
  846. });
  847. },
  848. // 通过商品id获取优惠券列表
  849. async getCouponByProductId() {
  850. let memberId = this.$auth.getMemberId();
  851. let data = {};
  852. data.productId = this.base.id;
  853. data.memberId = memberId;
  854. let resp = await this.$api.getCouponByProductId(data);
  855. console.log(resp);
  856. this.couponList = resp;
  857. return resp;
  858. },
  859. //通过商品id获取分销优惠券列表
  860. async getDistributorCoupon(){
  861. let memberId = this.$auth.getMemberId();
  862. let data = {};
  863. data.productId = this.productId;
  864. // data.inviteCode = this.inviteCode;
  865. data.memberId = memberId;
  866. let resp = await this.$api.getDistributorCouponByProductId(data);
  867. if(JSON.stringify(resp) == '{}'||resp==''||resp==null||resp==undefined){return;}
  868. this.distributorCoupon = resp;
  869. this.distributorCoupon.beginDate = resp.beginDate.substr(0,10);
  870. this.distributorCoupon.endDate = resp.endDate.substr(0,10);
  871. this.showDistributorCoupon = true;
  872. },
  873. // 获取商品详情推荐商品
  874. async getRecommendProduct() {
  875. let data = {};
  876. data.productId = this.base.id;
  877. data.productCategoryId = this.base.productCategoryId;
  878. let resp = await this.$api.getRecommendProduct(data);
  879. this.recommendGoodsList = resp.store;
  880. return resp;
  881. },
  882. // 获取商品详情
  883. async findProductInfoById() {
  884. let memberId = this.$auth.getMemberId();
  885. let resp = await this.$api.findProductInfoById({
  886. _isShowLoading: true,
  887. productId: this.productId,
  888. memberId: memberId
  889. });
  890. console.log(502, resp);
  891. this.base = resp.base; // 基本信息
  892. let imgBox = [];
  893. for (let i = 0; i < this.base.productImages.length; i++) {
  894. imgBox.push(this.base.productImages[i].large);
  895. }
  896. this.imgBox = imgBox;
  897. this.skus = resp.base.skus.skus; //不同情况
  898. let specifications = resp.base.skus.specifications; //sku规格
  899. if (specifications != null && specifications.length > 0) {
  900. let isOk = false;
  901. for (var i = 0; i < specifications[0].entries.length; i++) {
  902. specifications[0].entries[i].isExit = false;
  903. for (let sku of this.skus) {
  904. if (sku.specificationValues != null && sku.specificationValues.length > 0) {
  905. for (let sv of sku.specificationValues) {
  906. if (specifications[0].entries[i].id == sv.id) {
  907. specifications[0].entries[i].isExit = true;
  908. break;
  909. }
  910. }
  911. }
  912. if (specifications[0].entries[i].isExit == true) break;
  913. }
  914. }
  915. }
  916. this.specifications = specifications;
  917. this.moneyOffsList = resp.base.promotion.moneyOffs;
  918. this.giftsList = resp.base.promotion.gifts;
  919. let defaultSkus = this.skus.filter(item => {
  920. return item.isDefault;
  921. });
  922. this.defaultAvailableStock = defaultSkus[0].availableStock;
  923. if (this.specifications.length == 0) {
  924. this.selectSkuItemObj = Object.assign({}, defaultSkus[0]);
  925. this.number = this.selectSkuItemObj.wholesaleNumStart;
  926. }
  927. this.shopCartNum = this.base.cartNum;
  928. this.number = this.base.wholesaleNumStart;
  929. this.isFavorite = this.base.isFavorite;
  930. this.goodsDetailInfo = resp;
  931. setTimeout(() => {
  932. this.autoHeight();
  933. }, 100);
  934. this.getRecommendProduct()
  935. this.getCouponByProductId()
  936. this.waitShow = true;
  937. return resp;
  938. },
  939. //获取购物车商品种类
  940. async cartKindCount() {
  941. let resp = await this.$api.cartKindCount();
  942. this.shopCartNum = resp.kindCount;
  943. },
  944. //获取评论
  945. async getReviewList() {
  946. let data = {};
  947. data.pageNo = 1;
  948. data.pageSize = 1;
  949. data.productId = this.productId;
  950. data.type = '';
  951. let res = await this.$api.getReviewList(data);
  952. console.log(res);
  953. let srcs = [];
  954. for (let i in res.datas) {
  955. res.datas[i].imageUrls = JSON.parse(res.datas[i].imageUrls);
  956. srcs = srcs.concat(res.datas[i].imageUrls);
  957. }
  958. this.srcs = srcs;
  959. this.reviewDatas = res.datas;
  960. return res;
  961. },
  962. roopHeadImage(img) {
  963. uni.previewImage({
  964. current: img, // 当前显示图片的http链接
  965. urls: this.imgBox // 需要预览的图片http链接列表
  966. });
  967. },
  968. roopImageClick(img) {
  969. uni.previewImage({
  970. current: img, // 当前显示图片的http链接
  971. urls: this.srcs // 需要预览的图片http链接列表
  972. });
  973. },
  974. //查看更多评价
  975. moreGoodsComment() {
  976. uni.navigateTo({
  977. url: '/pagesM/pages/goods_comment_list?productId=' + this.productId
  978. });
  979. },
  980. //查看说明书
  981. jumpmanual() {
  982. uni.navigateTo({
  983. url: '/pagesM/pages/goods_manual'
  984. });
  985. },
  986. showLogin() {
  987. this.$refs.dialogLogin.show();
  988. },
  989. onSignIn(resp) {
  990. this.$util.refreshPage(['pages/home', 'pages/shop_car', 'pages/mine']);
  991. this.onPullDownRefreshPage();
  992. },
  993. // 获取总数
  994. async reviewProductCount() {
  995. let resp = await this.$api.reviewProductCount({
  996. productId: this.productId
  997. });
  998. this.reviewProdCount = resp;
  999. return resp;
  1000. },
  1001. onLoadPage(options) {
  1002. wx.hideShareMenu();
  1003. this.productId = options.id ? options.id : 0;
  1004. let inviteCode = options.inviteCode? options.inviteCode:null;
  1005. this.$auth.setInviteCode(inviteCode);
  1006. this.findProductInfoById()
  1007. this.getReviewList()
  1008. this.reviewProductCount()
  1009. }
  1010. },
  1011. onShow() {
  1012. this.isAutoHeight = true;
  1013. this.autoHeight();
  1014. },
  1015. onLoad() {
  1016. wx.showShareMenu({
  1017. withShareTicket: true
  1018. })
  1019. },
  1020. onShareAppMessage(res) {
  1021. // if (res.from === 'button') {
  1022. let pages = getCurrentPages(); //获取加载的页面
  1023. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  1024. let inviteCode = null;
  1025. let resp = this.$auth.getMemberInfo();
  1026. if(this.$auth.isPromoter(true)){
  1027. inviteCode = this.$auth.getMemberId();
  1028. }
  1029. let path = `/pages/index/index?type=share&id=${this.base.id}&storeId=${this.base.store.id}&path=${currentPage.route}&inviteCode=${inviteCode}`;
  1030. console.error('path = ' + path);
  1031. return {
  1032. title: this.base.name,
  1033. path: path,
  1034. success(res) {
  1035. // 转发成功
  1036. console.log('转发成功');
  1037. },
  1038. fail(res) {
  1039. // 转发失败
  1040. console.log('转发失败');
  1041. }
  1042. };
  1043. // }
  1044. },
  1045. onHide() {
  1046. this.isAutoHeight = false;
  1047. },
  1048. onUnload() {
  1049. this.isAutoHeight = false;
  1050. }
  1051. };
  1052. </script>
  1053. <style lang="scss" scoped>
  1054. .cu-bar.tabbar.shop .action {
  1055. width: 116rpx;
  1056. -webkit-box-flex: initial;
  1057. -webkit-flex: initial;
  1058. flex: initial;
  1059. }
  1060. .cu-tag.badge {
  1061. border-radius: 100px;
  1062. position: absolute;
  1063. top: -5px;
  1064. right: -2px;
  1065. font-size: 10px;
  1066. padding: 0px 6rpx;
  1067. height: 14px;
  1068. color: #ffffff;
  1069. }
  1070. view,
  1071. scroll-view,
  1072. swiper,
  1073. button,
  1074. input,
  1075. textarea,
  1076. label,
  1077. navigator,
  1078. image {
  1079. box-sizing: border-box;
  1080. }
  1081. .goods_img_box {
  1082. height: 750upx;
  1083. background: #fff;
  1084. .swiper {
  1085. height: 100%;
  1086. width: 100%;
  1087. image {
  1088. width: 100%;
  1089. height: 100%;
  1090. }
  1091. }
  1092. }
  1093. .goods_info_box {
  1094. display: flex;
  1095. flex-direction: column;
  1096. background: #fff;
  1097. .goods_price_share {
  1098. display: flex;
  1099. flex-direction: row;
  1100. justify-content: space-between;
  1101. align-items: center;
  1102. padding: 0 30upx;
  1103. .price {
  1104. flex: 1;
  1105. .sell_price {
  1106. color: #ee1515;
  1107. font-size: 48upx;
  1108. }
  1109. .original_price {
  1110. color: #999999;
  1111. font-size: 26upx;
  1112. text-decoration: line-through;
  1113. margin-left: 20upx;
  1114. }
  1115. }
  1116. .share_icon_btn {
  1117. width: 70upx;
  1118. height: 70upx;
  1119. // padding: 20upx 0;
  1120. // padding-left: 20upx;
  1121. .share_icon {
  1122. width: 70upx;
  1123. height: 70upx;
  1124. }
  1125. }
  1126. }
  1127. .goods_time_title {
  1128. line-height: 48rpx;
  1129. display: flex;
  1130. flex-direction: row;
  1131. position: relative;
  1132. padding: 0 30upx;
  1133. word-wrap: break-all;
  1134. align-items: center;
  1135. .goods_title {
  1136. font-weight: 600;
  1137. flex: 1;
  1138. font-size: 34upx;
  1139. color: #333;
  1140. display: flex;
  1141. flex-direction: row;
  1142. align-items: center;
  1143. text-align: justify;
  1144. }
  1145. .goods_time {
  1146. position: absolute;
  1147. left: 30upx;
  1148. top: 6upx;
  1149. background: $dt-color-primary;
  1150. font-size: 18upx;
  1151. color: #fff;
  1152. border-radius: 4upx;
  1153. padding: 5upx 10upx;
  1154. height: 28upx;
  1155. display: flex;
  1156. align-items: center;
  1157. }
  1158. }
  1159. .goods_tip {
  1160. padding: 10upx 30upx;
  1161. font-size: 0.7rem;
  1162. color: #f04d0d;
  1163. }
  1164. .goods_active {
  1165. display: flex;
  1166. flex-direction: row;
  1167. align-items: center;
  1168. flex-wrap: wrap;
  1169. margin-top: 20upx;
  1170. padding: 0 30upx;
  1171. .active_item {
  1172. // border: 1upx solid #ee1515;
  1173. // border-radius: 4upx;
  1174. padding: 5upx 10upx;
  1175. color: #ee1515;
  1176. font-size: 20upx;
  1177. margin-right: 20upx;
  1178. position: relative;
  1179. margin-bottom: 10upx;
  1180. }
  1181. .active_item::after {
  1182. display: flex;
  1183. box-sizing: border-box;
  1184. align-items: center;
  1185. content: '';
  1186. position: absolute;
  1187. top: 0;
  1188. left: 0;
  1189. width: 200%;
  1190. height: 200%;
  1191. transform: scale(0.5);
  1192. transform-origin: 0 0;
  1193. border: 1upx solid #ee1515;
  1194. border-radius: 4upx;
  1195. pointer-events: none;
  1196. }
  1197. }
  1198. .goods_des {
  1199. color: #8b8b8b;
  1200. font-size: 28upx;
  1201. padding: 20upx 30upx 30rpx ;
  1202. }
  1203. .goods_inventory_sales {
  1204. font-size: 24upx;
  1205. color: #999;
  1206. display: flex;
  1207. flex-direction: row;
  1208. align-items: center;
  1209. padding: 20upx 30upx;
  1210. border-top: 1upx solid #e5e5e5;
  1211. text {
  1212. width: 30%;
  1213. }
  1214. }
  1215. }
  1216. .get_coupon {
  1217. background: #fff;
  1218. padding: 20upx 30upx;
  1219. display: flex;
  1220. flex-direction: row;
  1221. align-items: center;
  1222. justify-content: space-between;
  1223. .get_coupon_text {
  1224. color: #333;
  1225. font-size: 28upx;
  1226. }
  1227. .coupon {
  1228. display: flex;
  1229. flex-direction: row;
  1230. align-items: center;
  1231. .coupon_list {
  1232. display: flex;
  1233. flex-direction: row;
  1234. align-items: center;
  1235. color: #2f7ff5;
  1236. font-size: 20upx;
  1237. .coupon_item {
  1238. position: relative;
  1239. padding: 10upx 20upx;
  1240. margin-right: 20upx;
  1241. }
  1242. .coupon_item::after {
  1243. display: flex;
  1244. box-sizing: border-box;
  1245. align-items: center;
  1246. content: '';
  1247. position: absolute;
  1248. top: 0;
  1249. left: 0;
  1250. width: 200%;
  1251. height: 200%;
  1252. transform: scale(0.5);
  1253. transform-origin: 0 0;
  1254. border: 1upx solid #2f7ff5;
  1255. border-radius: 12rpx;
  1256. pointer-events: none;
  1257. }
  1258. }
  1259. image {
  1260. width: 10upx;
  1261. height: 18upx;
  1262. }
  1263. }
  1264. }
  1265. .goods_detail_info_box {
  1266. margin-top: 10upx;
  1267. background: #fff;
  1268. .goods_detail_tab {
  1269. display: flex;
  1270. flex-direction: row;
  1271. align-items: center;
  1272. justify-content: space-around;
  1273. padding: 0 20upx;
  1274. .goods_tab_item {
  1275. flex: 1;
  1276. color: #666666;
  1277. font-size: 28upx;
  1278. padding: 20upx 0;
  1279. text-align: center;
  1280. }
  1281. .good_tab_item_active {
  1282. color: $base;
  1283. }
  1284. }
  1285. .tab_content {
  1286. .tab2 {
  1287. .goods_params_list {
  1288. display: flex;
  1289. flex-direction: column;
  1290. padding: 20upx 20upx 0 20upx;
  1291. .goods_params_item {
  1292. display: flex;
  1293. flex-direction: row;
  1294. margin-bottom: 30upx;
  1295. .goods_params_title {
  1296. color: #666666;
  1297. font-size: 28upx;
  1298. }
  1299. .goods_params_des {
  1300. flex: 1;
  1301. font-size: 28upx;
  1302. color: #333333;
  1303. }
  1304. }
  1305. }
  1306. .check_btn {
  1307. width: 600upx;
  1308. height: 60upx;
  1309. margin: 0 auto;
  1310. margin-bottom: 40upx;
  1311. line-height: 60upx;
  1312. text-align: center;
  1313. font-size: 26upx;
  1314. color: #666666;
  1315. border: 1upx solid #ccc;
  1316. }
  1317. }
  1318. .tab3 {
  1319. .check_btn {
  1320. width: 600upx;
  1321. height: 60upx;
  1322. margin: 0 auto;
  1323. margin-bottom: 40upx;
  1324. line-height: 60upx;
  1325. text-align: center;
  1326. font-size: 26upx;
  1327. color: #666666;
  1328. border: 1upx solid #ccc;
  1329. }
  1330. }
  1331. .no_data_wrap {
  1332. max-height: 300upx;
  1333. min-height: 300upx;
  1334. display: flex;
  1335. flex-direction: column;
  1336. align-items: center;
  1337. justify-content: center;
  1338. }
  1339. }
  1340. }
  1341. .tool_height {
  1342. height: 150upx;
  1343. }
  1344. .goods_tool {
  1345. display: flex;
  1346. height: 90upx;
  1347. position: fixed;
  1348. bottom: 0;
  1349. left: 0;
  1350. width: 100%;
  1351. background-color: #fff;
  1352. .left {
  1353. width: fit-content;
  1354. display: flex;
  1355. flex-direction: row;
  1356. align-items: center;
  1357. // border-top: 1upx solid #ccc;
  1358. background: #fff;
  1359. box-sizing: border-box;
  1360. height: 100%;
  1361. button {
  1362. line-height: 1;
  1363. }
  1364. .item {
  1365. display: flex;
  1366. flex-direction: column;
  1367. align-items: center;
  1368. width: 110upx;
  1369. // border-right: 1upx solid #ccc;
  1370. // border-bottom: 1upx solid #ccc;
  1371. border-radius: 0;
  1372. box-sizing: border-box;
  1373. height: 100%;
  1374. justify-content: center;
  1375. image {
  1376. width: 35upx;
  1377. height: 35upx;
  1378. margin-bottom: 5upx;
  1379. }
  1380. text {
  1381. color: #747774;
  1382. font-size: 20upx;
  1383. }
  1384. }
  1385. .item:last-child {
  1386. border-right: none;
  1387. }
  1388. .shop_car {
  1389. position: relative;
  1390. .tip_count {
  1391. position: absolute;
  1392. right: 22upx;
  1393. top: 5rpx;
  1394. width: 24upx;
  1395. height: 24upx;
  1396. border-radius: 50%;
  1397. background-color: #f37b1d;
  1398. color: #fff;
  1399. font-size: 18upx;
  1400. text-align: center;
  1401. line-height: 24upx;
  1402. }
  1403. }
  1404. }
  1405. .right {
  1406. flex: 1;
  1407. display: flex;
  1408. flex-direction: row;
  1409. align-items: center;
  1410. .item {
  1411. width: 50%;
  1412. height: 90upx;
  1413. font-size: 28upx;
  1414. color: #fff;
  1415. display: flex;
  1416. align-items: center;
  1417. justify-content: center;
  1418. }
  1419. .add_shop_car {
  1420. background: #1e9edf;
  1421. }
  1422. .buy {
  1423. background: #2f7ff5;
  1424. }
  1425. .sell_out {
  1426. width: 100%;
  1427. height: 90upx;
  1428. font-size: 28upx;
  1429. color: #fff;
  1430. display: flex;
  1431. align-items: center;
  1432. justify-content: center;
  1433. background: #9fdff4;
  1434. }
  1435. }
  1436. }
  1437. .goods_sell_out_tip {
  1438. color: #ffffff;
  1439. font-size: 22upx;
  1440. background: rgba(0, 0, 0, 0.4);
  1441. position: fixed;
  1442. bottom: 90upx;
  1443. left: 0;
  1444. width: 100%;
  1445. text-align: center;
  1446. padding: 8upx 0;
  1447. }
  1448. .toast_box {
  1449. position: fixed;
  1450. height: 100%;
  1451. width: 100%;
  1452. z-index: 101;
  1453. left: 0;
  1454. bottom: 0upx;
  1455. background: rgba(0, 0, 0, 0.5);
  1456. display: flex;
  1457. flex-direction: column;
  1458. justify-content: space-between;
  1459. .toast_content {
  1460. background: white;
  1461. border-top-left-radius: 20upx;
  1462. border-top-right-radius: 20upx;
  1463. position: fixed;
  1464. width: 100%;
  1465. bottom: 0upx;
  1466. .goods_img_price_wrap {
  1467. display: flex;
  1468. flex-direction: row;
  1469. align-items: center;
  1470. padding: 30upx 0;
  1471. border-bottom: 1 solid #e5e5e5;
  1472. .goods_img {
  1473. height: 120upx;
  1474. width: 120upx;
  1475. padding-left: 30upx;
  1476. image {
  1477. width: 120upx;
  1478. height: 120upx;
  1479. }
  1480. }
  1481. .goods_price_box {
  1482. display: flex;
  1483. flex-direction: column;
  1484. justify-content: space-around;
  1485. height: 120upx;
  1486. padding-left: 28upx;
  1487. .price {
  1488. display: flex;
  1489. flex-direction: row;
  1490. align-items: center;
  1491. text {
  1492. padding-left: 10upx;
  1493. padding-top: 7upx;
  1494. font-size: 48upx;
  1495. color: #2f7ff5;
  1496. }
  1497. }
  1498. .sku_params {
  1499. font-size: 24upx;
  1500. color: #999;
  1501. }
  1502. .count_num {
  1503. font-size: 24upx;
  1504. color: #999;
  1505. }
  1506. }
  1507. }
  1508. .goods-sku-list-wrap {
  1509. display: flex;
  1510. flex-direction: column;
  1511. .sku_item {
  1512. padding: 0 30upx;
  1513. .sku_name {
  1514. font-size: 24upx;
  1515. color: #333;
  1516. padding: 20upx 0upx;
  1517. }
  1518. .sku_value_box {
  1519. display: flex;
  1520. flex-wrap: wrap;
  1521. flex-direction: row;
  1522. text {
  1523. font-size: 26upx;
  1524. color: #333;
  1525. padding: 10upx 20upx;
  1526. margin-right: 15upx;
  1527. border: 2upx solid #ebebeb;
  1528. opacity: 0.6;
  1529. border-radius: 5px;
  1530. margin-bottom: 10upx;
  1531. }
  1532. .active {
  1533. background-color: $dt-color-primary;
  1534. border: 2upx solid $dt-color-primary;
  1535. color: #fff;
  1536. opacity: 1;
  1537. }
  1538. .disabled {
  1539. background-color: #e5e5e5;
  1540. color: #ccc;
  1541. opacity: 1;
  1542. }
  1543. }
  1544. }
  1545. }
  1546. .goods_num_select_wrap {
  1547. display: flex;
  1548. flex-direction: row;
  1549. justify-content: space-between;
  1550. align-items: center;
  1551. padding: 20upx 30upx 30upx 30upx;
  1552. .num_text {
  1553. font-size: 24upx;
  1554. color: rgb(51, 51, 51);
  1555. }
  1556. .number_select {
  1557. height: 50upx;
  1558. border-radius: 6upx;
  1559. border: 2upx solid #e5e5e5;
  1560. display: flex;
  1561. flex-direction: row;
  1562. align-items: center;
  1563. justify-content: space-around;
  1564. width: 200upx;
  1565. .number_change_less {
  1566. width: 60upx;
  1567. text-align: center;
  1568. border-right: 2upx solid #e5e5e5;
  1569. height: 100%;
  1570. line-height: 50upx;
  1571. font-size: 36upx;
  1572. }
  1573. .number_change_add {
  1574. width: 60upx;
  1575. text-align: center;
  1576. border-left: 2upx solid #e5e5e5;
  1577. height: 100%;
  1578. line-height: 50upx;
  1579. font-size: 36upx;
  1580. }
  1581. .goods_number {
  1582. width: 60upx;
  1583. padding: 0 10upx;
  1584. text-align: center;
  1585. font-size: 36upx;
  1586. color: #353535;
  1587. }
  1588. }
  1589. }
  1590. .comfirm_btn_box {
  1591. margin: 80upx 40upx;
  1592. button {
  1593. color: #fff;
  1594. border-radius: 6upx;
  1595. text-align: center;
  1596. background: $dt-color-primary;
  1597. }
  1598. }
  1599. .toastDelete {
  1600. position: absolute;
  1601. width: 30upx;
  1602. height: 30upx;
  1603. right: 10upx;
  1604. top: 0upx;
  1605. padding: 20upx;
  1606. }
  1607. }
  1608. .toast_coupon_content {
  1609. min-height: 800upx;
  1610. height: auto;
  1611. background: #f2f2f2;
  1612. position: fixed;
  1613. width: 100%;
  1614. bottom: 0upx;
  1615. border-top-left-radius: 20upx;
  1616. border-top-right-radius: 20upx;
  1617. .title {
  1618. color: #333333;
  1619. text-align: center;
  1620. font-size: 30upx;
  1621. height: 100upx;
  1622. line-height: 100upx;
  1623. background: #fff;
  1624. }
  1625. .coupon_wrap_list {
  1626. display: flex;
  1627. flex-direction: column;
  1628. align-items: center;
  1629. .coupon_height {
  1630. height: 20upx;
  1631. }
  1632. }
  1633. .toastDelete {
  1634. position: absolute;
  1635. width: 30upx;
  1636. height: 30upx;
  1637. right: 10upx;
  1638. top: 15upx;
  1639. padding: 20upx;
  1640. }
  1641. }
  1642. }
  1643. .drawer_screen {
  1644. width: 100%;
  1645. height: 100%;
  1646. position: fixed;
  1647. top: 0;
  1648. left: 0;
  1649. z-index: 1000;
  1650. background: #000;
  1651. opacity: 0.2;
  1652. overflow: hidden;
  1653. }
  1654. .drawer_attr_box {
  1655. width: 100%;
  1656. overflow: hidden;
  1657. position: fixed;
  1658. bottom: 0;
  1659. left: 0;
  1660. z-index: 1001;
  1661. background: rgb(242, 242, 242);
  1662. .drawer_content {
  1663. overflow-y: scroll;
  1664. .btn {
  1665. background: #fff;
  1666. font-size: 30upx;
  1667. color: rgb(51, 51, 51);
  1668. border-bottom: 1px solid #e8e8e8;
  1669. border-radius: 0;
  1670. padding: 12upx 0;
  1671. }
  1672. .btn::after {
  1673. border: none;
  1674. }
  1675. .detail-cancel-btn {
  1676. margin-top: 10upx;
  1677. }
  1678. }
  1679. }
  1680. .imagePathBox {
  1681. width: 100%;
  1682. height: 100%;
  1683. background: rgba(0, 0, 0, 0.7);
  1684. position: fixed;
  1685. top: 0;
  1686. left: 0;
  1687. right: 0;
  1688. bottom: 0;
  1689. z-index: 1200;
  1690. .save {
  1691. display: block;
  1692. width: 80%;
  1693. height: 80upx;
  1694. padding: 0;
  1695. line-height: 80upx;
  1696. text-align: center;
  1697. position: fixed;
  1698. z-index: 1200;
  1699. top: 1000upx;
  1700. left: 10%;
  1701. background: $dt-color-primary;
  1702. color: #fff;
  1703. font-size: 30upx;
  1704. border-radius: 10upx;
  1705. }
  1706. .save::after {
  1707. border: 0 !important;
  1708. }
  1709. }
  1710. .shengcheng {
  1711. width: 600upx;
  1712. height: 900upx;
  1713. position: fixed;
  1714. top: 100upx;
  1715. left: 50%;
  1716. z-index: 1200;
  1717. border-radius: 10upx;
  1718. transform: translate(-50%);
  1719. margin-top: -50upx;
  1720. .shareClose {
  1721. text-align: center;
  1722. position: fixed;
  1723. top: 60upx;
  1724. right: 10upx;
  1725. height: 46upx;
  1726. width: 46upx;
  1727. z-index: 1201;
  1728. }
  1729. }
  1730. </style>