productDetails.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  1. <template>
  2. <view class="content" style="padding-bottom: 144rpx;">
  3. <!-- 商品轮播图片 -->
  4. <view class="shop-banner" @click="showImg()">
  5. <swiper class="swiper" :indicator-dots="false" :circular="true" :autoplay="true" :interval="3000"
  6. :duration="1000" indicator-color="rgba(255, 255, 255, 0.6)" indicator-active-color="#ffffff"
  7. @change="swiperChange">
  8. <swiper-item class="swiper-item" v-for="(item,index) in banner" :key="index">
  9. <image :src="item" mode="aspectFill"></image>
  10. </swiper-item>
  11. </swiper>
  12. <!-- 底部遮罩 -->
  13. <view class="banner-mask"></view>
  14. <!-- 数量 -->
  15. <view class="num-box">{{ activeBanner }}/{{ banner.length }}</view>
  16. </view>
  17. <!-- 详细信息 -->
  18. <view class="det-info">
  19. <view class="price-box">
  20. <view class="price">
  21. <text class="label" style="color: #FF5C03;">会员价</text>
  22. <text class="unit">¥</text>
  23. <text class="num">{{product.price}}</text>
  24. <text class="label">零售价</text>
  25. <text class="old">¥{{product.otPrice}}</text>
  26. </view>
  27. <view class="share-box">
  28. <text class="text">分享</text>
  29. <image
  30. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/share1.png"
  31. mode=""></image>
  32. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  33. </view>
  34. </view>
  35. <view class="name-box">
  36. <view class="tag" :style="{background:_background(product.productType)}">
  37. {{$getDictLabelName("storeProductType",product.productType)}}</view>{{product.productName}}
  38. </view>
  39. <view class="intro" v-if="product.productInfo!=null" v-html="product.productInfo.replace(/\n/g,'<br>')">
  40. </view>
  41. </view>
  42. <view class="other-box">
  43. <view class="other-box-item">
  44. <view class="label">包装规格</view>
  45. <view class="text">{{product.prescribeSpec||'--'}}</view>
  46. </view>
  47. <view class="other-box-item">
  48. <view class="label">批准文号</view>
  49. <view class="text">{{product.batchNumber||'--'}}</view>
  50. </view>
  51. <view class="other-box-item">
  52. <view class="label">生产厂家</view>
  53. <view class="text">{{product.mah||'--'}}</view>
  54. </view>
  55. <view class="other-box-item" v-if="product.sales">
  56. <view class="label">已售</view>
  57. <view class="text">{{$formatSalesNum(product.sales)}}</view>
  58. </view>
  59. <view class="other-box-item">
  60. <view class="label" style="width: 4em;">服务</view>
  61. <view class="safe-box">
  62. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/safe.png"
  63. mode=""></image>
  64. <text class="text" style="margin-right: 34rpx;">品质保障</text>
  65. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/safe.png"
  66. mode=""></image>
  67. <text class="text" style="margin-right: 34rpx;">药师服务</text>
  68. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/safe.png"
  69. mode=""></image>
  70. <text class="text">隐私保护</text>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="storebox x-bc" v-if="chooseStore.storeId">
  75. <view class="x-f">
  76. <image class="logo" :src="chooseStore.logoUrl" mode="aspectFill"></image>
  77. <view class="storebox-r" @click="goStoreDetail(chooseStore)">
  78. <view class="storename ellipsis2">{{chooseStore.storeName||''}}</view>
  79. <!-- <view class="storedesc">24小时营业 销售{{$formatSalesNum(chooseStore.salesCount) }}</view> -->
  80. </view>
  81. </view>
  82. <view class="storebox-btn" @click="goStoreDetail(chooseStore)">进店</view>
  83. </view>
  84. <!-- 购买人数、库存 -->
  85. <!-- <view class="inventor">
  86. <view class="left">
  87. <view class="head-box">
  88. <view class="head" v-for="(item,j) in 5" :key="j">
  89. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/head.jpg" mode=""></image>
  90. </view>
  91. </view>
  92. <view class="num-box">
  93. 已有 <text class="text">{{product.sales}}</text> 人购买
  94. </view>
  95. </view>
  96. <view class="right">
  97. 库存 <text class="text">{{product.stock}}{{product.unitName}}</text>
  98. </view>
  99. <view class="right">
  100. <text class="text">库存{{product.stock>0?'充足':'售罄'}} </text>
  101. </view>
  102. </view> -->
  103. <!-- 功效 -->
  104. <!-- <view class="effect">
  105. <view class="label">药品说明书</view>
  106. <view class="label">查看</view>
  107. </view> -->
  108. <!-- 商品评价 -->
  109. <view class="det-box evaluate">
  110. <view class="title">商品评价({{evaluateTotal}})</view>
  111. <view class="evaluate">
  112. <evaluateItem v-for="(item,index) in evaluate" :key="index" :item="item"></evaluateItem>
  113. <view class="footer-desc" v-if="evaluate&&evaluate.length>0">
  114. <text @click="moreEvaluate">查看更多评价</text>
  115. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/arrow_gray.png"></image>
  116. </view>
  117. </view>
  118. </view>
  119. <!-- 图文详情 -->
  120. <view class="det-box">
  121. <view class="title">图文详情</view>
  122. <view class="inner">
  123. <view v-html="product.description" style="font-size:0"></view>
  124. </view>
  125. <view class="other-box" style="margin: 0;padding: 24rpx 0;">
  126. <view class="other-box-item" v-if="product.indications">
  127. <view class="label" style="margin-right: 16rpx;">【功能主治】</view>
  128. <view class="text">{{product.indications}}</view>
  129. </view>
  130. <view class="other-box-item" v-if="product.dosage">
  131. <view class="label" style="margin-right: 16rpx;">【用法用量】</view>
  132. <view class="text">{{product.dosage}}</view>
  133. </view>
  134. <view class="other-box-item" v-if="product.adverseReactions">
  135. <view class="label" style="margin-right: 16rpx;">【不良反应】</view>
  136. <view class="text">{{product.adverseReactions}}</view>
  137. </view>
  138. <view class="other-box-item" v-if="product.contraindications">
  139. <view class="label" style="margin-right: 16rpx;">【禁忌】</view>
  140. <view class="text">{{product.contraindications}}</view>
  141. </view>
  142. <view class="other-box-item" v-if="product.precautions">
  143. <view class="label" style="margin-right: 16rpx;">【注意事项】</view>
  144. <view class="text">{{product.precautions}}</view>
  145. </view>
  146. </view>
  147. </view>
  148. <!-- 底部按钮 -->
  149. <view class="btn-foot">
  150. <view class="menu-box">
  151. <view class="item" @click="goHome">
  152. <image
  153. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/back_home.png"
  154. mode=""></image>
  155. <text class="label">首页</text>
  156. </view>
  157. <!-- <view class="item" style="position: relative;">
  158. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/consult_small.png" mode=""></image>
  159. <text class="label">咨询</text>
  160. <button class="contact-btn" open-type="contact"></button>
  161. </view> -->
  162. <view class="item" @click="navgetTo('./cart')">
  163. <view class="img-item">
  164. <u-badge type="error" max="99" :value="cartCount" :offset="[-10,-10]"
  165. :absolute="true"></u-badge>
  166. <image
  167. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/fs/20250929/73574822bab04a86ae77b772b4e28952.png"
  168. mode=""></image>
  169. </view>
  170. <text class="label">购物车</text>
  171. </view>
  172. </view>
  173. <view class="btn-box">
  174. <view class="btn cart" @click="addCart('cart')">加入购物车</view>
  175. <view class="btn buy" @click="addCart('buy')">{{buyText}}</view>
  176. </view>
  177. </view>
  178. <!-- 选择药品规格弹窗 -->
  179. <popupBottom ref="popup" :visible.sync="specVisible" title=" " radius="32" maxHeight="1024">
  180. <view class="product-spec">
  181. <!-- 商品信息 -->
  182. <view class="pro-info">
  183. <view class="img-box" @click="showImg(productValueSelect.image)">
  184. <image
  185. :src="productValueSelect.image==null||productValueSelect.image==''?product.image:productValueSelect.image"
  186. mode="aspectFill"></image>
  187. </view>
  188. <view class="info-text">
  189. <view class="price">
  190. <text class="unit">¥</text>
  191. <text class="num">{{ productValueSelect.price.toFixed(2) }}</text>
  192. </view>
  193. <view class="desc-box">
  194. <text class="text">已选:{{ productValueSelect.sku }}</text>
  195. <text class="text">库存{{ productValueSelect.stock?'充足':'售罄' }}</text>
  196. </view>
  197. </view>
  198. </view>
  199. <!-- 规格 -->
  200. <view class="spec-box">
  201. <view v-for="(item,index) in attrs">
  202. <view class="title">{{item.attrName}}</view>
  203. <view class="spec-list">
  204. <view v-for="(subItem,subindex) in item.values" :key="subindex"
  205. :class="subindex==item.index?'item active':'item'" @click="choseSpec(index,subindex)">
  206. {{ subItem }}
  207. </view>
  208. </view>
  209. </view>
  210. </view>
  211. <!-- 数量 -->
  212. <view class="price-num">
  213. <view class="label">数量</view>
  214. <view class="num-box">
  215. <view class="img-box" @click="lessNum()">
  216. <image v-if="specNum <= 1"
  217. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/jian.png"
  218. mode=""></image>
  219. <image v-else
  220. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/jian2.png"
  221. mode=""></image>
  222. </view>
  223. <input type="number" @change="changeNum" v-model="specNum" />
  224. <view class="img-box" @click="addNum()">
  225. <image
  226. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/add.png"
  227. mode=""></image>
  228. </view>
  229. </view>
  230. </view>
  231. <view class="sub-btn" @click="submit">确定</view>
  232. </view>
  233. </popupBottom>
  234. <view class="loadding" v-if="loadding==true">
  235. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/logo.png"></image>
  236. <text class="text">加载中...</text>
  237. </view>
  238. </view>
  239. </template>
  240. <script>
  241. import {getCartCount} from '@/api/index.js'
  242. import {getDicts} from '@/api/common.js'
  243. import { getProductDetails, addCart } from './api/product.js'
  244. import {selectCommentByUser} from '@/api/myStoreOrder.js'
  245. import popupBottom from './components/px-popup-bottom.vue'
  246. import evaluateItem from '@/components/evaluateItem.vue'
  247. export default {
  248. components: {
  249. popupBottom,
  250. evaluateItem
  251. },
  252. data() {
  253. return {
  254. loadding: true,
  255. buyText: "立即购买",
  256. type: null,
  257. productValueSelect: {
  258. price: 0,
  259. },
  260. banner: [],
  261. productId: null,
  262. attrs: [],
  263. values: [],
  264. product: {
  265. price: 0,
  266. otPrice: 0,
  267. },
  268. // 当前轮播的图片
  269. activeBanner: 1,
  270. // 购物车数量
  271. cartCount: 0,
  272. // 规格弹窗
  273. specVisible: false,
  274. // 规格数量
  275. specNum: 1,
  276. chooseStore: {},
  277. storeList: [],
  278. storeId: '',
  279. evaluateTotal: 0,
  280. evaluate: []
  281. };
  282. },
  283. computed: {
  284. _background() {
  285. //productType: 1:OTC,2:Rx,3:非药品,4:器械
  286. return (productType) => {
  287. switch (productType) {
  288. case 1:
  289. return '#37E2EA' // OTC
  290. case 2:
  291. return 'red' // Rx
  292. case 3:
  293. return '#2583EB' // 非药品
  294. case 4:
  295. return '#999' // 器械
  296. default:
  297. return '#ccc'
  298. }
  299. }
  300. }
  301. },
  302. onLoad(options) {
  303. if (options.userId != null) {
  304. uni.setStorageSync('tuiUserId', options.userId);
  305. } else if (options.hasOwnProperty('q') && options.q) {
  306. // 通过下面这步解码,可以拿到url的值
  307. const url = decodeURIComponent(options.q)
  308. this.url = url;
  309. // // 对url中携带的参数提取处理
  310. const obj = this.$urlToObj(url)
  311. uni.setStorageSync('tuiUserId', obj.userId);
  312. }
  313. this.storeId = options.storeId || '';
  314. uni.showShareMenu({
  315. withShareTicket: true,
  316. //小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
  317. menus: ["shareAppMessage", "shareTimeline"] //不设置默认发送给朋友
  318. })
  319. this.getDicts();
  320. this.productId = options.productId;
  321. this.$isLogin().then(res => {
  322. if (res) {
  323. this.getCartCount();
  324. }
  325. })
  326. },
  327. onShow() {
  328. this.getProductDetails();
  329. },
  330. //发送给朋友
  331. onShareAppMessage(res) {
  332. this.$isLogin().then(res => {
  333. if (res) {
  334. var user = JSON.parse(uni.getStorageSync('userInfo'))
  335. return {
  336. title: this.product.productName,
  337. path: '/pages_shopping/productDetails?productId=' + this.product.productId + "&userId=" +
  338. user.userId,
  339. }
  340. }
  341. })
  342. },
  343. //分享到朋友圈
  344. onShareTimeline(res) {
  345. this.$isLogin().then(res => {
  346. if (res) {
  347. var user = JSON.parse(uni.getStorageSync('userInfo'))
  348. return {
  349. title: this.product.productName,
  350. query: 'productId=' + this.product.productId + "&userId=" + user.userId, //页面参数
  351. }
  352. }
  353. })
  354. },
  355. methods: {
  356. goStoreDetail(item) {
  357. uni.navigateTo({
  358. url: '/pages_store/storeIndex?storeId=' + item.storeId
  359. })
  360. },
  361. getDicts: function() {
  362. getDicts().then(
  363. res => {
  364. if (res.code == 200) {
  365. uni.setStorageSync('dicts', JSON.stringify(res));
  366. }
  367. },
  368. rej => {}
  369. );
  370. },
  371. showImg(img) {
  372. if (img != null) {
  373. var imgs = [];
  374. imgs.push(img)
  375. //预览图片
  376. uni.previewImage({
  377. urls: imgs,
  378. current: imgs[0]
  379. });
  380. } else {
  381. //预览图片
  382. uni.previewImage({
  383. urls: this.banner,
  384. current: this.banner[0]
  385. });
  386. }
  387. },
  388. doAddCart(type) {
  389. if (this.specNum == 0) {
  390. uni.showToast({
  391. icon: 'none',
  392. title: "库存不足",
  393. });
  394. return;
  395. }
  396. var isBuy = type == "buy" ? 1 : 0;
  397. let data = {
  398. isBuy: isBuy,
  399. cartNum: this.specNum,
  400. productId: this.productValueSelect.productId,
  401. attrValueId: this.productValueSelect.id
  402. };
  403. addCart(data).then(
  404. res => {
  405. if (res.code == 200) {
  406. if (type == "buy") {
  407. const selectCarts = [{
  408. storeId: this.storeId,
  409. data: {
  410. type: this.type,
  411. cartIds: res.id,
  412. }
  413. }]
  414. uni.navigateTo({
  415. url: '/pages_shopping/confirmOrder?type=' + this.type + '&orderType=' +
  416. this.orderType + '&confirmParam=' + encodeURIComponent(JSON.stringify(
  417. selectCarts))
  418. })
  419. } else {
  420. this.getCartCount()
  421. uni.showToast({
  422. icon: 'success',
  423. title: "添加成功",
  424. });
  425. }
  426. } else {
  427. uni.showToast({
  428. icon: 'none',
  429. title: res.msg,
  430. });
  431. this.getProductDetails()
  432. }
  433. },
  434. rej => {}
  435. );
  436. },
  437. getProductDetails() {
  438. let data = {
  439. productId: this.productId
  440. };
  441. getProductDetails(data).then(
  442. res => {
  443. this.loadding = false
  444. if (res.code == 200) {
  445. this.product = res.product;
  446. if (this.product.productType == 1) {
  447. this.buyText = "立即购买"
  448. } else if (this.product.productType == 2) {
  449. this.buyText = "开方购买"
  450. }
  451. this.product.otPrice = this.product.otPrice.toFixed(2);
  452. this.product.price = this.product.price.toFixed(2);
  453. if (this.product.sliderImage != null) {
  454. this.banner = this.product.sliderImage.split(',');
  455. } else {
  456. this.banner = []
  457. }
  458. this.attrs = res.productAttr;
  459. this.attrs.forEach((item, index, arr) => {
  460. item.values = item.attrValues.split(',');
  461. item.index = 0
  462. })
  463. console.log(this.attrs)
  464. this.values = res.productValues;
  465. this.storeId = res.store.storeId || ''
  466. this.storeList = [res.store] || [];
  467. if (this.storeList && this.storeList.length > 0) {
  468. const idx = this.storeList.indexOf(Number(this.storeId || 0));
  469. if (this.storeId && idx > -1) {
  470. this.chooseStore = this.storeList[idx]
  471. } else {
  472. this.chooseStore = this.storeList[0]
  473. }
  474. }
  475. this.choseSpec(0, 0)
  476. this.getCommentByUser()
  477. } else {
  478. uni.showToast({
  479. icon: 'none',
  480. title: res.msg,
  481. });
  482. setTimeout(function() {
  483. uni.reLaunch({
  484. url: '/pages/index/index',
  485. })
  486. }, 2000)
  487. }
  488. },
  489. rej => {}
  490. );
  491. },
  492. getCartCount() {
  493. let data = {};
  494. getCartCount(data).then(
  495. cartRes => {
  496. if (cartRes.code == 200) {
  497. this.cartCount = cartRes.data;
  498. }
  499. },
  500. rej => {}
  501. );
  502. },
  503. // swiper变化事件
  504. swiperChange(event) {
  505. this.activeBanner = event.detail.current + 1
  506. },
  507. // 回到首页
  508. goHome() {
  509. uni.switchTab({
  510. url: '/pages/index/index'
  511. })
  512. },
  513. // 跳转页面
  514. navgetTo(url) {
  515. this.$isLogin().then(res => {
  516. if (res) {
  517. uni.navigateTo({
  518. url: url
  519. })
  520. }
  521. })
  522. },
  523. // 加入购物车
  524. addCart(type) {
  525. this.$isLogin().then(res => {
  526. if (res) {
  527. this.type = type;
  528. this.specVisible = true
  529. } else {
  530. uni.navigateTo({
  531. url: '/pages/auth/login'
  532. })
  533. }
  534. })
  535. },
  536. // 规格选择
  537. choseSpec(index, subIndex) {
  538. this.attrs[index].index = subIndex;
  539. this.$forceUpdate();
  540. let productAttr = this.attrs;
  541. let values = [];
  542. for (let i = 0; i < productAttr.length; i++) {
  543. for (let j = 0; j < productAttr[i].values.length; j++) {
  544. if (productAttr[i].index === j) {
  545. values.push(productAttr[i].values[j]);
  546. }
  547. }
  548. }
  549. var selectVal = values.sort().join(",");
  550. console.log(selectVal)
  551. var valueSelect = this.values.filter((item) => {
  552. return item.sku == selectVal;
  553. })
  554. if (valueSelect != null && valueSelect.length == 1) {
  555. this.productValueSelect = valueSelect[0];
  556. }
  557. this.updateSpecNum();
  558. },
  559. //更新数量
  560. updateSpecNum() {
  561. if (this.productValueSelect.stock == 0) {
  562. this.specNum = 0;
  563. } else {
  564. this.specNum = 1;
  565. }
  566. },
  567. changeNum(e) {
  568. this.specNum = e.detail.value.replace(/\D/g, '')
  569. if (this.specNum < 1) {
  570. this.specNum = 1
  571. }
  572. if (this.specNum >= this.productValueSelect.stock) {
  573. this.specNum = this.productValueSelect.stock
  574. }
  575. },
  576. // 数量减法
  577. lessNum() {
  578. this.specNum--
  579. if (this.specNum < 1) {
  580. this.specNum = 1
  581. }
  582. if (this.specNum >= this.productValueSelect.stock) {
  583. this.specNum = this.productValueSelect.stock
  584. }
  585. },
  586. // 数量加法
  587. addNum() {
  588. if (this.specNum < 10) {
  589. this.specNum++
  590. } else {
  591. uni.showToast({
  592. icon: 'none',
  593. title: '限购10盒',
  594. });
  595. }
  596. if (this.specNum >= this.productValueSelect.stock) {
  597. this.specNum = this.productValueSelect.stock
  598. }
  599. },
  600. // 确定选择该规格
  601. submit() {
  602. this.specVisible = false
  603. this.doAddCart(this.type);
  604. },
  605. moreEvaluate() {
  606. uni.navigateTo({
  607. url: '/pages_shopping/evaluate?storeId='+this.storeId+ '&productIds='+this.productId,
  608. })
  609. },
  610. getCommentByUser(){
  611. const param = {
  612. page: 1,
  613. pageSize: 2,
  614. storeId:this.storeId,
  615. orderId: null,
  616. productIds:this.productId,
  617. userId: uni.getStorageSync('userId') || null,
  618. showSelf: 0
  619. }
  620. selectCommentByUser(param).then(res=>{
  621. if(res.code==200) {
  622. this.evaluate = res.data.list
  623. this.evaluateTotal = res.data.total
  624. } else {
  625. this.evaluate = []
  626. this.evaluateTotal = 0
  627. }
  628. })
  629. }
  630. }
  631. }
  632. </script>
  633. <style lang="scss" scoped>
  634. .img-item {
  635. position: relative;
  636. width: 44rpx;
  637. height: 44rpx;
  638. margin: 0 20rpx 0 10rpx;
  639. image {
  640. width: 100%;
  641. height: 100%;
  642. }
  643. }
  644. .other-box {
  645. background: #FFFFFF;
  646. border-radius: 16rpx 16rpx 16rpx 16rpx;
  647. padding: 12rpx 24rpx;
  648. margin: 24rpx;
  649. &-item {
  650. display: flex;
  651. align-items: flex-start;
  652. padding: 10rpx 0;
  653. }
  654. .label {
  655. flex-shrink: 0;
  656. color: #999999;
  657. font-size: 28rpx;
  658. font-family: PingFang SC;
  659. line-height: 1.3;
  660. margin-right: 40rpx;
  661. min-width: 4em;
  662. text-align: justify;
  663. /* 两端对齐 */
  664. text-align-last: justify;
  665. /* 最后一行也撑满 */
  666. }
  667. .safe-box {
  668. display: flex;
  669. align-items: center;
  670. image {
  671. width: 28rpx;
  672. height: 28rpx;
  673. margin-right: 8rpx;
  674. }
  675. }
  676. .text {
  677. font-family: PingFang SC, PingFang SC;
  678. font-weight: 400;
  679. font-size: 24rpx;
  680. color: #333333;
  681. }
  682. }
  683. .shop-banner {
  684. height: 756upx;
  685. background-color: #FFFFFF;
  686. position: relative;
  687. .swiper-item {
  688. box-sizing: border-box;
  689. }
  690. .swiper,
  691. .swiper-item,
  692. .swiper-item image {
  693. width: 100%;
  694. height: 100%;
  695. }
  696. .banner-mask {
  697. width: 100%;
  698. height: 44upx;
  699. // background: linear-gradient(0deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0));
  700. // opacity: 0.8;
  701. position: absolute;
  702. left: 0;
  703. bottom: 0;
  704. z-index: 9;
  705. background-image: url(https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/black_mask.png);
  706. background-size: 20upx 44upx;
  707. background-repeat: repeat-x;
  708. }
  709. .num-box {
  710. width: 80upx;
  711. height: 44upx;
  712. line-height: 44upx;
  713. text-align: center;
  714. font-size: 24upx;
  715. font-family: PingFang SC;
  716. font-weight: 500;
  717. color: #FFFFFF;
  718. background: rgba(0, 0, 0, .3);
  719. border-radius: 22upx;
  720. position: absolute;
  721. right: 30upx;
  722. bottom: 30upx;
  723. z-index: 10;
  724. }
  725. }
  726. .det-info {
  727. background: #FFFFFF;
  728. padding: 36upx 30upx 25upx;
  729. margin: 20rpx 24rpx;
  730. border-radius: 16rpx 16rpx 16rpx 16rpx;
  731. .price-box {
  732. display: flex;
  733. align-items: center;
  734. justify-content: space-between;
  735. .price {
  736. display: flex;
  737. align-items: baseline;
  738. .label {
  739. color: #999999;
  740. font-size: 28upx;
  741. font-family: PingFang SC;
  742. line-height: 1.3;
  743. margin-right: 5upx;
  744. }
  745. .unit {
  746. font-size: 28upx;
  747. font-family: PingFang SC;
  748. font-weight: bold;
  749. color: #FF6633;
  750. line-height: 1.3;
  751. }
  752. .num {
  753. font-size: 40upx;
  754. font-family: PingFang SC;
  755. font-weight: bold;
  756. color: #FF6633;
  757. margin: 0 20upx 0 0;
  758. line-height: 1;
  759. }
  760. .old {
  761. font-size: 28upx;
  762. font-family: PingFang SC;
  763. font-weight: 500;
  764. text-decoration: line-through;
  765. color: #999999;
  766. line-height: 1.3;
  767. }
  768. }
  769. .share-box {
  770. width: 120upx;
  771. height: 46upx;
  772. border: 1px solid #2583EB;
  773. border-radius: 23upx;
  774. display: flex;
  775. align-items: center;
  776. justify-content: center;
  777. position: relative;
  778. .text {
  779. font-size: 26upx;
  780. font-family: PingFang SC;
  781. font-weight: 500;
  782. color: #2583EB;
  783. }
  784. image {
  785. margin-left: 2rpx;
  786. width: 25upx;
  787. height: 24upx;
  788. }
  789. .share {
  790. display: inline-block;
  791. position: absolute;
  792. top: 0;
  793. left: 0;
  794. width: 100%;
  795. height: 100%;
  796. opacity: 0;
  797. }
  798. }
  799. .spec {
  800. font-size: 24upx;
  801. font-family: PingFang SC;
  802. font-weight: 500;
  803. color: #999999;
  804. line-height: 36upx;
  805. }
  806. }
  807. .name-box {
  808. font-size: 32upx;
  809. font-family: PingFang SC;
  810. font-weight: bold;
  811. color: #111111;
  812. line-height: 44upx;
  813. margin-top: 32upx;
  814. .tag {
  815. display: inline-block;
  816. padding: 0 6upx;
  817. height: 30upx;
  818. background: linear-gradient(90deg, #2583EB 0%, #92C1F5 100%);
  819. border-radius: 4upx;
  820. margin-right: 10upx;
  821. font-size: 22upx;
  822. font-family: PingFang SC;
  823. font-weight: bold;
  824. color: #FFFFFF;
  825. line-height: 30upx;
  826. float: left;
  827. margin-top: 7upx;
  828. }
  829. }
  830. .intro {
  831. display: block;
  832. font-size: 26upx;
  833. font-family: PingFang SC;
  834. font-weight: 500;
  835. color: #999999;
  836. line-height: 36upx;
  837. padding-top: 18upx;
  838. }
  839. }
  840. .inventor {
  841. height: 88upx;
  842. padding: 0 39upx 0 30upx;
  843. margin-top: 10upx;
  844. background: #FFFFFF;
  845. display: flex;
  846. align-items: center;
  847. justify-content: space-between;
  848. .left {
  849. display: flex;
  850. align-items: center;
  851. .head-box {
  852. margin-right: 27upx;
  853. display: flex;
  854. align-items: center;
  855. .head {
  856. width: 48upx;
  857. height: 48upx;
  858. border-radius: 50%;
  859. overflow: hidden;
  860. box-shadow: 0 0 0 1px #fff;
  861. margin-right: -10upx;
  862. image {
  863. width: 100%;
  864. height: 100%;
  865. }
  866. }
  867. }
  868. .num-box {
  869. font-size: 24upx;
  870. font-family: PingFang SC;
  871. font-weight: 500;
  872. color: #999999;
  873. .text {
  874. font-size: 24upx;
  875. font-family: PingFang SC;
  876. font-weight: 500;
  877. color: #999999;
  878. }
  879. }
  880. }
  881. .right {
  882. font-size: 24upx;
  883. font-family: PingFang SC;
  884. font-weight: 500;
  885. color: #999999;
  886. .text {
  887. font-size: 24upx;
  888. font-family: PingFang SC;
  889. font-weight: 500;
  890. color: #666666;
  891. }
  892. }
  893. }
  894. .effect {
  895. box-sizing: border-box;
  896. padding: 20upx 30upx;
  897. background: #FFFFFF;
  898. font-size: 28upx;
  899. font-family: PingFang SC;
  900. font-weight: 500;
  901. color: #666666;
  902. line-height: 1.8;
  903. margin-top: 10upx;
  904. display: flex;
  905. flex-direction: row;
  906. align-items: center;
  907. justify-content: space-between;
  908. .label {
  909. font-size: 28upx;
  910. font-family: PingFang SC;
  911. font-weight: 500;
  912. color: #111111;
  913. line-height: 1.8;
  914. }
  915. }
  916. .det-box {
  917. padding: 30upx 30upx 0 30upx;
  918. background-color: #FFFFFF;
  919. margin: 24rpx 24rpx 0 24rpx;
  920. border-radius: 16rpx;
  921. .title {
  922. font-size: 30upx;
  923. font-family: PingFang SC;
  924. font-weight: bold;
  925. color: #333333;
  926. line-height: 1;
  927. margin-bottom: 24rpx;
  928. }
  929. .label,
  930. .text {
  931. font-size: 30upx !important;
  932. }
  933. }
  934. .btn-foot {
  935. box-sizing: border-box;
  936. width: 100%;
  937. height: 121upx;
  938. background: #FFFFFF;
  939. padding: 0 32upx 0 28upx;
  940. display: flex;
  941. align-items: center;
  942. justify-content: space-between;
  943. position: fixed;
  944. left: 0;
  945. bottom: 0;
  946. z-index: 99;
  947. .menu-box {
  948. display: flex;
  949. align-items: center;
  950. .item {
  951. display: flex;
  952. align-items: center;
  953. flex-direction: column;
  954. margin-right: 48upx;
  955. &:last-child {
  956. margin-right: 0;
  957. }
  958. image {
  959. width: 36upx;
  960. height: 36upx;
  961. margin-bottom: 10upx;
  962. }
  963. .label {
  964. font-size: 20upx;
  965. font-family: PingFang SC;
  966. font-weight: 500;
  967. color: #666666;
  968. text-align: center;
  969. }
  970. }
  971. ::v-deep.uni-badge--x {
  972. display: flex;
  973. align-items: center;
  974. justify-content: center;
  975. }
  976. ::v-deep.uni-badge {
  977. border: none;
  978. background-color: #FF3636;
  979. font-family: Roboto;
  980. }
  981. }
  982. .btn-box {
  983. display: flex;
  984. align-items: center;
  985. .btn {
  986. position: relative;
  987. width: 200upx;
  988. height: 88upx;
  989. line-height: 88upx;
  990. text-align: center;
  991. border-radius: 44upx;
  992. margin-left: 20upx;
  993. font-size: 30upx;
  994. font-family: PingFang SC;
  995. font-weight: bold;
  996. color: #FFFFFF;
  997. &:first-child {
  998. margin-left: 0;
  999. }
  1000. &.cart {
  1001. background: #FF6633;
  1002. .share {
  1003. display: inline-block;
  1004. position: absolute;
  1005. top: 0;
  1006. left: 0;
  1007. width: 100%;
  1008. height: 100%;
  1009. opacity: 0;
  1010. }
  1011. }
  1012. &.buy {
  1013. background: #2583EB;
  1014. }
  1015. }
  1016. }
  1017. }
  1018. .product-spec {
  1019. .pro-info {
  1020. display: flex;
  1021. align-items: center;
  1022. .img-box {
  1023. width: 200upx;
  1024. height: 200upx;
  1025. background: #FFFFFF;
  1026. border-radius: 16upx;
  1027. overflow: hidden;
  1028. margin-right: 30upx;
  1029. image {
  1030. width: 100%;
  1031. height: 100%;
  1032. }
  1033. }
  1034. .info-text {
  1035. height: 200upx;
  1036. display: flex;
  1037. flex-direction: column;
  1038. justify-content: space-between;
  1039. .price {
  1040. display: flex;
  1041. align-items: flex-end;
  1042. .unit {
  1043. font-size: 32upx;
  1044. font-family: PingFang SC;
  1045. font-weight: bold;
  1046. color: #FF6633;
  1047. line-height: 1.2;
  1048. margin-right: 10upx;
  1049. }
  1050. .num {
  1051. font-size: 50upx;
  1052. font-family: PingFang SC;
  1053. font-weight: bold;
  1054. color: #FF6633;
  1055. line-height: 1;
  1056. }
  1057. }
  1058. .desc-box {
  1059. display: flex;
  1060. flex-direction: column;
  1061. padding-bottom: 9upx;
  1062. .text {
  1063. font-size: 26upx;
  1064. font-family: PingFang SC;
  1065. font-weight: 500;
  1066. color: #999999;
  1067. margin-top: 27upx;
  1068. line-height: 1;
  1069. &:first-child {
  1070. margin-top: 0;
  1071. }
  1072. }
  1073. }
  1074. }
  1075. }
  1076. .spec-box {
  1077. padding-top: 50upx;
  1078. .title {
  1079. font-size: 34upx;
  1080. font-family: PingFang SC;
  1081. font-weight: bold;
  1082. color: #111111;
  1083. line-height: 1;
  1084. }
  1085. .spec-list {
  1086. display: flex;
  1087. flex-wrap: wrap;
  1088. margin-top: 30upx;
  1089. .item {
  1090. box-sizing: border-box;
  1091. height: 64upx;
  1092. padding: 0 30upx;
  1093. line-height: 64upx;
  1094. font-size: 28upx;
  1095. font-family: PingFang SC;
  1096. font-weight: 500;
  1097. color: #111111;
  1098. background: #F7F7F7;
  1099. border: 1px solid #F7F7F7;
  1100. border-radius: 32upx;
  1101. margin-right: 20upx;
  1102. margin-bottom: 30upx;
  1103. &.active {
  1104. background: #F1FFFE;
  1105. border: 1px solid #2583EB;
  1106. color: #2583EB;
  1107. }
  1108. }
  1109. }
  1110. }
  1111. .price-num {
  1112. display: flex;
  1113. align-items: center;
  1114. justify-content: space-between;
  1115. margin-top: 14upx;
  1116. .label {
  1117. font-size: 34upx;
  1118. font-family: PingFang SC;
  1119. font-weight: bold;
  1120. color: #111111;
  1121. }
  1122. .num-box {
  1123. display: flex;
  1124. align-items: center;
  1125. .img-box {
  1126. width: 60upx;
  1127. height: 60upx;
  1128. // border-radius: 4upx;
  1129. border: 1px solid #dddddd;
  1130. display: flex;
  1131. align-items: center;
  1132. justify-content: center;
  1133. image {
  1134. width: 25rpx;
  1135. height: 25rpx;
  1136. }
  1137. }
  1138. input {
  1139. width: 60upx;
  1140. height: 60upx;
  1141. line-height: 60upx;
  1142. font-size: 28upx;
  1143. font-family: PingFang SC;
  1144. font-weight: 500;
  1145. color: #111111;
  1146. // border-radius: 4upx;
  1147. border-top: 1px solid #dddddd;
  1148. border-bottom: 1px solid #dddddd;
  1149. text-align: center;
  1150. // margin: 0 16upx;
  1151. }
  1152. }
  1153. }
  1154. .sub-btn {
  1155. width: 100%;
  1156. height: 88upx;
  1157. line-height: 88upx;
  1158. text-align: center;
  1159. font-size: 30upx;
  1160. font-family: PingFang SC;
  1161. font-weight: bold;
  1162. color: #FFFFFF;
  1163. background: #2583EB;
  1164. border-radius: 44upx;
  1165. margin-top: 30upx;
  1166. // margin-bottom: 30upx;
  1167. }
  1168. }
  1169. .contact-btn {
  1170. display: inline-block;
  1171. position: absolute;
  1172. top: 0;
  1173. left: 0;
  1174. width: 100%;
  1175. height: 100%;
  1176. opacity: 0;
  1177. z-index: 9999;
  1178. }
  1179. .loadding {
  1180. background-color: #fff;
  1181. display: flex;
  1182. flex-direction: column;
  1183. align-items: center;
  1184. justify-content: center;
  1185. position: absolute;
  1186. top: 0;
  1187. left: 0;
  1188. width: 100%;
  1189. height: 100%;
  1190. z-index: 9999;
  1191. image {
  1192. border-radius: 50%;
  1193. animation: load linear 1s infinite;
  1194. width: 120rpx;
  1195. height: 120rpx;
  1196. }
  1197. .text {
  1198. font-size: 28rpx;
  1199. margin-top: 20rpx;
  1200. }
  1201. }
  1202. .storebox {
  1203. margin: 24rpx;
  1204. padding: 28rpx 26rpx;
  1205. font-family: PingFang SC, PingFang SC;
  1206. color: #333;
  1207. background: #FFFFFF;
  1208. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1209. .logo {
  1210. width: 104rpx;
  1211. height: 104rpx;
  1212. background: #FFFFFF;
  1213. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1214. margin-right: 26rpx;
  1215. }
  1216. .storename {
  1217. font-weight: 500;
  1218. font-size: 32rpx;
  1219. }
  1220. .storedesc {
  1221. margin-top: 12rpx;
  1222. font-weight: 400;
  1223. font-size: 22rpx;
  1224. }
  1225. .storebox-r {
  1226. flex: 1;
  1227. overflow: hidden;
  1228. }
  1229. .storebox-btn {
  1230. flex-shrink: 0;
  1231. padding: 10rpx 24rpx;
  1232. font-size: 28rpx;
  1233. border-radius: 28rpx 28rpx 28rpx 28rpx;
  1234. border: 2rpx solid #FF5C03;
  1235. font-weight: 500;
  1236. font-size: 24rpx;
  1237. color: #FF5C03;
  1238. }
  1239. }
  1240. .evaluate {
  1241. .title {
  1242. margin: 0;
  1243. padding-bottom: 24rpx;
  1244. }
  1245. }
  1246. .footer-desc {
  1247. text-align: center;
  1248. padding: 0 32rpx 24rpx 0;
  1249. font-size: 28rpx;
  1250. color: #999;
  1251. image{
  1252. margin-left: 10rpx;
  1253. width:15rpx;
  1254. height:20rpx;
  1255. }
  1256. }
  1257. </style>