goods_des.vue 46 KB

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