123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934 |
- <template>
- <view class="container">
-
- <top-swiper :imgList="imgList"></top-swiper>
-
- <group-time :goodsObjact="goodsObjact" :key='goodsObjact.product_price' :seckillObj="seckillObj"></group-time>
-
- <group-content :goodsObjact="goodsObjact"></group-content>
-
- <discounts :mark='goodsObjact.mark' :Info="goodsObjact.info" @clickCoupon="Getcoupon" :showCoupon='false'></discounts>
-
-
-
- {{ ls.nickname }}
- {{ ls.count }}
-
-
-
-
-
-
-
- <content-text :description="description"></content-text>
-
- <view class="contentBottomHeight"></view>
-
- <view >
- <view >
- <group-bottom :peoplePrize='goodsObjact.people_prize' @buy="openPinkT" @specOPne="specOPne" :seckillObj="seckillObj" :many='many'></group-bottom>
- </view>
- </view>
-
- <view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec()">
-
- <view class="mask"></view>
- <view class="layer attr-content" @click.stop="stopPrevent">
- <view class="a-t">
- <image :src="actionImage"></image>
- <view class="right">
- <text class="name">{{ goodsObjact.store_name }}</text>
- <text class="price">¥{{ actionPrice * goodsNumber }}</text>
- <text class="stock">库存:{{ goodsStore }}件</text>
- <view class="selected" v-if="specList != ''">
- 已选:
- <text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
- </view>
- </view>
- </view>
- <view v-for="(item, index) in specList" :key="index" class="attr-list">
- <text>{{ item.attr_name }}</text>
- <view class="item-list">
- <text
- v-for="(childItem, childIndex) in item.attr_value"
- :key="childIndex"
- class="tit"
- :class="{ selected: childItem.check }"
- @click="selectSpec(childItem, item, index)"
- >
- {{ childItem.attr }}
- </text>
- </view>
- </view>
-
- <button class="btn" @click.stop="buy" v-show="buys_show">完成</button>
- <button class="btn" style="background-color: #999999;" v-show="buys_shows">售罄</button>
- </view>
- </view>
-
- <return-button></return-button>
- </view>
- </template>
- <script>
- import { nowPinkLst } from '@/api/order.js';
- import {
- goodsDetail,
- cartAdd,
- collectAdd,
- collectDel,
- seckillGoods,
- groupGoods
- } from '@/api/product.js';
- import {
- mapState
- } from 'vuex';
- import store from '@/store/index.js';
- import {
- saveUrl
- } from '@/utils/loginUtils.js';
- import {
- timeComputed
- } from '@/utils/rocessor.js';
-
- import {
- weixindata
- } from '@/utils/wxAuthorized';
-
-
- import topSwiper from '../common/topSwiper.vue';
-
- import groupTime from '../common/groupTime.vue';
-
- import groupContent from '../common/groupContent.vue';
-
- import discounts from '../common/discounts.vue';
-
- import freshDetail from '../common/freshDetail.vue';
-
- import contentText from '../common/contentText.vue';
-
- import groupBottom from '../common/groupBottom.vue';
-
- import returnButton from '@/components/returnButton.vue';
-
- import NowList from '@/components/newlist/nowList.vue';
- export default {
- components: {
- topSwiper,
- groupTime,
- groupContent,
- discounts,
- freshDetail,
- contentText,
- groupBottom,
- returnButton,
- NowList
- },
- data() {
- return {
- goodsStore: 0,
- specList: [],
- buys_show: true,
- buys_shows: false,
- specSelected: [],
- reply: '',
- list: '',
- type: 1,
- goodsNumber: 1,
- goodsid: '',
- description: '',
- goodsObjact: {},
-
- imgList: [],
-
- actionPrice: 0,
- actionImage: '',
- good_list: '',
- goodsNumberMax: 0,
- many:1,
-
- seckillObj: {
- stopTime: 0,
- stop: false,
- stopTimeH: 0,
- stopTimeM: 0,
- stopTimeS: 0,
- stopTimeD: 0,
- upTime: 0
- },
-
- pink: {
- id: '',
- uid: '',
- people: '',
- price: '',
- stop_time: '',
- nickname: '',
- avatar: '',
- count: '',
- h: '',
- i: '',
- s: ''
- },
- userInfo: '',
- pinkTlist: '',
- more: true,
- showlist: [],
- pink_type: 1,
- show: false,
- recommendedlist:[],
- specClass: 'none'
- };
- },
- filters: {
- parseIntTo(percent) {
- percent = +percent * 100;
- if (percent % 1 === 0) {
- return percent;
- } else {
- percent = percent.toFixed(1);
- return percent;
- }
- }
- },
- async onLoad(options) {
- let obj = this;
- obj.userInfo = uni.getStorageSync('userInfo');
-
- this.goodsid = options.id;
- if (options.show) {
- this.show = options.show;
- }
- console.log(this.show, 5656)
-
- if (options.spread) {
-
- uni.setStorageSync('spread', options.spread);
- }
- saveUrl();
-
- this.groupGoods();
- return;
-
-
-
- let bool = uni.getStorageSync('weichatBrowser') || '';
- if (bool) {
- weixindata();
- }
-
- },
- computed: {
- ...mapState(['weichatObj', 'baseURL', 'urlFile'])
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- methods: {
-
- ToRule() {
- if( this.pink_type == 1 ) {
-
- uni.navigateTo({
- url: '/pages/rule/AArule'
- })
- } else {
-
- uni.navigateTo({
- url: '/pages/rule/DaRrule'
- })
- }
- },
-
- selectSpec(item, arr, ind) {
- arr.attr_value.forEach(function(e) {
- e.check = false;
- });
- item.check = true;
- let obj = this;
- obj.specSelected[ind] = item.attr;
- let str = obj.specSelected.join(',');
- console.log(obj.productValue[str],116)
- if (obj.productValue[str]) {
- obj.buys_show = true;
- obj.buys_shows = false;
- obj.actionPrice = obj.productValue[str].price;
- obj.goodsNumberMax = obj.productValue[str].stock;
- obj.actionImage = obj.productValue[str].image;
- obj.uniqueId = obj.productValue[str].unique;
- obj.goodsStore = obj.productValue[str].stock;
-
-
-
-
-
- } else {
- (obj.buys_show = false), (obj.buys_shows = true);
- }
- },
-
- buy(item) {
- let obj = this;
-
-
- console.log(obj.list.productValue);
- console.log(obj.list);
- let data = {
-
- cartNum: obj.chooseGoodsNumber,
- uniqueId: obj.uniqueId,
- new: 1,
- mer_id: obj.shopId,
- combinationId: obj.goodsid,
- productId: obj.goodsObjact.product_id,
- };
- this.specClass = 'none';
- cartAdd(data)
- .then(function(e) {
- let da = e.data;
- console.log(e);
- if (obj.type == 1) {
-
- uni.navigateTo({
- url: '/pages/order/createOrder?id=' + da.cartId + '&goodsType=' + obj.goodsType
- });
- }
- if (obj.type == 2) {
- obj.$api.msg('成功加入购物车');
- obj.toggleSpec();
- }
- })
- .catch(e => {
- console.log(e);
- });
- },
-
- ToKaiTuan(item) {
- let id = item.id;
- uni.navigateTo({
- url: '/pages/product/productGroup?id=' + id
- });
- },
-
-
- navTo(url) {
- uni.navigateTo({
- url
- });
- },
-
- clickMore() {
- this.showlist = this.pinkTlist;
- console.log(this.showlist, 22);
- this.more = false;
- },
-
- groupBooking(item) {
- uni.navigateTo({
- url: '/pages/groupBooking/groupdetails?id=' + item
- });
- },
-
- groupGoods() {
- let obj = this;
-
-
-
-
-
-
- groupGoods({}, this.goodsid).then(function({
- data
- }) {
- let goods = data.storeInfo;
- obj.goodsObjact = goods;
- console.log(obj.goodsObjact, 88)
- console.log(Array.isArray(data.productValue), 99)
- if(Array.isArray(data.productValue) != true){
- obj.many = 2;
- obj.specList = data.productAttr;
- obj.productValue = data.productValue;
- obj.specSelected = [];
- for (let i = 0; i < obj.specList.length; i++) {
-
- let attrValue = obj.specList[i].attr_value[0];
- attrValue.check = true;
- obj.specSelected.push(attrValue.attr);
- }
- let str = obj.specSelected.join(',');
- console.log(str,'str')
-
-
- obj.actionPrice = obj.productValue[str].price;
- obj.goodsNumberMax = obj.productValue[str].stock;
- obj.actionImage = obj.productValue[str].image;
- obj.uniqueId = obj.productValue[str].unique;
- obj.goodsStore = obj.productValue[str].quota;
- }else{
- obj.many = 1;
- }
- console.log(obj.many,'obj.many')
- if (obj.goodsObjact.description != null) {
- obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
- }
- obj.imgList = goods.images;
- obj.actionPrice = goods.price;
- obj.actionImage = goods.image_base;
- obj.goodsNumberMax = 1;
- if (obj.goodsObjact.pink_type == 'AA团') {
- obj.pink_type = 1;
- } else {
- obj.pink_type = 2;
- }
- obj.pinkTlist = data.pink;
- obj.showlist = obj.pinkTlist.slice(0, 2);
- if (obj.pinkTlist.length <= 2) {
- obj.more = false;
- }
-
- obj.seckillObj.stopTime = goods.stop_time * 1000;
-
- let acitonTime = new Date();
-
- if (acitonTime.getTime() > obj.seckillObj.stopTime) {
-
- obj.seckillObj.stop = true;
- } else {
-
- let time = timeComputed(obj.seckillObj.stopTime)
-
- obj.seckillObj = {
- stopTime: goods.stop_time * 1000,
- stop: false,
- stopTimeD: time.day,
- stopTimeH: time.hours,
- stopTimeM: time.minutes,
- stopTimeS: time.seconds,
- upTime: (new Date()).getTime()
- }
- }
- });
- },
-
- openPinkT(item) {
- let obj = this;
- obj.type = item;
-
- let data = {
- cartNum: obj.goodsNumber,
- new: 1,
- combinationId: obj.goodsid,
- productId: obj.goodsObjact.product_id
- };
- cartAdd(data)
- .then(function(e) {
- let da = e.data;
- if (obj.type == 1) {
-
- uni.navigateTo({
- url: '/pages/order/createOrder?id=' + da.cartId+'&goodsType=2'
- });
- }
- })
- .catch(e => {
- console.log(e);
- });
- },
- specOPne(item) {
- let obj = this;
- obj.specClass = 'show';
- console.log(obj.specClass,'this.specClass')
- },
-
- toggleSpec(str) {
- if (this.specClass === 'show') {
- this.specClass = 'hide';
- setTimeout(() => {
- this.specClass = 'none';
- }, 250);
- } else if (this.specClass === 'none') {
- this.specClass = 'show';
- }
-
- if (typeof str == 'number') {
-
- this.type = str;
- }
- },
-
- stopPrevent() {}
- }
- };
- </script>
- <style lang="scss">
- /* 弹出层 */
- .popup {
- position: fixed;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- z-index: 99;
- &.show {
- display: block;
-
- .mask {
- animation: showPopup 0.2s linear both;
- }
-
- .layer {
- animation: showLayer 0.2s linear both;
- }
- }
-
- &.hide {
- .mask {
- animation: hidePopup 0.2s linear both;
- }
-
- .layer {
- animation: hideLayer 0.2s linear both;
- }
- }
-
- &.none {
- display: none;
- }
-
- .mask {
- position: fixed;
- top: 0;
- width: 100%;
- height: 100%;
- z-index: 1;
- background-color: rgba(0, 0, 0, 0.4);
- }
-
- .layer {
- position: fixed;
- z-index: 99;
- bottom: 0;
- width: 100%;
- min-height: 35vh;
- border-radius: 10rpx 10rpx 0 0;
- background-color: #fff;
-
- .btn {
- height: 66rpx;
- line-height: 66rpx;
- border-radius: 100rpx;
- background: $uni-color-primary;
- font-size: $font-base + 2rpx;
- color: #fff;
- margin: 30rpx auto 20rpx;
- }
- }
-
- @keyframes showPopup {
- 0% {
- opacity: 0;
- }
-
- 100% {
- opacity: 1;
- }
- }
-
- @keyframes hidePopup {
- 0% {
- opacity: 1;
- }
-
- 100% {
- opacity: 0;
- }
- }
-
- @keyframes showLayer {
- 0% {
- transform: translateY(120%);
- }
-
- 100% {
- transform: translateY(0%);
- }
- }
-
- @keyframes hideLayer {
- 0% {
- transform: translateY(0);
- }
-
- 100% {
- transform: translateY(120%);
- }
- }
- }
- /* 规格选择弹窗 */
- .attr-content {
- padding: 25rpx 30rpx;
-
- .a-t {
- display: flex;
-
- image {
- width: 170rpx;
- height: 170rpx;
- flex-shrink: 0;
- border-radius: 8rpx;
- }
-
- .right {
- display: flex;
- flex-direction: column;
- padding-left: 24rpx;
- font-size: $font-sm + 2rpx;
- color: $font-color-base;
- line-height: 42rpx;
- width: 75%;
-
- .price {
- font-size: $font-lg;
- color: $uni-color-primary;
- margin: 10rpx 0rpx;
- }
-
- .name {
- font-size: 32rpx;
- color: $font-color-dark;
- height: 50rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- display: block;
- }
-
- .selected-text {
- margin-right: 10rpx;
- }
- }
- }
-
- .attr-list {
- display: flex;
- flex-direction: column;
- font-size: $font-base + 2rpx;
- color: $font-color-base;
- padding-top: 30rpx;
- padding-left: 10rpx;
- }
-
- .item-list {
- padding: 20rpx 0 0;
- display: flex;
- flex-wrap: wrap;
-
- text {
- display: flex;
- align-items: center;
- justify-content: center;
- background: #eee;
- margin-right: 20rpx;
- margin-bottom: 20rpx;
- border-radius: 100rpx;
- min-width: 60rpx;
- height: 60rpx;
- padding: 0 20rpx;
- font-size: $font-base;
- color: $font-color-dark;
- }
-
- .selected {
- background: #ddffdf;
- color: $uni-color-primary;
- }
- }
- }
-
- //默认商品底部高度
- .goodsBottom {
- height: 160rpx;
- }
- page {
- background: #f0f0f0;
- }
- //秒杀、拼团底部高度
- .contentBottomHeight {
- height: 110rpx;
- // background-color: #FFFFFF;
- }
- //默认商品底部高度
- .goodsBottom {
- height: 160rpx;
- }
- /deep/ .iconenter {
- font-size: $font-base + 2rpx;
- color: #888;
- }
- /deep/ .con_image {
- width: 130rpx;
- height: 130rpx;
- display: inline-block;
- padding: 15rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- /* 商品详情中限制图片大小 */
- /deep/ .rich-img {
- width: 100% !important;
- height: auto;
- }
- .pinklistbox {
- background: #ffffff;
- margin-top: 25rpx;
- overflow: hidden;
- }
- .pink_num {
- background: -webkit-linear-gradient(left, #fdf5f6, #fbebf6);
- padding: 15rpx 25rpx;
- font-size: 26rpx;
- color: #dd524d;
- }
- .pint {
- background: -webkit-linear-gradient(left, #ff1f4f, #ff0409);
- padding: 10rpx 25rpx;
- color: #ffffff;
- font-size: 24rpx;
- border-radius: 25rpx;
- .iconenter {
- font-size: 15px;
- color: #ffffff;
- }
- }
- .pinklist {
- padding: 0rpx 25rpx;
- padding-top: 45rpx !important;
- }
- .pinklist_list {
- margin-bottom: 10rpx;
- }
- .pink_img {
- width: 100rpx;
- height: 100rpx;
- image {
- width: 100%;
- height: 100%;
- border-radius: 100%;
- }
- }
- .pink_people {
- font-size: 28rpx;
- text {
- color: #dd524d;
- }
- }
- .pink_time {
- font-size: 26rpx;
- color: #909399;
- }
- .pink_name {
- width: 200rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- padding-left: 10rpx;
- // background: #FC2A3F;
- // height: 50rpx;
- }
- .More {
- width: 100%;
- line-height: 2;
- background-color: #fc2a3f;
- font-size: $font-lg;
- margin: 0 auto;
- text-align: center;
- color: #ffffff;
- // border-radius: 50rpx;
- }
- .ping-plan {
- background-color: #FFFFFF;
- padding: 25rpx 35rpx;
- border-top: 15rpx solid #F3F3F4;
- border-bottom: 15rpx solid #F3F3F4;
- }
- .participate-7 {
- color: #000000;
- font-size: 29rpx;
- font-weight: 500;
- padding-bottom: 25rpx;
- .participate-7-1 {
- .word {
- color: #ff0a1a;
- }
- .word1 {
- font-size: 25rpx;
- color: #989aa0;
- }
- image {
- width: 10rpx;
- height: 20rpx;
- margin-left: 15rpx;
- }
- }
- }
- //左右顶格加上下居中
- .flex-between-center {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .participate-8 {
- image {
- width: 26rpx;
- height: 12rpx;
- }
- .participate-8-1 {
- text-align: center;
- .img1 {
- width: 43rpx;
- height: 50rpx;
- }
- .img2 {
- width: 43rpx;
- height: 42rpx;
- }
- .img3 {
- width: 60rpx;
- height: 46rpx;
- }
- .word-1 {
- font-size: 23rpx;
- color: #000000;
- line-height: 34rpx;
- }
- .word-2 {
- font-size: 21rpx;
- color: #91949B;
- line-height: 34rpx;
- }
- }
- }
- </style>
|