productGroup.vue 27 KB

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