product.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. <template>
  2. <view class="container">
  3. <!-- 轮播图 -->
  4. <top-swiper :imgList="imgList"></top-swiper>
  5. <view class="sckill-top" v-if="isSckill">
  6. <view class="top-left">
  7. <view class="left-top">限时秒杀价</view>
  8. <view class="left-btm">
  9. <text class="now-pri">{{ sckillGoodInfo.price }}</text>
  10. <text class="old-pri">¥{{ sckillGoodInfo.ot_price }}</text>
  11. </view>
  12. </view>
  13. <view class="top-right">
  14. <view class="right-top">距离本场结束还剩</view>
  15. <uni-countdown
  16. class="timeBox"
  17. color="#901b21"
  18. background-color="#fff"
  19. splitor-color="#fff"
  20. :show-day="false"
  21. :hour="stopTimes.hours"
  22. :minute="stopTimes.minutes"
  23. :second="stopTimes.seconds"
  24. ></uni-countdown>
  25. </view>
  26. </view>
  27. <!-- 标题 -->
  28. <product-content :goodsObjact="goodsObjact" v-if="!isSckill"></product-content>
  29. <view class="good-title clamp2" v-if="isSckill">{{ sckillGoodInfo.title }}</view>
  30. <!-- 选择数量 -->
  31. <!-- <view class="row b-b">
  32. <text class="tit">选择</text>
  33. <picker mode="selector" :range="choNum" @change="bindChange">
  34. <view class="refund" v-if="goodsNumber !== 1">{{ goodsNumber || '请选择' }}</view>
  35. <view class="noRefund" v-else>请选择购买数量</view>
  36. </picker>
  37. </view> -->
  38. <!-- 拼货时间及优惠 -->
  39. <!-- <discounts @clickCoupon="Getcoupon" :Info="goodsObjact.store_info" :showCoupon="true"></discounts> -->
  40. <!-- 猜你喜欢 -->
  41. <!-- <guess-like @Addcar='Addcar' @clickNavTo='navToDetailPage' :goodList = 'good_list||[]'></guess-like> -->
  42. <!-- 店铺信息 -->
  43. <view class="shop-info">
  44. <view class="shop-logo"><image :src="shopInfo.mer_avatar" mode=""></image></view>
  45. <view class="shop-base">
  46. <view class="base-name">{{ shopInfo.mer_name }}</view>
  47. <view class="base-addr clamp">{{ shopInfo.mer_address }}</view>
  48. </view>
  49. <view class="shop-dis">
  50. <image src="../../static/icon/base_addr.png" mode="aspectFill"></image>
  51. 距离200m
  52. </view>
  53. </view>
  54. <!-- 评价 -->
  55. <estimate @navTo="navTo('/pages/product/reply?id=' + product_id)" v-if="reply" :reply="reply" :list="list"></estimate>
  56. <!-- 规格信息 -->
  57. <!-- <fresh-detail :goodsObjact="goodsObjact"></fresh-detail> -->
  58. <!-- 图文详情 -->
  59. <content-text :description="description"></content-text>
  60. <!-- 底部高度撑开 -->
  61. <view class="contentBottomHeight"></view>
  62. <!-- 底部操作菜单 -->
  63. <product-bottom @buy="buy" :goodsid="goodsid" @specOPne="specOPne"></product-bottom>
  64. <!-- 规格-模态层弹窗 -->
  65. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
  66. <!-- 遮罩层 -->
  67. <view class="mask"></view>
  68. <view class="layer attr-content" @click.stop="stopPrevent">
  69. <view class="a-t">
  70. <image :src="actionImage"></image>
  71. <view class="right">
  72. <text class="name">{{ sckillGoodInfo.title }}</text>
  73. <text class="price">¥{{ actionPrice * goodsNumber }}</text>
  74. <text class="stock">库存:{{ goodsStore }}件</text>
  75. <view class="selected" v-if="specList != ''">
  76. 已选:
  77. <text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
  78. </view>
  79. </view>
  80. </view>
  81. <view v-for="(item, index) in specList" :key="index" class="attr-list">
  82. <text>{{ item.attr_name }}</text>
  83. <view class="item-list">
  84. <text
  85. v-for="(childItem, childIndex) in item.attr_value"
  86. :key="childIndex"
  87. class="tit"
  88. :class="{ selected: childItem.check }"
  89. @click="selectSpec(childItem, item, index)"
  90. >
  91. {{ childItem.attr }}
  92. </text>
  93. </view>
  94. </view>
  95. <view class="attr-list">
  96. <text>购买数量</text>
  97. <view class="item-list">
  98. <uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax" @eventChange="numberChange"></uni-number-box>
  99. </view>
  100. </view>
  101. <button class="btn" @click.stop="buy" v-show="buys_show">完成</button>
  102. <button class="btn" style="background-color: #999999;" v-show="buys_shows">售罄</button>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import { goodsDetail, cartAdd, seckillGoods, getSeckillProductDetail, getStoreDetail } from '@/api/product.js';
  109. import { mapState } from 'vuex';
  110. import store from '@/store/index.js';
  111. import { saveUrl } from '@/utils/loginUtils.js';
  112. // #ifdef H5
  113. import { weixindata } from '@/utils/wxAuthorized';
  114. // #endif
  115. // 头部轮播图
  116. import topSwiper from './common/topSwiper.vue';
  117. // 标题
  118. import productContent from './common/productContent.vue';
  119. // 到货时间及优惠
  120. import discounts from './common/discounts.vue';
  121. // 规格信息
  122. import freshDetail from './common/freshDetail.vue';
  123. // 图文详情
  124. import contentText from './common/contentText.vue';
  125. // 底部按钮
  126. import productBottom from './common/productBottom.vue';
  127. // 猜你喜欢
  128. import guessLike from './common/guessLike.vue';
  129. // 评价
  130. import estimate from './common/estimate.vue';
  131. import uniNumberBox from '@/components/uni-number-box.vue';
  132. import { timeComputed } from '@/utils/rocessor.js';
  133. export default {
  134. components: {
  135. guessLike,
  136. topSwiper,
  137. productContent,
  138. discounts,
  139. freshDetail,
  140. contentText,
  141. productBottom,
  142. estimate,
  143. uniNumberBox
  144. },
  145. data() {
  146. return {
  147. goodsStore: 0, //选中库存
  148. specList: [],
  149. buys_show: true,
  150. buys_shows: false,
  151. specSelected: [], //选中的分类
  152. specClass: 'none', //显示隐藏弹窗
  153. many: 1, //1是单规格 2是多规格
  154. reply: '', //评论
  155. list: '', //商品详情的数据
  156. type: 1, //默认支付方式add为
  157. goodsType: 0,
  158. goodsNumber: 1, //购买数量
  159. goodsid: '', //商品id
  160. description: '', //商品描述
  161. goodsObjact: {
  162. percent: 1
  163. }, //保存商品数据
  164. //图片循环
  165. imgList: [], //顶部轮播图
  166. // 对比对象
  167. actionPrice: 0, //默认选中商品价格
  168. actionImage: '', //默认选中图片
  169. good_list: '', //猜你喜欢列表
  170. goodsNumberMax: 0, //最大可购买数量
  171. // 倒计时数据保存
  172. seckillObj: {
  173. stopTime: 0, //结束时间
  174. stop: false, //是否结束
  175. stopTimeH: 0, //小时
  176. stopTimeM: 0, //分钟
  177. stopTimeS: 0, //秒钟
  178. stopTimeD: 0, //天
  179. upTime: 0 //更新组件内部组件用
  180. },
  181. // 拼团数据保存
  182. pink: {
  183. id: '', //拼团编号
  184. uid: '', //用户编号
  185. people: '', //拼团人数
  186. price: '', //拼团价格
  187. stop_time: '', //拼团结束时间
  188. nickname: '', //团长昵称
  189. avatar: '', //团长头像
  190. count: '', //拼团剩余人数
  191. h: '', //时
  192. i: '', //分
  193. s: '' //秒
  194. },
  195. userInfo: '',
  196. isSckill: false,
  197. stopTimes: {
  198. hours: 0,
  199. minutes: 0,
  200. seconds: 0,
  201. day: 0,
  202. tpye: false
  203. },
  204. product_id: 0,
  205. sckillGoodInfo: {}, //秒杀商品信息
  206. shopInfo: {} //店铺信息
  207. };
  208. },
  209. filters: {
  210. parseIntTo(percent) {
  211. percent = +percent * 100;
  212. if (percent % 1 === 0) {
  213. return percent;
  214. } else {
  215. percent = percent.toFixed(1);
  216. return percent;
  217. }
  218. }
  219. },
  220. async onLoad(options) {
  221. console.log(options);
  222. let obj = this;
  223. obj.userInfo = uni.getStorageSync('userInfo');
  224. //保存商品id
  225. this.goodsid = options.id;
  226. this.getGoodsDetails();
  227. this.product_id = options.id;
  228. this.goodsType = options.type;
  229. // 判断有无人邀请
  230. if (options.spread) {
  231. // 存储邀请人
  232. uni.setStorageSync('spread', options.spread);
  233. }
  234. saveUrl();
  235. // if(options.type === '1') {
  236. // obj.getGoodInfo()
  237. // // obj.getTime()
  238. // this.product_id = options.product_id
  239. // console.log('this.product_id',this.product_id)
  240. // obj.isSckill = true
  241. // }else {
  242. // this.goodsDetail();
  243. // }
  244. if (options.type === '1') {
  245. obj.isSckill = true;
  246. }
  247. // 注册邀请信息
  248. // #ifdef H5
  249. let bool = uni.getStorageSync('weichatBrowser') || '';
  250. if (bool) {
  251. weixindata();
  252. }
  253. // #endif
  254. },
  255. computed: {
  256. ...mapState(['weichatObj', 'baseURL', 'urlFile']),
  257. choNum() {
  258. let a = [];
  259. for (let i = 1; i <= this.goodsNumberMax; i++) {
  260. a.push(i);
  261. }
  262. return a;
  263. }
  264. },
  265. // 分享
  266. onShareAppMessage(options) {
  267. // 设置菜单中的转发按钮触发转发事件时的转发内容
  268. let pages = getCurrentPages(); //获取加载的页面
  269. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  270. let url = currentPage.route; //当前页面url
  271. let item = currentPage.options; //如果要获取url中所带的参数可以查看options
  272. let shareObj = {
  273. title: this.goodsObjact.store_name + ' 价格:' + this.goodsObjact.price, // 默认是小程序的名称(可以写slogan等)
  274. path: url + '?id=' + item.id + '&spread=' + this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
  275. imageUrl: this.goodsObjact.image,
  276. success: function(res) {
  277. // 转发成功之后的回调
  278. if (res.errMsg == 'shareAppMessage:ok') {
  279. }
  280. },
  281. fail: function() {
  282. // 转发失败之后的回调
  283. if (res.errMsg == 'shareAppMessage:fail cancel') {
  284. // 用户取消转发
  285. } else if (res.errMsg == 'shareAppMessage:fail') {
  286. // 转发失败,其中 detail message 为详细失败信息
  287. }
  288. }
  289. };
  290. return shareObj;
  291. },
  292. methods: {
  293. //选择规格
  294. selectSpec(item, arr, ind) {
  295. arr.attr_value.forEach(function(e) {
  296. e.check = false;
  297. });
  298. item.check = true;
  299. let obj = this;
  300. obj.specSelected[ind] = item.attr;
  301. let str = obj.specSelected.join(',');
  302. // 获取当前选中的对象
  303. if (obj.productValue[str]) {
  304. obj.buys_show = true;
  305. obj.buys_shows = false;
  306. obj.actionPrice = obj.productValue[str].price;
  307. obj.goodsNumberMax = obj.productValue[str].stock;
  308. obj.actionImage = obj.productValue[str].image;
  309. obj.uniqueId = obj.productValue[str].unique;
  310. obj.goodsStore = obj.productValue[str].stock;
  311. console.log(obj.uniqueId, '++++++++obj.uniqueId');
  312. } else {
  313. obj.buys_show = false
  314. obj.buys_shows = true
  315. }
  316. if (obj.goodsStore == 0) {
  317. obj.buys_show = false;
  318. obj.buys_shows = true;
  319. }
  320. obj.specSelected[ind] = item.attr;
  321. },
  322. // 打開彈窗
  323. specOPne(type = 1) {
  324. let obj = this;
  325. obj.specClass = 'show';
  326. obj.type = type;
  327. },
  328. //规格弹窗开关
  329. toggleSpec(str) {
  330. if (this.specClass === 'show') {
  331. this.specClass = 'hide';
  332. setTimeout(() => {
  333. this.specClass = 'none';
  334. }, 250);
  335. } else if (this.specClass === 'none') {
  336. this.specClass = 'show';
  337. }
  338. // 保存当前购买类型
  339. this.type = str;
  340. },
  341. //领取优惠券
  342. Getcoupon() {
  343. uni.navigateTo({
  344. url: '/pages/coupon/getcoupon'
  345. });
  346. },
  347. //详情页
  348. navToDetailPage(item) {
  349. let id = item.id;
  350. uni.navigateTo({
  351. url: '/pages/product/product?id=' + id
  352. });
  353. },
  354. // 跳转页面
  355. navTo(url) {
  356. uni.navigateTo({
  357. url
  358. });
  359. },
  360. //加入购物车
  361. Addcar(item) {
  362. let obj = this;
  363. console.log('加入购物车', obj.goodsNumber);
  364. cartAdd({
  365. // cartNum: '1', //商品数量
  366. cartNum: obj.goodsNumber,
  367. uniqueId: '', //商品标签
  368. new: 0, //商品是否新增加到购物车1为不加入0为加入
  369. mer_id: '',
  370. productId: item.id //商品编号
  371. })
  372. .then(function(e) {
  373. uni.showToast({
  374. title: '成功加入购物车',
  375. type: 'top',
  376. duration: 500,
  377. icon: 'none'
  378. });
  379. obj.goodsDetail();
  380. })
  381. .catch(e => {
  382. console.log(e);
  383. });
  384. },
  385. goodsDetail() {
  386. let obj = this;
  387. // 获取普通商品信息
  388. goodsDetail({}, this.goodsid).then(function({ data }) {
  389. obj.list = data;
  390. console.log(data);
  391. obj.good_list = data.good_list; //保存猜你喜欢列表
  392. obj.reply = data.reply; //保存评论列表
  393. let goods = data.storeInfo;
  394. obj.goodsObjact = goods;
  395. console.log(obj.goodsObjact, '++++++++++++++');
  396. if (obj.goodsObjact.description != null) {
  397. obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
  398. } //小程序商品详情图超出屏幕问题
  399. obj.imgList = goods.slider_image; //保存轮播图
  400. obj.specList = data.productAttr; //保存分类列表
  401. if (Array.isArray(data.productValue) != true) {
  402. obj.many = 2;
  403. obj.specList = data.productAttr; //保存产品属性
  404. obj.productValue = data.productValue; //保存属性值
  405. obj.specSelected = []; //初始化默认选择对象
  406. for (let i = 0; i < obj.specList.length; i++) {
  407. // 设置默认数据
  408. let attrValue = obj.specList[i].attr_value[0];
  409. attrValue.check = true;
  410. obj.specSelected.push(attrValue.attr);
  411. }
  412. let str = obj.specSelected.join(',');
  413. console.log(str, 'str');
  414. // 设置默认值
  415. obj.actionPrice = obj.productValue[str].price;
  416. obj.goodsNumberMax = obj.productValue[str].stock;
  417. obj.actionImage = obj.productValue[str].image;
  418. obj.uniqueId = obj.productValue[str].unique;
  419. obj.goodsStore = obj.productValue[str].quota;
  420. } else {
  421. obj.many = 1;
  422. }
  423. obj.productValue = data.productValue; //保存分类查询数据
  424. obj.actionPrice = goods.price; //保存默认选中商品价格
  425. obj.actionImage = goods.image_base; //保存默认选中商品图片
  426. obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
  427. obj.shopId = data.mer_id; //保存商店id
  428. });
  429. },
  430. getGoodInfo() {
  431. let obj = this;
  432. // 获取秒杀商品信息
  433. seckillGoods({}, this.goodsid).then(function({ data }) {
  434. console.log(data);
  435. obj.list = data;
  436. obj.good_list = data.good_list; //保存猜你喜欢列表
  437. obj.reply = data.reply; //保存评论列表
  438. let goods = data.storeInfo;
  439. obj.goodsObjact = goods;
  440. obj.goodsObjact.title = goods.title;
  441. obj.stopTimes = timeComputed(obj.list.isSeckillEnd.stop * 1000);
  442. console.log(obj.stopTimes, 'dddddddddd');
  443. if (obj.goodsObjact.description != null) {
  444. obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
  445. } //小程序商品详情图超出屏幕问题
  446. obj.imgList = goods.images; //保存轮播图
  447. obj.specList = data.productAttr; //保存分类列表
  448. if (Array.isArray(data.productValue) != true) {
  449. obj.many = 2;
  450. obj.specList = data.productAttr; //保存产品属性
  451. obj.productValue = data.productValue; //保存属性值
  452. console.log(obj.productValue, 'obj.productValue++++++++');
  453. obj.specSelected = []; //初始化默认选择对象
  454. for (let i = 0; i < obj.specList.length; i++) {
  455. // 设置默认数据
  456. let attrValue = obj.specList[i].attr_value[0];
  457. attrValue.check = true;
  458. obj.specSelected.push(attrValue.attr);
  459. }
  460. let str = obj.specSelected.join(',');
  461. console.log(str, 'str');
  462. // 设置默认值
  463. obj.actionPrice = obj.productValue[str].price;
  464. obj.goodsNumberMax = obj.productValue[str].stock;
  465. obj.actionImage = obj.productValue[str].image;
  466. obj.uniqueId = obj.productValue[str].unique;
  467. console.log(obj.uniqueId, 'obj.uniqueId+++默认');
  468. obj.goodsStore = obj.productValue[str].quota;
  469. } else {
  470. obj.many = 1;
  471. }
  472. obj.productValue = data.productValue; //保存分类查询数据
  473. obj.actionPrice = goods.price; //保存默认选中商品价格
  474. obj.actionImage = goods.image_base; //保存默认选中商品图片
  475. obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
  476. obj.shopId = data.mer_id; //保存商店id
  477. });
  478. },
  479. // 立即购买
  480. buy() {
  481. let obj = this;
  482. // 创建传值对象
  483. let goodId = obj.goodsid;
  484. if (obj.isSckill) {
  485. goodId = obj.product_id;
  486. }
  487. console.log('添加的数量', obj.goodsNumber);
  488. let data = {
  489. cartNum: obj.goodsNumber, //商品数量
  490. new: 1,
  491. productId: goodId, //商品编号
  492. uniqueId: obj.uniqueId
  493. };
  494. console.log(data);
  495. if (obj.type == 2) {
  496. data.new = 0;
  497. }
  498. cartAdd(data)
  499. .then(function(e) {
  500. let da = e.data;
  501. if (obj.type == 1) {
  502. // 跳转到支付页
  503. uni.navigateTo({
  504. url: '/pages/order/createOrder?id=' + da.cartId
  505. });
  506. }
  507. if (obj.type == 2) {
  508. uni.showToast({
  509. title: '成功加入购物车',
  510. type: 'top',
  511. duration: 2000,
  512. icon: 'none'
  513. });
  514. obj.goodsDetail();
  515. }
  516. obj.toggleSpec();
  517. })
  518. .catch(e => {
  519. console.log(e);
  520. });
  521. },
  522. // 阻止触发上级事件
  523. stopPrevent() {},
  524. bindChange(e) {
  525. this.goodsNumber = this.choNum[e.detail.value] * 1;
  526. console.log(this.goodsNumber);
  527. },
  528. numberChange(e) {
  529. //购买数量
  530. this.chooseGoodsNumber = e.number;
  531. this.goodsNumber = e.number;
  532. },
  533. // getTime() {
  534. // let start = new data()
  535. // }
  536. getGoodsDetails() {
  537. let obj = this;
  538. getSeckillProductDetail({}, this.goodsid).then(({ data }) => {
  539. console.log(data, 'goodInfo6666666666666');
  540. obj.imgList = data.slider_image; //保存轮播图
  541. obj.sckillGoodInfo.title = data.store_name; //保存商品名称
  542. obj.sckillGoodInfo.price = data.price; //保存商品展示价格
  543. obj.sckillGoodInfo.ot_price = data.ot_price; //保存商品市场价
  544. obj.stopTimes = timeComputed(data.stop * 1000); //设置结束时间
  545. obj.shopInfo.name = data.merchant.mer_name; //保存店铺名称
  546. obj.shopInfo.logo = data.merchant.mer_avatar; //保存店铺logo
  547. //小程序商品详情图超出屏幕问题
  548. if (data.content.content !== null) {
  549. obj.description = data.content.content.replace(/\<img/gi, '<img class="rich-img"');
  550. }
  551. //获取保存店铺详细信息
  552. getStoreDetail(data.mer_id).then(({ data }) => {
  553. console.log(data, 'shop data');
  554. obj.shopInfo = data;
  555. });
  556. // 获取商品属性
  557. obj.specList = data.attr; //保存分类列表
  558. if (Array.isArray(data.attr) == true) {
  559. obj.many = 2;
  560. obj.specList = data.attr; //保存产品属性
  561. obj.productValue = data.sku; //保存属性值
  562. obj.specSelected = []; //初始化默认选择对象
  563. for (let i = 0; i < obj.specList.length; i++) {
  564. // 设置默认数据
  565. let attrValue = obj.specList[i].attr_value[0];
  566. attrValue.check = true;
  567. obj.specSelected.push(attrValue.attr);
  568. }
  569. let str = obj.specSelected.join(',');
  570. console.log(str, 'str');
  571. // 设置默认值
  572. obj.actionPrice = obj.productValue[str].price;
  573. obj.goodsNumberMax = obj.productValue[str].stock;
  574. obj.actionImage = obj.productValue[str].image;
  575. obj.uniqueId = obj.productValue[str].unique;
  576. obj.goodsStore = obj.productValue[str].quota;
  577. } else {
  578. obj.many = 1;
  579. obj.productValue = data.sku; //保存分类查询数据
  580. obj.actionPrice = data.price; //保存默认选中商品价格
  581. obj.actionImage = data.image; //保存默认选中商品图片
  582. obj.goodsNumberMax = data.stock; //保存默认选中最大可购买商品数量
  583. obj.shopId = data.mer_id; //保存商店id
  584. obj.goodsStore = data.stock
  585. }
  586. });
  587. }
  588. }
  589. };
  590. </script>
  591. <style lang="scss">
  592. /* 弹出层 */
  593. .popup {
  594. position: fixed;
  595. left: 0;
  596. top: 0;
  597. right: 0;
  598. bottom: 0;
  599. z-index: 99;
  600. &.show {
  601. display: block;
  602. .mask {
  603. animation: showPopup 0.2s linear both;
  604. }
  605. .layer {
  606. animation: showLayer 0.2s linear both;
  607. }
  608. }
  609. &.hide {
  610. .mask {
  611. animation: hidePopup 0.2s linear both;
  612. }
  613. .layer {
  614. animation: hideLayer 0.2s linear both;
  615. }
  616. }
  617. &.none {
  618. display: none;
  619. }
  620. .mask {
  621. position: fixed;
  622. top: 0;
  623. width: 100%;
  624. height: 100%;
  625. z-index: 1;
  626. background-color: rgba(0, 0, 0, 0.4);
  627. }
  628. .layer {
  629. position: fixed;
  630. z-index: 99;
  631. bottom: 0;
  632. width: 100%;
  633. min-height: 35vh;
  634. border-radius: 10rpx 10rpx 0 0;
  635. background-color: #fff;
  636. .btn {
  637. height: 66rpx;
  638. line-height: 66rpx;
  639. border-radius: 100rpx;
  640. background: #901b21;
  641. font-size: $font-base + 2rpx;
  642. color: #fff;
  643. margin: 30rpx auto 20rpx;
  644. }
  645. }
  646. @keyframes showPopup {
  647. 0% {
  648. opacity: 0;
  649. }
  650. 100% {
  651. opacity: 1;
  652. }
  653. }
  654. @keyframes hidePopup {
  655. 0% {
  656. opacity: 1;
  657. }
  658. 100% {
  659. opacity: 0;
  660. }
  661. }
  662. @keyframes showLayer {
  663. 0% {
  664. transform: translateY(120%);
  665. }
  666. 100% {
  667. transform: translateY(0%);
  668. }
  669. }
  670. @keyframes hideLayer {
  671. 0% {
  672. transform: translateY(0);
  673. }
  674. 100% {
  675. transform: translateY(120%);
  676. }
  677. }
  678. }
  679. /* 规格选择弹窗 */
  680. .attr-content {
  681. padding: 25rpx 30rpx;
  682. .a-t {
  683. display: flex;
  684. image {
  685. width: 170rpx;
  686. height: 170rpx;
  687. flex-shrink: 0;
  688. border-radius: 8rpx;
  689. }
  690. .right {
  691. display: flex;
  692. flex-direction: column;
  693. padding-left: 24rpx;
  694. font-size: $font-sm + 2rpx;
  695. color: $font-color-base;
  696. line-height: 42rpx;
  697. width: 75%;
  698. .price {
  699. font-size: $font-lg;
  700. color: #901b21;
  701. margin: 10rpx 0rpx;
  702. }
  703. .name {
  704. font-size: 32rpx;
  705. color: $font-color-dark;
  706. height: 50rpx;
  707. overflow: hidden;
  708. text-overflow: ellipsis;
  709. white-space: nowrap;
  710. display: block;
  711. }
  712. .selected-text {
  713. margin-right: 10rpx;
  714. }
  715. }
  716. }
  717. .attr-list {
  718. display: flex;
  719. flex-direction: column;
  720. font-size: $font-base + 2rpx;
  721. color: $font-color-base;
  722. padding-top: 30rpx;
  723. padding-left: 10rpx;
  724. }
  725. .item-list {
  726. padding: 20rpx 0 0;
  727. display: flex;
  728. flex-wrap: wrap;
  729. text {
  730. display: flex;
  731. align-items: center;
  732. justify-content: center;
  733. background: #eee;
  734. margin-right: 20rpx;
  735. margin-bottom: 20rpx;
  736. border-radius: 100rpx;
  737. min-width: 60rpx;
  738. height: 60rpx;
  739. padding: 0 20rpx;
  740. font-size: $font-base;
  741. color: $font-color-dark;
  742. }
  743. .selected {
  744. background: #ddffdf;
  745. color: $uni-color-primary;
  746. }
  747. }
  748. }
  749. //默认商品底部高度
  750. .goodsBottom {
  751. height: 160rpx;
  752. }
  753. page {
  754. background: #f0f0f0;
  755. }
  756. //秒杀、拼团底部高度
  757. .contentBottomHeight {
  758. height: 130rpx;
  759. }
  760. //默认商品底部高度
  761. .goodsBottom {
  762. height: 160rpx;
  763. }
  764. /deep/ .iconenter {
  765. font-size: $font-base + 2rpx;
  766. color: #888;
  767. }
  768. /deep/ .con_image {
  769. width: 130rpx;
  770. height: 130rpx;
  771. display: inline-block;
  772. padding: 15rpx;
  773. image {
  774. width: 100%;
  775. height: 100%;
  776. }
  777. }
  778. /* 商品详情中限制图片大小 */
  779. /deep/ .rich-img {
  780. width: 100% !important;
  781. height: auto;
  782. }
  783. .cho-num {
  784. margin: 20rpx 0;
  785. width: 750rpx;
  786. height: 83rpx;
  787. background: #ffffff;
  788. padding: 29rpx 24rpx 30rpx 25rpx;
  789. font-size: 26rpx;
  790. font-weight: 500;
  791. color: #606972;
  792. }
  793. .row {
  794. display: flex;
  795. align-items: center;
  796. position: relative;
  797. padding: 0 30rpx;
  798. height: 110rpx;
  799. background: #fff;
  800. .refund {
  801. font-size: 30rpx;
  802. color: $font-color-dark;
  803. padding-left: 128rpx;
  804. }
  805. .noRefund {
  806. font-size: 30rpx;
  807. color: $font-color-light;
  808. padding-left: 128rpx;
  809. }
  810. .tit {
  811. flex-shrink: 0;
  812. width: 120rpx;
  813. font-size: 30rpx;
  814. color: $font-color-dark;
  815. }
  816. .input {
  817. flex: 1;
  818. font-size: 30rpx;
  819. color: $font-color-dark;
  820. padding-left: 128rpx;
  821. &.payColor {
  822. color: $color-red;
  823. }
  824. }
  825. .iconlocation {
  826. font-size: 36rpx;
  827. color: $font-color-light;
  828. }
  829. }
  830. .shop-info {
  831. width: 750rpx;
  832. height: 140rpx;
  833. margin: 20rpx 0;
  834. padding: 28rpx 24rpx 22rpx 16rpx;
  835. background-color: #fff;
  836. display: flex;
  837. position: relative;
  838. .shop-logo {
  839. width: 90rpx;
  840. height: 90rpx;
  841. border-radius: 50%;
  842. background-color: red;
  843. // overflow: hidden;
  844. image {
  845. width: 90rpx;
  846. height: 90rpx;
  847. }
  848. }
  849. .shop-base {
  850. padding-left: 15rpx;
  851. // width: 376rpx;
  852. width: 100%;
  853. font-size: 24rpx;
  854. font-weight: 500;
  855. color: #999999;
  856. line-height: 1;
  857. .base-name {
  858. padding-top: 14rpx;
  859. font-size: 30rpx;
  860. padding-bottom: 16rpx;
  861. font-weight: 500;
  862. color: #333333;
  863. }
  864. }
  865. .shop-dis {
  866. padding-top: 31rpx;
  867. position: absolute;
  868. font-size: 24rpx;
  869. font-weight: 500;
  870. color: #901b21;
  871. // line-height: 140rpx;
  872. right: 24rpx;
  873. image {
  874. padding-right: 5rpx;
  875. width: 21rpx;
  876. height: 21rpx;
  877. }
  878. }
  879. }
  880. .sckill-top {
  881. width: 750rpx;
  882. height: 165rpx;
  883. background-image: url(../../static/img/base-sckill.png);
  884. background-size: 100% 100%;
  885. position: relative;
  886. top: -40rpx;
  887. margin-bottom: -40rpx;
  888. display: flex;
  889. justify-content: space-between;
  890. .top-left {
  891. line-height: 1;
  892. .left-top {
  893. padding: 35rpx 0 23rpx 22rpx;
  894. font-size: 44rpx;
  895. font-weight: 500;
  896. color: #ffffff;
  897. line-height: 1;
  898. }
  899. .left-btm {
  900. line-height: 1;
  901. font-size: 30rpx;
  902. font-weight: 500;
  903. // text-decoration: line-through;
  904. color: #ffffff;
  905. .now-pri {
  906. display: inline-block;
  907. padding-right: 8rpx;
  908. font-size: 44rpx;
  909. font-weight: 800;
  910. color: #ffffff;
  911. }
  912. .old-pri {
  913. text-decoration: line-through;
  914. }
  915. }
  916. }
  917. .top-right {
  918. padding: 67rpx 20rpx 18rpx 0;
  919. .right-top {
  920. font-size: 22rpx;
  921. font-weight: 400;
  922. color: #ffffff;
  923. line-height: 1;
  924. padding-bottom: 8rpx;
  925. }
  926. }
  927. }
  928. .good-title {
  929. background-color: #fff;
  930. // height: 142rpx;
  931. padding: 24rpx 19rpx 24rpx 34rpx;
  932. line-height: 1.5;
  933. font-size: 36rpx;
  934. font-weight: 800;
  935. color: #333333;
  936. }
  937. </style>