product.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. <template>
  2. <view :class="[AppTheme]" class="container" v-if="cache">
  3. <view class="carousel">
  4. <u-swiper :list="appalbum" indicator indicatorMode="line" circular radius="0" height="750rpx" showTitle
  5. :autoplay="true" @click="previewImage(index)">
  6. </u-swiper>
  7. </view>
  8. <view class="introduce-section">
  9. <text class="title">{{ cache.name }}</text>
  10. <view class="price-box">
  11. <text class="price-tip">¥</text>
  12. <text class="price text-neutral">{{ cache.price }}</text>
  13. <text class="m-price">¥{{ cache.oprice }}</text>
  14. <!-- <text class="coupon-tip">7折</text> -->
  15. </view>
  16. <view class="bot-row">
  17. <text>销量: {{ cache.dissells }}</text>
  18. <text>单位: {{ cache.unit }}</text>
  19. <text>库存: {{ cache.num }}</text>
  20. </view>
  21. </view>
  22. <!-- 分享 -->
  23. <view class="share-section">
  24. <view class="share-icon">
  25. <text class="yticon icon-xingxing"></text>
  26. </view>
  27. <text class="tit">该商品分享可得佣金</text>
  28. <text class="yticon icon-bangzhu1"></text>
  29. <view class="share-btn" @click="opensharebox">
  30. <u-icon name="share" :color="primary" size="20"></u-icon>
  31. </view>
  32. </view>
  33. <view class="c-list">
  34. <view class="c-row b-b" @click="toggleSpec(0)">
  35. <text class="tit">购买类型</text>
  36. <view class="con">
  37. <text class="selected-text" v-for="(sItem, sIndex) in specSelected"
  38. :key="sIndex">{{ sItem.name }}</text>
  39. </view>
  40. <text class="yticon icon-you"></text>
  41. </view>
  42. <view class="c-row b-b">
  43. <text class="tit">温馨提示</text>
  44. <view class="bz-list con">
  45. <text>{{ cache.title }}</text>
  46. </view>
  47. </view>
  48. <!-- <view class="c-row b-b">
  49. <text class="tit">促销活动</text>
  50. <view class="con-list">
  51. <text>新人首单送20元无门槛代金券</text>
  52. <text>订单满50减10</text>
  53. <text>订单满100减30</text>
  54. <text>单笔购买满两件免邮费</text>
  55. </view>
  56. </view>
  57. <view class="c-row b-b">
  58. <text class="tit">服务</text>
  59. <view class="bz-list con">
  60. <text>7天无理由退换货 ·</text>
  61. <text>假一赔十 ·</text>
  62. </view>
  63. </view> -->
  64. </view>
  65. <view v-if="ifpeon" class="sel">
  66. <view>
  67. <u-checkbox-group size='35rpx' active-color="green" @change="checkboxChange">
  68. <u-checkbox name='tgxy' shape="circle" :checked="isChecked"></u-checkbox>
  69. </u-checkbox-group>
  70. </view>
  71. <text class="text" @click="goContract(partyinfo.id, 2)">
  72. 阅读并同意
  73. <text class="text-primary">《{{ partyinfo != null ? partyinfo.name : '暂无' }}》</text>
  74. </text>
  75. </view>
  76. <!-- 评价 -->
  77. <!-- <view class="eva-section">
  78. <view class="e-header">
  79. <text class="tit">评价</text>
  80. <text>(86)</text>
  81. <text class="tip">好评率 100%</text>
  82. <text class="yticon icon-you"></text>
  83. </view>
  84. <view class="eva-box">
  85. <image class="portrait" src="http://img3.imgtn.bdimg.com/it/u=1150341365,1327279810&fm=26&gp=0.jpg" mode="aspectFill"></image>
  86. <view class="right">
  87. <text class="name">Leo yo</text>
  88. <text class="con">商品收到了,79元两件,质量不错,试了一下有点瘦,但是加个外罩很漂亮,我很喜欢</text>
  89. <view class="bot">
  90. <text class="attr">购买类型:XL 红色</text>
  91. <text class="time">2019-04-01 19:21</text>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. -->
  97. <view class="farm" v-if="cache.farm_id">
  98. <view class="text_area">
  99. <view class="shop_name">
  100. <image :src="farm_info.farm_logo" :lazy-load="true" class="shop_thumbnail"></image>
  101. <view class="right_shop_mess">
  102. <view class="shop_line">
  103. <view class="shop_line_p1">{{farm_info.farm_name}}
  104. </view>
  105. <view class="right_shop_mess_p2" @click="gostoredetail(farm_info.id)">
  106. 进店逛逛
  107. </view>
  108. </view>
  109. <view class="shop_line_fl">
  110. </view>
  111. <view class="shop_line">
  112. <view class="shop_line_p2">
  113. <u-icon name="map" size="20" color="#9C9C9C"></u-icon>
  114. <view class="address">
  115. {{farm_info.farm_address}}
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="shop_one">
  123. <view class="shop_one_1">
  124. <view class="view1">{{farm_info.page_view}}</view>
  125. <view class="view2">访客数</view>
  126. </view>
  127. <view>
  128. <u-line color="#999998" direction="col" length='60%'></u-line>
  129. </view>
  130. <view class="shop_one_1">
  131. <view class="view1">{{farm_info.shopnum}}</view>
  132. <view class="view2">全部商品</view>
  133. </view>
  134. <view>
  135. <u-line color="#999998" direction="col" length='60%'></u-line>
  136. </view>
  137. <view class="shop_one_1">
  138. <view class="view1">{{farm_info.shoporder}}</view>
  139. <view class="view2">已售出</view>
  140. </view>
  141. </view>
  142. <!-- <view style="padding: 0 0 20rpx 0;">
  143. <u-album singleSize="75" multipleSize='75' singleMode="aspectFill"
  144. multipleMode="aspectFill" :urls="farm_info.detail_img" maxCount="4" :showMore='true'
  145. rowCount="4"></u-album>
  146. </view> -->
  147. </view>
  148. <view class="detail-desc">
  149. <view class="d-header"><text>商品详情</text></view>
  150. <u-parse :content="cache.content" :lazy-load="true" :show-with-animation="true">
  151. </u-parse>
  152. </view>
  153. <!-- 底部操作菜单 -->
  154. <view class="page-bottom">
  155. <navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
  156. <u-icon labelSize="12" color="#909399" label="首页" labelPos="bottom" labelColor="#909399" size="25"
  157. name="home"></u-icon>
  158. </navigator>
  159. <view class="p-b-btn" @click="gouwuche">
  160. <view class="">
  161. <u-icon labelSize="12" color="#909399" label="购物车" labelPos="bottom" labelColor="#909399" size="25"
  162. name="shopping-cart"></u-icon>
  163. </view>
  164. <view class="badge">
  165. <u-badge v-if="list.count" :showZero="false" size="mini" bgColor="red" :offset="offset"
  166. type="success" :value="list.count"></u-badge>
  167. </view>
  168. </view>
  169. <view class="p-b-btn " :class="{ active: favorite }" @click="toFavorite">
  170. <u-icon labelSize="12" :color="favorite?primary:'#909399'" label="收藏" labelPos="bottom"
  171. :labelColor="favorite?primary:'#909399'" size="25" name="heart-fill"></u-icon>
  172. </view>
  173. <view class="action-btn-group bg-linear-gradient">
  174. <button type="primary" class=" action-btn no-border add-cart-btn" @click="buy(1)">加入购物车</button>
  175. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(2)">立即购买</button>
  176. </view>
  177. </view>
  178. <!-- 规格-模态层弹窗 -->
  179. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec(0)">
  180. <!-- 遮罩层 -->
  181. <view class="mask"></view>
  182. <view class="layer attr-content" @click.stop="stopPrevent">
  183. <view class="a-t">
  184. <image :src=" apppic" v-if="apppic"></image>
  185. <view class="right">
  186. <text class="price text-neutral">¥{{ cache.price }}</text>
  187. <text class="stock">库存:{{ cache.num }}件</text>
  188. <view class="selected" v-if="skujson.length>0">
  189. 已选:
  190. <text class="selected-text">{{ sku.skuattr }}</text>
  191. </view>
  192. </view>
  193. </view>
  194. <view v-for="(item, index) in list.skuinfo" :key="index" class="attr-list">
  195. <text>{{ item.attrlabel }}</text>
  196. <view class="item-list">
  197. <text v-for="(childItem, childIndex) in item.allitems" v-if="childItem.checked === 1"
  198. :key="childIndex" class="tit" :class="{ selected: childItem.selected }"
  199. @click="selectSpec(childIndex, childItem.pid, item)">
  200. {{ childItem.name }}
  201. </text>
  202. </view>
  203. </view>
  204. <view class="row-between">
  205. <text>数量</text>
  206. <u-number-box v-model="num" @change="valChange" :max="cache.num * 1"></u-number-box>
  207. </view>
  208. <button class="btn bg-linear-gradient" @click="toggleSpec(isOpen)">完成</button>
  209. </view>
  210. </view>
  211. <!-- #ifdef MP-WEIXIN -->
  212. <nologin ref="nologin" v-on:loginback="loginback"></nologin>
  213. <!-- #endif -->
  214. <!-- 分享 -->
  215. <sharebox ref="sbox" v-if="sharedata" :data="sharedata"></sharebox>
  216. <admyself :opshow="true"></admyself>
  217. <tarpty :list='parttext' :tarptyshow="tarptyshow" @tarptycolse='tarptycolse' :type='2'></tarpty>
  218. </view>
  219. </template>
  220. <script>
  221. import api from '@/api/mall/index.js';
  222. import nologin from '@/components/nologin/nologin.vue';
  223. import tarpty from '@/components/ui-tarpty/ui-tarpty.vue';
  224. export default {
  225. components: {
  226. nologin,
  227. tarpty
  228. },
  229. data() {
  230. return {
  231. parttext: '',
  232. isChecked: false,
  233. tarptyshow: false,
  234. tarpty: '',
  235. partyinfo: {},
  236. ifpeon: false,
  237. primary: this.$theme.primary,
  238. goodslike: false,
  239. specClass: 'none',
  240. specSelected: [],
  241. offset: [5, 496],
  242. num: 1, // 默认为1
  243. list: '',
  244. cache: '',
  245. apppic: '',
  246. skujson: '',
  247. sku: '',
  248. isOpen: 0,
  249. favorite: false,
  250. shareList: [],
  251. imgList: [],
  252. specList: [],
  253. specChildList: [],
  254. settingFile: getApp().globalData.siteinfo,
  255. timer: null,
  256. appalbum: [],
  257. isc: '',
  258. sharedata: null,
  259. farm_info:''
  260. };
  261. },
  262. onLoad(options) {
  263. //接收传值,id里面放的是标题,因为测试数据并没写id
  264. this.$bindid.getbindid(options, this.$store);
  265. let id = options.id;
  266. this.isc = options.isc;
  267. this.shoopgoods(id);
  268. },
  269. onShow() {
  270. },
  271. onShareAppMessage(res) {
  272. let that = this
  273. let data = {
  274. title: that.sharedata.title,
  275. imageUrl: that.sharedata.imageUrl,
  276. path: that.sharedata.path
  277. };
  278. return data;
  279. },
  280. onShareTimeline(res) {
  281. let that = this
  282. let data = {
  283. title: that.sharedata.title,
  284. imageUrl: that.sharedata.imageUrl,
  285. path: that.sharedata.path
  286. };
  287. return data;
  288. },
  289. methods: {
  290. checkboxChange(e) {
  291. this.tarpty = e
  292. },
  293. goContract(id, type) {
  294. console.log(id,type,'kkkkkk')
  295. if (!this.parttext) {
  296. this.$api.msg(`暂无租赁协议,联系客服添加`);
  297. return;
  298. } else {
  299. this.tarptyshow = true
  300. }
  301. console.log(this.tarptyshow,'this.tarptyshow')
  302. },
  303. gostoredetail(farmid) { //跳转店铺详情
  304. uni.navigateTo({
  305. url: "/pagesC/pages/merchantdetails/merchantdetails?id=" + farmid
  306. })
  307. },
  308. loginback() {
  309. //登录回调
  310. },
  311. previewImage(index) { //预览商品详情轮播图片
  312. uni.previewImage({
  313. current: index,
  314. urls: this.appalbum,
  315. indicator: 'number'
  316. })
  317. },
  318. //规格弹窗开关
  319. toggleSpec(index) {
  320. /* 如果只点击规格 则不进行购买 || 添加购物车 */
  321. if (index == 0) {
  322. this.isOpen = 0
  323. if (this.specClass === 'show') {
  324. this.specClass = 'hide';
  325. setTimeout(() => {
  326. this.specClass = 'none';
  327. }, 250);
  328. } else if (this.specClass === 'none') {
  329. this.specClass = 'show';
  330. }
  331. return
  332. }
  333. if (index == 1) {
  334. if (this.specClass === 'show') {
  335. this.stock();
  336. // #ifdef MP-WEIXIN
  337. let id = uni.getStorageSync('userInfo').id;
  338. // #endif
  339. // #ifdef H5
  340. try{
  341. let id = uni.getStorageSync('userInfo').userinfo.id || uni.getStorageSync('userInfo').id;
  342. }catch(e){
  343. //TODO handle the exception
  344. console.log(e,'eee');
  345. }
  346. // #endif
  347. let obj = {
  348. sid: 0,
  349. goodstype: this.cache.type,
  350. goodsid: this.cache.id,
  351. num: this.num,
  352. isame: this.list.isadmin,
  353. sku: this.sku.sku,
  354. vipid: id
  355. };
  356. api.addtobasket(obj).then(res => {
  357. uni.showToast({
  358. title: res.data.msg,
  359. icon: 'none', //如果要纯文本,不要icon,将值设为'none'
  360. duration: 2000 //持续时间为 2秒
  361. })
  362. if (res.status == 200) {
  363. this.list.count = this.list.count + this.num;
  364. uni.showToast({
  365. title: res.data.msg,
  366. icon: 'none', //如果要纯文本,不要icon,将值设为'none'
  367. duration: 2000 //持续时间为 2秒
  368. })
  369. }
  370. });
  371. this.specClass = 'hide';
  372. setTimeout(() => {
  373. this.specClass = 'none';
  374. }, 250);
  375. } else if (this.specClass === 'none') {
  376. this.specClass = 'show';
  377. }
  378. return
  379. }
  380. /* 如果点击立即购买则为 2 */
  381. if (index == 2) {
  382. if (this.specClass === 'show') {
  383. this.stock();
  384. let id
  385. // #ifdef MP-WEIXIN
  386. id = uni.getStorageSync('userInfo').id;
  387. // #endif
  388. // #ifdef H5
  389. try{
  390. id = uni.getStorageSync('userInfo').id || uni.getStorageSync('userInfo').userinfo.id;
  391. }catch(e){
  392. console.log(e,'eeee2e');
  393. console.log(uni.getStorageSync('userInfo'),'ddddddddddddddd');
  394. //TODO handle the exception
  395. }
  396. // #endif
  397. let obj = {
  398. sid: 0,
  399. goodstype: this.cache.type,
  400. goodsid: this.cache.id,
  401. num: this.num,
  402. isame: this.list.isadmin,
  403. sku: this.sku.sku,
  404. vipid: id
  405. };
  406. api.fastbuys(obj).then(res => {
  407. if (res.status == 200) {
  408. uni.showToast({
  409. icon: 'loading',
  410. title: '生成订单',
  411. duration: 2000
  412. });
  413. setTimeout(() => {
  414. this.$u.route('/pagesD/pages/order/createOrder', {
  415. id,
  416. sid: 0,
  417. goodstype: this.cache.type,
  418. lasturl: this.list.lasturl,
  419. ftype: 2,
  420. goodsid: this.cache.id,
  421. });
  422. }, 2000);
  423. } else {
  424. this.$u.toast(res.msg);
  425. }
  426. });
  427. this.specClass = 'hide';
  428. setTimeout(() => {
  429. this.isOpen = 0
  430. this.specClass = 'none';
  431. }, 250);
  432. } else if (this.specClass === 'none') {
  433. this.specClass = 'show';
  434. }
  435. return
  436. }
  437. },
  438. //选择规格
  439. selectSpec(index, pid, item) {
  440. let list = item.allitems;
  441. let arr_sku = this.cache.id;
  442. list.forEach(item => {
  443. this.$set(item, 'selected', false);
  444. });
  445. this.$set(list[index], 'selected', true);
  446. for (let cItem of this.list.skuinfo) {
  447. for (let cItem2 of cItem.allitems) {
  448. if (cItem2.checked == 1 && cItem2.selected == true) {
  449. arr_sku += '-' + cItem2.path
  450. }
  451. }
  452. }
  453. if (this.skujson) {
  454. this.sku = this.skujson[arr_sku];
  455. }
  456. },
  457. //分享
  458. opensharebox() {
  459. this.$refs.sbox.opensharebox(this.sharedata);
  460. },
  461. //收藏
  462. toFavorite() {
  463. if (this.timer) return
  464. this.timer = setTimeout(() => {}, 1000)
  465. this.favorite = !this.favorite;
  466. let data = {
  467. id: this.cache.id,
  468. status: Number(this.favorite),
  469. goodstype: this.cache.type
  470. }
  471. api.goodslike(data).then(res => {
  472. this.timer = null
  473. this.$u.toast(res.msg)
  474. if (res.msg == "收藏成功") {
  475. this.goodslike = true
  476. } else if (res.msg == "取消成功") {
  477. this.goodslike = false
  478. }
  479. if (this.isc) {
  480. let pages = getCurrentPages();
  481. let prevPage = pages[pages.length - 2]; //获取到A页面
  482. prevPage.onLoad(); // 执行前一个页面的onLoad方法
  483. }
  484. })
  485. },
  486. // 库存校验
  487. stock() {
  488. if (this.cache.issku == 1) {
  489. if (this.cache.num - this.num < 0) {
  490. this.$api.msg(`该属性产品库存不足!请调整购买数量或选择其他属性!`);
  491. return;
  492. }
  493. } else {
  494. if (this.cache.num - this.num < 0) {
  495. this.$api.msg(`该属性产品库存不足!请调整购买数量或选择其他属性!`);
  496. return;
  497. }
  498. }
  499. },
  500. // 购买
  501. buy(e) {
  502. let that = this;
  503. if(that.ifpeon) {
  504. if (this.tarpty[0]!='tgxy') {
  505. this.$api.msg(`请同意${that.partyinfo.name}`);
  506. return;
  507. }
  508. }
  509. that.isOpen = e
  510. // #ifdef MP-WEIXIN
  511. if (that.$store.state.islogin()) {
  512. that.toggleSpec(that.isOpen)
  513. } else {
  514. that.$refs.nologin.open();
  515. }
  516. // #endif
  517. // #ifdef H5 || APP-PLUS
  518. that.toggleSpec(that.isOpen)
  519. // #endif
  520. },
  521. // 计步器
  522. valChange(e) {
  523. },
  524. stopPrevent() {},
  525. shoopgoods(id) {
  526. let that = this;
  527. api.shoopgoods({
  528. id: id + ''
  529. }).then(res => {
  530. let arr = []; //创建空数组
  531. if (res.status == 200) {
  532. if(res.data.party && res.data.party.id) {
  533. that.ifpeon = true
  534. that.partyinfo = res.data.party
  535. that.parttext = that.partyinfo.content
  536. console.log(res.data.party,'res.data.party');
  537. }
  538. that.sharedata = res.data.sharedata;
  539. that.farm_info=res.data.farm;
  540. that.sharedata.title = res.data.cache.name;
  541. that.sharedata.path = '/pagesD/pages/product/product?pid=' + that.$getuid() + '&id=' + id;
  542. that.list = res.data;
  543. that.cache = res.data.cache;
  544. that.apppic = res.data.apppic;
  545. that.appalbum = res.data.appalbum
  546. that.$store.state.lasturl = res.data.lasturl
  547. if (res.data.cache.issku == 1 && res.data.skujson !== "") {
  548. that.skujson = JSON.parse(res.data.skujson);
  549. } else {
  550. that.sku = {
  551. num: that.cache.num,
  552. price: that.cache.price
  553. };
  554. }
  555. that.favorite = that.cache.islike == 1 ? true : false
  556. /* 处理富文本*/
  557. that.cache.content = that.cache.content.replace(/\<img src="/gi,
  558. `<img style='width:100%;display:block' src="${that.settingFile.root_rich_img}`);
  559. if (res.data.skuinfo) {
  560. for (let cItem of res.data.skuinfo) {
  561. let num = 1;
  562. for (let cItem2 of cItem.allitems) {
  563. if (num == 1) {
  564. that.$set(cItem2, 'selected', false);
  565. arr.push(cItem2);
  566. }
  567. num++;
  568. }
  569. }
  570. }
  571. if (arr && arr.length > 0) {
  572. let arr_sku = that.cache.id;
  573. arr.forEach(item => {
  574. arr_sku += '-' + item.path
  575. /* 默认取第一个*/
  576. that.$set(item, 'selected', true);
  577. that.specSelected.push(item);
  578. })
  579. if (that.skujson) {
  580. that.sku = that.skujson[arr_sku];
  581. }
  582. }
  583. } else {
  584. that.$u.toast(res.msg);
  585. }
  586. });
  587. },
  588. gouwuche() {
  589. this.$u.route('pagesE/pages/cart/cart')
  590. }
  591. }
  592. };
  593. </script>
  594. <style lang="scss">
  595. /deep/.buy-now-btn:after {
  596. border: 0rpx
  597. }
  598. /deep/.add-cart-btn:after {
  599. border: 0rpx
  600. }
  601. page {
  602. background: $page-color-base;
  603. padding-bottom: 160upx;
  604. }
  605. .icon-you {
  606. font-size: $font-base + 2upx;
  607. color: #888;
  608. }
  609. .row-between {
  610. display: flex;
  611. justify-content: space-between;
  612. padding: 20rpx;
  613. }
  614. .carousel {
  615. height: 750rpx;
  616. position: relative;
  617. swiper {
  618. height: 100%;
  619. }
  620. .image-wrapper {
  621. width: 100%;
  622. height: 100%;
  623. }
  624. .swiper-item {
  625. display: flex;
  626. justify-content: center;
  627. align-content: center;
  628. height:750rpx;
  629. overflow: hidden;
  630. image {
  631. width: 100%;
  632. height: 100%;
  633. }
  634. }
  635. }
  636. /* 标题简介 */
  637. .introduce-section {
  638. background: #fff;
  639. padding: 20upx 30upx;
  640. .title {
  641. font-size: 32upx;
  642. color: $font-color-dark;
  643. height: 50upx;
  644. line-height: 50upx;
  645. }
  646. .price-box {
  647. display: flex;
  648. align-items: baseline;
  649. height: 64upx;
  650. padding: 10upx 0;
  651. font-size: 26upx;
  652. color: $uni-color-primary;
  653. }
  654. .price {
  655. font-size: $font-lg + 2upx;
  656. }
  657. .m-price {
  658. margin: 0 12upx;
  659. color: $font-color-light;
  660. text-decoration: line-through;
  661. }
  662. .coupon-tip {
  663. align-items: center;
  664. padding: 4upx 10upx;
  665. background: $uni-color-primary;
  666. font-size: $font-sm;
  667. color: #fff;
  668. border-radius: 6upx;
  669. line-height: 1;
  670. transform: translateY(-4upx);
  671. }
  672. .bot-row {
  673. display: flex;
  674. align-items: center;
  675. height: 50upx;
  676. font-size: $font-sm;
  677. color: $font-color-light;
  678. text {
  679. flex: 1;
  680. }
  681. }
  682. }
  683. /* 分享 */
  684. .share-section {
  685. display: flex;
  686. align-items: center;
  687. color: $font-color-base;
  688. background: linear-gradient(left, #fdf5f6, #fbebf6);
  689. padding: 12upx 30upx;
  690. .share-icon {
  691. display: flex;
  692. align-items: center;
  693. width: 70upx;
  694. height: 30upx;
  695. line-height: 1;
  696. border: 1px solid $uni-color-primary;
  697. border-radius: 4upx;
  698. position: relative;
  699. overflow: hidden;
  700. font-size: 22upx;
  701. color: $uni-color-primary;
  702. justify-content: center;
  703. display: flex;
  704. &:after {
  705. content: '';
  706. width: 50upx;
  707. height: 50upx;
  708. border-radius: 50%;
  709. left: -20upx;
  710. top: -12upx;
  711. position: absolute;
  712. // background: $uni-color-primary;
  713. }
  714. }
  715. .icon-xingxing {
  716. position: relative;
  717. z-index: 1;
  718. font-size: 24upx;
  719. color: #fff;
  720. line-height: 1;
  721. }
  722. .tit {
  723. font-size: $font-base;
  724. margin-left: 10upx;
  725. }
  726. .icon-bangzhu1 {
  727. padding: 10upx;
  728. font-size: 30upx;
  729. line-height: 1;
  730. }
  731. .share-btn {
  732. flex: 1;
  733. display: flex;
  734. display: flex;
  735. justify-content: flex-end;
  736. font-size: $font-sm;
  737. color: $uni-color-primary;
  738. }
  739. .icon-you {
  740. font-size: $font-sm;
  741. margin-left: 4upx;
  742. color: $uni-color-primary;
  743. }
  744. }
  745. .c-list {
  746. font-size: $font-sm + 2upx;
  747. color: $font-color-base;
  748. background: #fff;
  749. .c-row {
  750. display: flex;
  751. align-items: center;
  752. padding: 20upx 30upx;
  753. position: relative;
  754. }
  755. .tit {
  756. width: 140upx;
  757. }
  758. .con {
  759. flex: 1;
  760. color: $font-color-dark;
  761. .selected-text {
  762. margin-right: 10upx;
  763. }
  764. }
  765. .bz-list {
  766. font-size: $font-sm + 2upx;
  767. color: $font-color-dark;
  768. text {
  769. display: inline-block;
  770. margin-right: 30upx;
  771. line-height: 38upx;
  772. }
  773. }
  774. .con-list {
  775. flex: 1;
  776. display: flex;
  777. flex-direction: column;
  778. color: $font-color-dark;
  779. line-height: 40upx;
  780. }
  781. .red {
  782. color: $uni-color-primary;
  783. }
  784. }
  785. /* 评价 */
  786. .eva-section {
  787. display: flex;
  788. flex-direction: column;
  789. padding: 20upx 30upx;
  790. background: #fff;
  791. margin-top: 16upx;
  792. .e-header {
  793. display: flex;
  794. align-items: center;
  795. height: 70upx;
  796. font-size: $font-sm + 2upx;
  797. color: $font-color-light;
  798. .tit {
  799. font-size: $font-base + 2upx;
  800. color: $font-color-dark;
  801. margin-right: 4upx;
  802. }
  803. .tip {
  804. flex: 1;
  805. text-align: right;
  806. }
  807. .icon-you {
  808. margin-left: 10upx;
  809. }
  810. }
  811. }
  812. .eva-box {
  813. display: flex;
  814. padding: 20upx 0;
  815. .portrait {
  816. flex-shrink: 0;
  817. width: 80upx;
  818. height: 80upx;
  819. border-radius: 100px;
  820. }
  821. .right {
  822. flex: 1;
  823. display: flex;
  824. flex-direction: column;
  825. font-size: $font-base;
  826. color: $font-color-base;
  827. padding-left: 26upx;
  828. .con {
  829. font-size: $font-base;
  830. color: $font-color-dark;
  831. padding: 20upx 0;
  832. }
  833. .bot {
  834. display: flex;
  835. justify-content: space-between;
  836. font-size: $font-sm;
  837. color: $font-color-light;
  838. }
  839. }
  840. }
  841. /* 详情 */
  842. .detail-desc {
  843. background-color: #FFFFFF;
  844. margin-top: 16upx;
  845. line-height: 40rpx;
  846. box-sizing: border-box;
  847. .d-header {
  848. display: flex;
  849. justify-content: center;
  850. align-items: center;
  851. height: 80upx;
  852. font-size: $font-base + 2upx;
  853. position: relative;
  854. text {
  855. padding: 0 20upx;
  856. background: #fff;
  857. position: relative;
  858. z-index: 1;
  859. }
  860. &:after {
  861. position: absolute;
  862. left: 50%;
  863. top: 50%;
  864. transform: translateX(-50%);
  865. width: 300upx;
  866. height: 0;
  867. content: '';
  868. border-bottom: 1px solid #ccc;
  869. }
  870. }
  871. }
  872. /* 规格选择弹窗 */
  873. .attr-content {
  874. padding: 10upx 30upx;
  875. .a-t {
  876. position: relative;
  877. display: flex;
  878. image {
  879. width: 170upx;
  880. height: 170upx;
  881. flex-shrink: 0;
  882. margin-top: -40upx;
  883. border-radius: 8upx;
  884. }
  885. .right {
  886. display: flex;
  887. flex-direction: column;
  888. padding-left: 24upx;
  889. font-size: $font-sm + 2upx;
  890. color: $font-color-base;
  891. line-height: 42upx;
  892. .price {
  893. font-size: $font-lg;
  894. margin-bottom: 10upx;
  895. }
  896. .selected-text {
  897. margin-right: 10upx;
  898. }
  899. }
  900. }
  901. .attr-list {
  902. display: flex;
  903. flex-direction: column;
  904. font-size: $font-base + 2upx;
  905. color: $font-color-base;
  906. padding-top: 30upx;
  907. padding-left: 10upx;
  908. }
  909. .item-list {
  910. padding: 20upx 0 0;
  911. display: flex;
  912. flex-wrap: wrap;
  913. text {
  914. display: flex;
  915. align-items: center;
  916. justify-content: center;
  917. background: #eee;
  918. margin-right: 20upx;
  919. margin-bottom: 20upx;
  920. border-radius: 100upx;
  921. min-width: 60upx;
  922. height: 60upx;
  923. padding: 0 20upx;
  924. font-size: $font-base;
  925. color: $font-color-dark;
  926. }
  927. .selected {
  928. background: $tab-color-2;
  929. color: #fff;
  930. }
  931. }
  932. }
  933. /* 弹出层 */
  934. .popup {
  935. position: fixed;
  936. left: 0;
  937. top: 0;
  938. right: 0;
  939. bottom: 0;
  940. z-index: 99;
  941. &.show {
  942. display: block;
  943. .mask {
  944. animation: showPopup 0.2s linear both;
  945. }
  946. .layer {
  947. animation: showLayer 0.2s linear both;
  948. }
  949. }
  950. &.hide {
  951. .mask {
  952. animation: hidePopup 0.2s linear both;
  953. }
  954. .layer {
  955. animation: hideLayer 0.2s linear both;
  956. }
  957. }
  958. &.none {
  959. display: none;
  960. }
  961. .mask {
  962. position: fixed;
  963. top: 0;
  964. width: 100%;
  965. height: 100%;
  966. z-index: 1;
  967. background-color: rgba(0, 0, 0, 0.4);
  968. }
  969. .layer {
  970. position: fixed;
  971. z-index: 99;
  972. bottom: 0;
  973. width: 94%;
  974. min-height: 40vh;
  975. border-radius: 10upx 10upx 0 0;
  976. background-color: #fff;
  977. .btn {
  978. height: 66upx;
  979. line-height: 66upx;
  980. border-radius: 100upx;
  981. font-size: $font-base + 2upx;
  982. color: #fff;
  983. margin: 30upx auto 20upx;
  984. }
  985. }
  986. @keyframes showPopup {
  987. 0% {
  988. opacity: 0;
  989. }
  990. 100% {
  991. opacity: 1;
  992. }
  993. }
  994. @keyframes hidePopup {
  995. 0% {
  996. opacity: 1;
  997. }
  998. 100% {
  999. opacity: 0;
  1000. }
  1001. }
  1002. @keyframes showLayer {
  1003. 0% {
  1004. transform: translateY(120%);
  1005. }
  1006. 100% {
  1007. transform: translateY(0%);
  1008. }
  1009. }
  1010. @keyframes hideLayer {
  1011. 0% {
  1012. transform: translateY(0);
  1013. }
  1014. 100% {
  1015. transform: translateY(120%);
  1016. }
  1017. }
  1018. }
  1019. /* 底部操作菜单 */
  1020. .page-bottom {
  1021. position: fixed;
  1022. left: 30upx;
  1023. bottom: 30upx;
  1024. z-index: 95;
  1025. display: flex;
  1026. justify-content: center;
  1027. align-items: center;
  1028. width: 690upx;
  1029. height: 100upx;
  1030. background: rgba(255, 255, 255, 0.9);
  1031. box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
  1032. border-radius: 16upx;
  1033. .p-b-btn {
  1034. position: relative;
  1035. display: flex;
  1036. flex-direction: column;
  1037. align-items: center;
  1038. justify-content: center;
  1039. font-size: $font-sm;
  1040. color: $font-color-base;
  1041. width: 96upx;
  1042. height: 80upx;
  1043. .yticon {
  1044. font-size: 40upx;
  1045. line-height: 48upx;
  1046. color: $font-color-light;
  1047. }
  1048. &.active,
  1049. &.active .yticon {}
  1050. .icon-fenxiang2 {
  1051. font-size: 42upx;
  1052. transform: translateY(-2upx);
  1053. }
  1054. .icon-shoucang {
  1055. font-size: 46upx;
  1056. }
  1057. .badge {
  1058. position: absolute;
  1059. top: -10rpx;
  1060. right: 8rpx;
  1061. }
  1062. }
  1063. .action-btn-group {
  1064. display: flex;
  1065. height: 76upx;
  1066. border-radius: 100px;
  1067. overflow: hidden;
  1068. margin-left: 20upx;
  1069. position: relative;
  1070. &:after {
  1071. content: '';
  1072. position: absolute;
  1073. top: 50%;
  1074. right: 50%;
  1075. transform: translateY(-50%);
  1076. height: 28upx;
  1077. width: 0;
  1078. border-right: 1px solid rgba(255, 255, 255, 0.5);
  1079. }
  1080. .action-btn {
  1081. display: flex;
  1082. align-items: center;
  1083. justify-content: center;
  1084. width: 180upx;
  1085. height: 100%;
  1086. font-size: $font-base;
  1087. padding: 0;
  1088. border-radius: 0;
  1089. background: transparent;
  1090. }
  1091. }
  1092. }
  1093. .text_area {
  1094. .shop_name {
  1095. display: flex;
  1096. justify-content: space-between;
  1097. align-items: center;
  1098. .shop_thumbnail {
  1099. width: 80rpx;
  1100. height: 80rpx;
  1101. border-radius: 50%;
  1102. }
  1103. .right_shop_mess {
  1104. width: calc(100% - 90rpx);
  1105. // margin-left: 15rpx;
  1106. .shop_line {
  1107. display: flex;
  1108. justify-content: space-between;
  1109. align-items: center;
  1110. .shop_line_p1 {
  1111. color: #1f1f1f;
  1112. font-size: 32rpx;
  1113. padding-left: 3rpx;
  1114. font-weight: 300;
  1115. }
  1116. .shop_line_p2 {
  1117. width: 100%;
  1118. display: flex;
  1119. align-items: center;
  1120. .address {
  1121. color: #333;
  1122. font-size: 26rpx;
  1123. overflow: hidden;
  1124. text-overflow: ellipsis;
  1125. white-space: nowrap;
  1126. }
  1127. }
  1128. }
  1129. .shop_line_fl {
  1130. display: flex;
  1131. justify-content: flex-start;
  1132. align-items: center;
  1133. margin: 5rpx 0;
  1134. }
  1135. .right_shop_mess_p2 {
  1136. border: 1rpx solid #cccccc;
  1137. color: #666;
  1138. font-size: 24rpx;
  1139. padding: 12rpx 20rpx;
  1140. border-radius: 40rpx;
  1141. }
  1142. }
  1143. }
  1144. }
  1145. .shop_one {
  1146. display: flex;
  1147. justify-content: space-evenly;
  1148. padding: 30rpx 0rpx;
  1149. .shop_one_1 {
  1150. display: flex;
  1151. flex-direction: column;
  1152. align-items: center;
  1153. .view1 {
  1154. font-size: 28rpx;
  1155. margin-bottom: 10rpx;
  1156. }
  1157. .view2 {
  1158. font-size: 24rpx;
  1159. color: #999999;
  1160. }
  1161. }
  1162. }
  1163. .farm{
  1164. background-color: #ffffff;
  1165. margin-top: 20rpx;
  1166. padding: 20rpx 20rpx 0rpx 20rpx;
  1167. }
  1168. .sel {
  1169. height: 96rpx;
  1170. padding: 0 20rpx;
  1171. display: flex;
  1172. align-items: center;
  1173. border-bottom: 1px solid #f2f2f2;
  1174. background-color: #ffffff;
  1175. }
  1176. .sel .ipt {
  1177. height: 40rpx;
  1178. width: 40rpx;
  1179. border-radius: 10rpx;
  1180. }
  1181. .sel .text {
  1182. position: relative;
  1183. top: -2rpx;
  1184. font-size: 26rpx;
  1185. font-family: PingFang SC;
  1186. font-weight: 500;
  1187. color: rgba(0, 0, 0, 1);
  1188. }
  1189. </style>