123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list-scroll-view">
- <view class="one_1">
- <swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
- indicator-active-color="#FB1438" :interval="3000" :duration="1000">
- <swiper-item class="list" v-for="(item,index) in info.goods.file" :key="index">
- <image class="image" :src="item.url" mode="aspectFit">
- </image>
- </swiper-item>
- </swiper>
- <!-- 是否关注商品 -->
- <view class="goodsColect">
- <text @tap="toGoodscolect"
- :class="['iconfont',goodsColect?'icon-yduishoucangshixin-copy':'icon-yduishoucangkongxin']"></text>
- </view>
- <view class="acttags" v-if="info.goods.act_tags&&info.goods.act_tags.length>0">
- <text v-for="i in info.goods.act_tags" :key="i">{{i.label}}</text>
- </view>
- </view>
- <view class="one_2">
- <text class="money_1"
- v-if="infospecs.leader_price"><text>会员价¥</text>{{infospecs.leader_price||0}}</text>
- <text class="money" v-if="infospecs.price"><text>特价¥</text>{{infospecs.price||0}}</text>
- <text class="money"
- v-if="!infospecs.price&&!infospecs.leader_price"><text>¥</text>{{infospecs.sell_money||0}}</text>
- <text class="money"><text>¥</text>{{infospecs.flow_money||0}}</text>
- </view>
- <view class="one_3" v-if="discount">
- <text v-if="discount.full_decrement" class="act"
- v-for="(item,index) in discount.full_decrement" :key="index">{{item}}</text>
- <text v-if="discount.full_fold" class="act" v-for="(item,index) in discount.full_fold"
- :key="index">{{item}}</text>
- </view>
- <view class="one_3">
- <text class="num">已售{{info.goods.sell_num||0}}件</text>
- </view>
- <view class="one_4">
- <view class="name">
- {{info.goods.name}}
- </view>
- <view class="brief">
- {{info.goods.shot_brief||''}}
- </view>
- <view class="money">
- <!-- <text>运费{{infospecs.freight||'包邮'}}元</text> -->
- <text>{{info.goods.send_time}}内发货</text>
- </view>
- </view>
- <view class="one_5" @tap="toActivity">
- <view class="l">
- <text>{{info.act.length>0?`活动`:`暂无活动`}}</text>
- </view>
- <view class="r">
- <text class="iconfont icon-jiantouyou"></text>
- </view>
- </view>
- <view class="one_5" @tap="toSpec">
- <view class="l">
- 选择规格
- </view>
- <view class="r">
- <text class="iconfont icon-jiantouyou"></text>
- </view>
- </view>
- <view class="one_6" @tap="toEvaluate">
- <view class="l">
- <text>{{evaluate_num>0?`商品评价(${evaluate_num})`:`暂无评价`}}</text>
- </view>
- <view class="r">
- <text class="iconfont icon-jiantouyou"></text>
- </view>
- </view>
- <view class="one_7" v-if="info.sets.length>0" @tap="toSets">
- <view class="one_7_1">
- 优惠套装<text>({{info.sets.length||0}})</text>
- </view>
- <view class="one_7_2">
- <view class="image" v-for="(set,index) in info.sets[0].set" :key="index">
- <image class="image" :src="set.file&&set.file.length>0?set.file[0].url:''"
- mode="aspectFit">
- </image>
- </view>
- <view class="money">
- <view class="money_1">共{{info.sets[0].goods_total}}件</view>
- <view class="money_2">¥{{info.sets[0].sell_money}}</view>
- </view>
- </view>
- </view>
- <view class="one_8">
- <view class="one_8_1">
- <view class="shop_1">
- <image class="image"
- :src="info.shop.logo&&info.shop.logo.length>0?info.shop.logo[0].url:''"
- mode="aspectFit"></image>
- </view>
- <view class="shop_2">
- <view class="name">{{info.shop.name}}</view>
- <view class="num"><text>宝贝数:</text>{{info.shop.goods_num||0}}</view>
- </view>
- </view>
- <view class="one_8_2">
- <view class="score_1">
- <text>商品:</text>
- <text>{{info.shop.goods_score||5}}</text>
- <text>|</text>
- </view>
- <view class="score_1">
- <text>发货:</text>
- <text>{{info.shop.send_score||5}}</text>
- <text>|</text>
- </view>
- <view class="score_1">
- <text>服务:</text>
- <text>{{info.shop.service_score||5}}</text>
- </view>
- </view>
- <view class="one_8_3">
- <view class="btn">
- <button size="mini" @tap="toShop">进入店铺</button>
- </view>
- <view class="btn">
- <button size="mini" @tap="toShopcolect">{{shopColect==true?'已关注':'关注'}}</button>
- </view>
- </view>
- </view>
- <view class="one_9">
- <rich-text :nodes="info.goods.brief"></rich-text>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="two">
- <uni-goods-nav :options="options" :button-group="buttonGroup" @click="toNavleft"
- @buttonClick="toNavright" />
- </view>
- </view>
- <!-- 跳转菜单 -->
- <view class="bar_1">
- <text @tap="toMenubar" class="iconfont icon-gengduo"></text>
- </view>
- <view class="bar_2" v-if="is_menu">
- <view class="list" v-for="(item,index) in barList" :key="index" v-if="item.is_use=='0'"
- @click="toPath(item)">
- <image class="image" :src="item.normal&&item.normal.length>0?item.normal[0].url:''"></image>
- <text class="name"> {{item.name}}</text>
- </view>
- </view>
- <!-- 规格 -->
- <uni-popup ref="specShow" background-color="#fff" type="bottom" :is-mask-click="false">
- <view class="popup">
- <view class="close">
- <text @click="toClose" class="iconfont icon-shanchu"></text>
- </view>
- <view class="info_1" v-if="popupShow=='1'">
- <view class="info_1">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list-scroll-view">
- <view class="one">
- <view class="one_1">
- <view class="l">
- <image class="image"
- :src="specsInfo.file.length>0?specsInfo.file[0].url:info.goods.file[0].url"
- mode="aspectFill" @tap="diaView"></image>
- </view>
- <view class="r">
- <view class="money">
- <text v-if="specsInfo.leader_price"
- class="money_2"><text>会员价¥</text>{{specsInfo.leader_price}}</text>
- <text v-if="specsInfo.price"
- class="money_1"><text>特价¥</text>{{specsInfo.price}}</text>
- <text v-if="!specsInfo.price&&!specsInfo.leader_price"
- class="money_1"><text>¥</text>{{specsInfo.sell_money}}</text>
- <text class="money_1"><text>¥</text>{{specsInfo.flow_money}}</text>
- </view>
- <view class="other_1">
- <text>已选:</text>
- <text>{{specsInfo.name}}</text>
- </view>
- <view class="other_1">
- <text>运费:</text>
- <text>{{specsInfo.freight===0?'包邮':specsInfo.freight+'元'}}</text>
- </view>
- </view>
- </view>
- <view class="one_2">
- <view class="one_2_1">
- 规格
- </view>
- <view class="one_2_2">
- <view
- :class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']"
- v-for="(item,index) in info.specs" :key="index" @tap="toSpecs(item)">
- <text>{{item.name}}</text>
- </view>
- </view>
- </view>
- <view class="one_3">
- <view class="one_3_1">
- <text>数量</text>
- </view>
- <view class="one_3_1">
- <uni-number-box v-model="buy_num" @change="toCount" :min="1"
- :max="specsInfo.num">
- </uni-number-box>
- </view>
- <view class="one_3_1">
- <text>库存{{specsInfo.num||0}}</text><text class="limit"
- v-if="specsInfo.limit_num">({{specsInfo.buy_name||'暂无'}}{{specsInfo.limit_num||0}}个)</text>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="info_2">
- <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='0'">
- <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toMarket">加入购物车</button>
- </view>
- <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='1'">
- <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toBuy">立即购买</button>
- </view>
- <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="specsInfo.can_group=='0'">
- <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toGroup">我要开团</button>
- </view>
- </view>
- </view>
- <view class="info_3" v-else-if="popupShow=='2'">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list" v-for="(item,index) in info.act" :key="index">
- <view class="list_1" @tap="toAct(item)">
- <view class="title_1">
- <view class="l">
- <text>{{item.tag||'暂无'}}</text>{{item.act_time.title}}
- </view>
- <view class="r">
- <text class="iconfont icon-jiantouyou"></text>
- </view>
- </view>
- <view class="title_2">
- <view class="text" v-if="item.type=='5'||item.type=='6'">{{item.text}}</view>
- <view class="time">{{item.config.time_start}}-{{item.config.time_end}}</view>
- </view>
- <view class="title_2" v-if="item.type=='2'">
- <view class="specList" v-for="(tag,indexx) in item.list" :key="indexx">
- <view class="name">规格:{{tag.spec_name}}</view>
- <view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs"
- @tap.stop="tags.type=='0' && getDetail(tags)">
- <view class="left">
- <view class="goods">{{tags.goods_name}}{{tags.spec_name}}</view>
- <view class="goods">{{tags.desc}}</view>
- <view class="num">×{{tags.num}}</view>
- </view>
- <view class="right"><text class="iconfont icon-jiantouyou"></text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="info_4" v-else>
- <view class="info_4">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list-scroll-view">
- <view class="list" v-for="(item,index) in info.sets" :key="index">
- <view class="name"><text class="set">套装</text>{{item.name}}</view>
- <view class="set">
- <view class="set_1" v-for="(tag,indexx) in item.set" :key="indexx"
- @tap="toDeatil(tag)">
- <image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
- mode="aspectFit">
- </image>
- <view class="goods textOver">{{tag.goods_name}}</view>
- <view class="spec textOver">{{tag.spec_name}}</view>
- </view>
- </view>
- <view class="bottom">
- <view class="money">
- 共{{item.goods_total||0}}件,套装价:<text>¥{{item.sell_money||0}}</text>
- </view>
- <view class="add">
- <button size="mini" @tap="toSetMarket(item)">加入购物车</button>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- </uni-popup>
- <view class="dialog" v-if="dialog.show==true" @tap="dialogClose">
- <view class="dialog_1" v-if="dialog.type=='1'">
- <swiper class="swiper" circular @change="diaSpecs" :current="is_specs">
- <swiper-item class="list" v-for="(item,index) in info.specs" :key="index">
- <view class="list_1">
- <image class="image" :src="item.file.length>0?item.file[0].url:info.goods.file[0].url"
- mode="aspectFit"></image>
- </view>
- <view class="name">
- <text>{{item.name}}</text>
- </view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- // 系统设置
- config: {},
- // 商品id
- id: '',
- // 分享人id
- inviter: '',
- // 当前用户信息
- user: {},
- // 是否关注商品
- goodsColect: false,
- // 是否关注店铺
- shopColect: false,
- // 评价数
- evaluate_num: 2,
- // 商品详情
- info: {},
- infospecs: {},
- // 优惠
- discount: {},
- // 底部菜单
- options: [{
- icon: 'shop',
- text: '店铺',
- type: 'shop',
- route: 'pagesHome/shop/index',
- },
- {
- icon: 'cart',
- text: '购物车',
- type: 'market',
- route: 'pages/market/index',
- },
- ],
- buttonGroup: [{
- text: '加入购物车',
- backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
- color: '#fff',
- type: '0'
- },
- {
- text: '立即购买',
- backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
- color: '#fff',
- type: '1'
- }
- ],
- // 系统菜单
- barList: [],
- is_menu: false,
- // 规格弹框
- popupShow: '1',
- // 规格信息
- is_specs: 0,
- btn_type: '1',
- specsInfo: {},
- // 是否零库存
- is_zero: false,
- // 商品设置
- group_config: [],
- // 限制说明
- buyList: [],
- // 购买数量
- buy_num: 1,
- // 规格弹出框
- dialog: {
- show: false,
- type: '1'
- },
- };
- },
- onLoad: async function(e) {
- const that = this;
- that.$set(that, `id`, e.id || '');
- that.$set(that, `inviter`, e.inviter || '');
- await that.searchConfig();
- await that.search();
- await that.configShare();
- },
- onShow: async function() {
- const that = this;
- await that.watchLogin();
- },
- onUnload: function() {
- // 页面卸载,重新部署分享内容
- const that = this;
- if (that.config) {
- // 赋值默认值
- that.$config.share = {
- title: that.config.title,
- path: '/pages/index/index',
- imageUrl: that.config.config.share[0].url
- }
- }
- },
- methods: {
- // 查询系统设置
- searchConfig() {
- const that = this;
- uni.getStorage({
- key: 'config',
- success: function(res) {
- let data = res.data;
- that.$set(that, `config`, data);
- if (data.bottom_menu && data.bottom_menu.list.length > 0) {
- let list = data.bottom_menu.list.sort((a, b) => {
- return a.sort - b.sort
- });
- that.$set(that, `barList`, list)
- }
- }
- })
- },
- // 查询用户信息
- watchLogin() {
- const that = this;
- uni.getStorage({
- key: 'token',
- success: async function(res) {
- let user = that.$jwt(res.data);
- if (user) that.$set(that, `user`, user);
- },
- fail: function(err) {
- console.log('暂无用户信息');
- }
- })
- },
- // 查询其他信息
- async searchOther() {
- const that = this;
- let user = that.user;
- let res;
- // 是否关注商品
- res = await that.$api(`/storeGoods/check`, `GET`, {
- customer: user._id,
- goods: that.id
- });
- if (res.errcode == '0') that.$set(that, `goodsColect`, res.data);
- // 是否关注店铺
- res = await that.$api(`/storeShop/check`, `GET`, {
- customer: user._id,
- shop: that.info?.shop?._id
- });
- if (res.errcode == '0') that.$set(that, `shopColect`, res.data);
- // 商品设置
- res = await that.$api(`/goodsConfig`, `GET`, {
- goods: that.id,
- shop: that.info?.shop?._id
- }, 'group');
- if (res.errcode == '0' && res.total > 0) that.$set(that, `group_config`, res.data);
- // 限制说明
- res = await that.$api(`/dictData`, 'GET', {
- code: "buy_limit"
- });
- if (res.errcode == '0') that.$set(that, `buyList`, res.data)
- },
- // 查询商品信息
- async search() {
- const that = this;
- let id = that.id;
- if (id) {
- let res;
- res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
- id: id
- });
- if (res.errcode == '0') {
- let data = res.data;
- if (data.goods.brief) data.goods.brief = data.goods.brief.replace(/\<img/gi,
- '<img class="rich-img"');
- // 特价
- let act;
- act = data.act.find(i => i.type == '3')
- if (act) {
- for (let val of act.list) {
- for (let [index, arr] of data.specs.entries()) {
- if (val.spec == arr._id) arr.price = val.price
- }
- }
- }
- // 显示最低价格的规格信息,不考虑库存问题
- if (data.specs && data.specs.length > 0) {
- // 规格排序
- let indexSpecs = data.specs.sort(function(a, b) {
- let i, j;
- if (a.price) i = 'price'
- else i = 'sell_money'
- if (b.price) j = 'price'
- else j = 'sell_money'
- return a[i] - b[j];
- })
- that.$set(that, `infospecs`, indexSpecs[0])
- }
- that.$set(that, `info`, data);
- // 优惠
- act = data.act.find(i => i.type == '5')
- if (act) that.$set(that.discount, `full_decrement`, act.text.split(';'));
- act = data.act.find(i => i.type == '6')
- if (act) that.$set(that.discount, `full_fold`, act.text.split(';'));
- await that.searchOther();
- // 查询规格
- await that.searchSpecs(data.specs);
- // 查询评价数
- await that.searchRate(data);
- }
- } else {
- uni.showToast({
- title: '暂无商品信息',
- icon: 'none'
- })
- }
- },
- // 查询规格
- searchSpecs(e) {
- const that = this;
- if (e.length > 0) {
- let data = e.find(i => i.num > 0);
- let dataIndex = e.findIndex(i => i._id == data._id);
- if (data) {
- let specsInfo = that.group_config.find(i => i.spec._id == data._id)
- if (specsInfo?._id && that.user.is_leader == '0') data.can_group = '0'
- else data.can_group = '1'
- let limit = that.buyList.find((i) => i.value == data.buy_limit);
- if (limit) data.buy_name = limit.label
- that.$set(that, `specsInfo`, data);
- that.$set(that, `is_specs`, dataIndex);
- }
- }
- },
- // 活动说明
- toActivity() {
- const that = this;
- if (that.info.act.length > 0) {
- that.$set(that, `popupShow`, '2')
- that.$refs.specShow.open();
- }
- },
- // 查看套装
- toSets() {
- const that = this;
- if (that.info.sets.length > 0) {
- that.$set(that, `popupShow`, '3')
- that.$refs.specShow.open();
- }
- },
- // 套装详情
- toDeatil(e) {
- const that = this;
- uni.navigateTo({
- url: `/pagesHome/order/detail?id=${e.goods}`
- })
- },
- // 套装加入购物车
- async toSetMarket(e) {
- const that = this;
- let user = that.user;
- if (user && user._id) {
- let obj = {
- customer: user._id,
- set_id: e._id,
- is_set: '0',
- num: 1,
- }
- let res = await that.$api(`/cart`, 'POST', obj)
- if (res.errcode == '0') {
- uni.showToast({
- title: `加入购物车成功`,
- icon: 'none'
- })
- that.toClose();
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- })
- }
- } else {
- uni.navigateTo({
- url: `/pages/login/index`
- })
- }
- },
- // 查看正品详情
- getDetail(e) {
- const that = this;
- uni.navigateTo({
- url: `/pagesHome/order/detail?id=${e.goods}`
- })
- },
- // 选择规格
- toSpecs(e) {
- const that = this;
- let specs = that.info.specs;
- let dataIndex = specs.findIndex(i => i._id == e._id);
- that.$set(that, `is_specs`, dataIndex);
- let specsInfo = that.group_config.find(i => i.spec._id == e._id)
- if (specsInfo?._id && that.user.is_leader == '0') e.can_group = '0'
- else e.can_group = '1'
- let limit = that.buyList.find((i) => i.value == e.buy_limit);
- if (limit) e.buy_name = limit.label
- that.$set(that, `specsInfo`, e)
- that.$set(that, `buy_num`, 1);
- if (e.num <= 0) that.$set(that, `is_zero`, true)
- else that.$set(that, `is_zero`, false)
- },
- // 计数器
- toCount(e) {
- const that = this;
- that.$set(that, `buy_num`, e)
- },
- // 查询评价数
- async searchRate(e) {
- const that = this;
- let res = await that.$api(`/goodsRate`, `GET`, {
- limit: 1,
- goods: e.goods._id
- })
- if (res.errcode == '0') that.$set(that, `evaluate_num`, res.total);
- },
- // 关注商品
- async toGoodscolect() {
- const that = this;
- let user = that.user;
- if (user && user._id) {
- let res = await that.$api(`/storeGoods`, `POST`, {
- customer: user._id,
- goods: that.id
- });
- if (res.errcode == '0') {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- that.$set(that, `goodsColect`, res.data.result)
- }
- } else {
- uni.showToast({
- title: '暂无账号,无法收藏商品',
- icon: 'none'
- })
- }
- },
- // 选择规格
- toSpec() {
- const that = this;
- this.$set(that, `popupShow`, '1')
- that.$refs.specShow.open();
- },
- // 加入购物车
- async toMarket() {
- const that = this;
- let user = that.user;
- let info = that.info;
- let specsInfo = that.specsInfo;
- if (user && user._id) {
- let obj = {
- customer: user._id,
- shop: info.shop._id,
- goods: info.goods._id,
- goodsSpec: specsInfo._id,
- num: that.buy_num,
- inviter: that.inviter
- }
- let res = await that.$api(`/cart`, 'POST', obj)
- if (res.errcode == '0') {
- uni.showToast({
- title: `加入购物车成功`,
- icon: 'none'
- })
- that.toClose();
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- })
- }
- } else {
- uni.navigateTo({
- url: `/pages/login/index`
- })
- }
- },
- // 立即购买
- async toBuy() {
- const that = this;
- let user = that.user;
- let info = that.info;
- let specsInfo = that.specsInfo;
- let act = that.info.act.map(item => {
- return item._id
- })
- if (user && user._id) {
- let obj = [{
- customer: user._id,
- shop: info.shop._id,
- goods: info.goods._id,
- goodsSpec: specsInfo._id,
- num: that.buy_num,
- inviter: that.inviter,
- act
- }]
- let res = await that.$api(`/util/checkCanBuy`, 'POST', obj)
- if (res.errcode == '0') {
- if (res.data.result == true) {
- uni.navigateTo({
- url: `/pagesHome/order/order?key=${res.data.key}`
- })
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none',
- duration: 5000
- })
- }
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- })
- }
- } else {
- uni.navigateTo({
- url: `/pages/login/index`
- })
- }
- },
- // 开团
- toGroup() {
- const that = this;
- uni.navigateTo({
- url: `/pagesHome/group/index?shop=${that.info?.shop?._id}&goods=${that.id}`
- })
- },
- // 关闭弹框
- toClose() {
- const that = this;
- that.$set(that, `btn_type`, '1');
- that.$refs.specShow.close();
- },
- // 评价
- toEvaluate() {
- const that = this;
- uni.navigateTo({
- url: `/pagesHome/order/appraise?id=${that.info.goods._id}`
- })
- },
- // 进入店铺
- toShop() {
- const that = this;
- let info = that.info;
- uni.navigateTo({
- url: `/pagesHome/shop/index?id=${info.shop._id}`
- })
- },
- // 关注店铺
- async toShopcolect() {
- const that = this;
- let user = that.user;
- if (user && user._id) {
- let res = await that.$api(`/storeShop`, `POST`, {
- customer: user._id,
- shop: that.info.shop._id
- });
- if (res.errcode == '0') {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- that.$set(that, `shopColect`, res.data.result)
- }
- } else {
- uni.showToast({
- title: '暂无账号,无法关注商铺',
- icon: 'none'
- })
- }
- },
- // 店铺,购物车
- toNavleft(e) {
- const that = this;
- if (e.content.type == 'shop') {
- that.toShop();
- } else if (e.content.type == 'market') {
- let obj = {
- route: e.content.route
- }
- that.toPath(obj)
- }
- },
- // 加入购物车,立即购买
- toNavright(e) {
- const that = this;
- that.$set(that, `popupShow`, '1');
- that.$set(that, `btn_type`, e.content.type);
- that.$refs.specShow.open();
- },
- // 右侧菜单
- toMenubar() {
- const that = this;
- that.$set(that, `is_menu`, that.is_menu ? false : true)
- },
- toPath(e) {
- let url = `/${e.route}`;
- uni.reLaunch({
- url
- })
- },
- // 配置分享内容
- configShare() {
- const that = this;
- let id = that.id;
- let inviter = that.user && that.user._id ? that.user._id : '';
- let title = that.info && that.info.goods ? that.info.goods.name : '';
- let imageUrl = that.info && that.info.goods ? that.info.goods.file[0].url : '';
- that.$config.share = {
- title: title,
- path: `/pagesHome/order/detail?id=${id}&inviter=${inviter}`,
- imageUrl: imageUrl
- }
- },
- // 规格预览
- diaView() {
- const that = this;
- that.$set(that, `dialog`, {
- show: true,
- type: '1'
- })
- },
- // 查看活动
- toAct(item) {
- uni.navigateTo({
- url: `/pagesRest/activity/info?id=${item._id}`
- })
- },
- // 弹框选择规格
- diaSpecs(e) {
- const that = this;
- let specs = that.info.specs;
- let index = e.detail.current;
- let data = specs[index];
- that.$set(that, `is_specs`, index);
- that.$set(that, `specsInfo`, data);
- that.$set(that, `buy_num`, 1);
- if (data.num <= 0) that.$set(that, `is_zero`, true)
- else that.$set(that, `is_zero`, false)
- },
- // 关闭弹框
- dialogClose() {
- const that = this;
- that.$set(that, `dialog`, {
- show: false,
- type: '1'
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- position: relative;
- flex-grow: 1;
- .one_1 {
- border-bottom: 0.5vw solid var(--f9Color);
- swiper {
- height: 44vh !important;
- }
- .list {
- border-radius: 5px;
- .image {
- width: 100%;
- height: 100%;
- border-radius: 5px;
- background-color: #fff;
- }
- }
- .goodsColect {
- position: fixed;
- top: 2vw;
- right: 3vw;
- z-index: 99;
- background-color: #858585;
- border-radius: 90px;
- text {
- font-size: 30px;
- }
- }
- .acttags {
- position: absolute;
- top: 1vw;
- left: 1vw;
- width: 97%;
- text {
- display: inline-block;
- background-color: var(--fFB1Color);
- color: #fff;
- border-radius: 1vw;
- padding: 0.5vw;
- font-size: 12px;
- margin: 0 1vw 0 0;
- }
- }
- }
- .one_2 {
- border-bottom: 0.5vw solid var(--f9Color);
- padding: 2vw;
- .money_1 {
- color: #23B67A;
- font-size: 20px;
- padding: 0 1vw 0 0;
- font-weight: bold;
- text {
- font-size: 14px;
- }
- }
- .money {
- font-size: 20px;
- padding: 0 1vw 0 0;
- color: var(--fFB1Color);
- font-weight: bold;
- text {
- font-size: 14px;
- }
- }
- .money:last-child {
- font-size: 16px;
- color: #858585;
- text-decoration: line-through;
- }
- }
- .one_3 {
- display: flex;
- flex-wrap: wrap;
- padding: 1vw;
- border-bottom: 0.5vw solid var(--f9Color);
- .act {
- font-size: 12px;
- border: 1px solid var(--fFB1Color);
- margin: 0 1vw 1vw 0;
- color: var(--fFB1Color);
- border-radius: 6px;
- padding: 0 1vw;
- }
- .num {
- font-size: 12px;
- color: #858585;
- }
- }
- .one_4 {
- border-bottom: 0.5vw solid var(--f9Color);
- padding: 2vw;
- .name {
- font-size: 17px;
- font-weight: bold;
- margin: 0 0 2vw 0;
- }
- .brief {
- font-size: 14px;
- color: #858585;
- margin: 0 0 1vw 0;
- }
- .money {
- font-size: 13px;
- color: #858585;
- text {
- padding: 0 2vw 0 0;
- }
- }
- }
- .one_5 {
- display: flex;
- justify-content: space-between;
- padding: 2vw;
- border-bottom: 0.5vw solid var(--f9Color);
- font-size: 14px;
- }
- .one_6 {
- display: flex;
- justify-content: space-between;
- padding: 2vw;
- border-bottom: 0.5vw solid var(--f9Color);
- font-size: 14px;
- }
- .one_7 {
- padding: 2vw;
- border-bottom: 2vw solid var(--f9Color);
- border-top: 1vw solid var(--f9Color);
- .one_7_1 {
- padding: 2vw 0;
- font-size: 14px;
- text {
- padding: 0 0 0 1vw;
- font-size: 12px;
- color: #858585;
- }
- }
- .one_7_2 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 2vw;
- border-radius: 5px;
- background-color: var(--f9Color);
- .image {
- width: 20vw;
- height: 20vw;
- .image {
- width: 100%;
- height: 100%;
- border-radius: 5px;
- background-color: #fff;
- }
- }
- .money {
- text-align: center;
- .money_1 {
- font-size: 12px;
- color: #858585;
- }
- .money_2 {
- font-size: 12px;
- color: var(--fFB1Color);
- }
- }
- }
- }
- .one_8 {
- padding: 2vw;
- border-bottom: 0.5vw solid var(--f9Color);
- .one_8_1 {
- margin: 0 0 1vw 0;
- display: flex;
- .shop_1 {
- width: 15vw;
- height: 15vw;
- border: 1px solid #f1f1f1;
- .image {
- width: 100%;
- height: 100%;
- }
- }
- .shop_2 {
- width: 78vw;
- padding: 0 0 0 2vw;
- .name {
- font-size: 14px;
- margin: 0 0 1vw 0;
- }
- .num {
- font-size: 12px;
- color: #858585;
- text:last-child {
- color: #000;
- }
- }
- }
- }
- .one_8_2 {
- margin: 0 0 2vw 0;
- display: flex;
- justify-content: space-between;
- padding: 2vw 0;
- .score_1 {
- width: 33vw;
- text-align: center;
- font-size: 14px;
- color: #858585;
- text:nth-child(2) {
- color: var(--fFB1Color);
- }
- text:nth-child(3) {
- float: right;
- }
- }
- }
- .one_8_3 {
- display: flex;
- justify-content: space-around;
- .btn {
- width: 40vw;
- button {
- width: 100%;
- font-size: 15px;
- }
- }
- }
- }
- .one_9 {
- padding: 2vw;
- .rich-img {
- width: 100% !important;
- display: block;
- }
- }
- }
- .two {
- width: 100vw;
- height: 8vh;
- overflow: hidden;
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- .bar_1 {
- position: fixed;
- right: 2vw;
- bottom: 20vw;
- text {
- background-color: #858585;
- border-radius: 90px;
- font-size: 30px;
- }
- }
- .bar_2 {
- position: fixed;
- right: 2vw;
- bottom: 28vw;
- width: 27vw;
- background: #ffffff;
- padding: 0 2vw;
- box-shadow: 0 0 5px #858585;
- .list {
- display: flex;
- border-bottom: 1px solid #f1f1f1;
- padding: 1vw 0;
- .image {
- width: 8vw;
- height: 8vw;
- }
- .name {
- font-size: 14px;
- position: relative;
- top: 2vw;
- left: 2vw;
- }
- }
- .list:last-child {
- border-bottom: none;
- }
- }
- .uni-popup {
- z-index: 9999 !important;
- }
- .popup {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 60vh;
- .close {
- text-align: right;
- padding: 2vw;
- }
- .info_1 {
- position: relative;
- display: flex;
- flex-direction: column;
- height: 54vh;
- .info_1 {
- position: relative;
- flex-grow: 1;
- .one {
- padding: 2vw;
- .one_1 {
- display: flex;
- margin: 0 0 2vw 0;
- padding: 0 0 2vw 0;
- border-bottom: 0.5vw solid var(--f9Color);
- .l {
- width: 25vw;
- height: 25vw;
- .image {
- width: 100%;
- height: 100%;
- border-radius: 5px;
- }
- }
- .r {
- width: 70vw;
- padding: 0 0 0 2vw;
- .money {
- margin: 0 0 2vw 0;
- .money_2 {
- color: #23B67A;
- font-size: 20px;
- padding: 0 1vw 0 0;
- font-weight: bold;
- text {
- font-size: 14px;
- }
- }
- .money_1 {
- font-size: 20px;
- color: var(--fFB1Color);
- padding: 0 2vw 0 0;
- text {
- font-size: 14px;
- }
- }
- .money_1:last-child {
- font-size: 16px;
- color: #858585;
- text-decoration: line-through;
- }
- }
- .other_1 {
- font-size: 15px;
- color: #858585;
- text:last-child {
- color: #000000;
- }
- }
- }
- }
- .one_2 {
- margin: 0 0 2vw 0;
- border-bottom: 0.5vw solid var(--f9Color);
- .one_2_1 {
- font-size: 14px;
- margin: 0 0 2vw 0;
- }
- .one_2_2 {
- display: flex;
- flex-wrap: wrap;
- .list {
- background-color: #F5F5F5;
- margin: 0 2vw 2vw 0;
- padding: 0.5vw 1vw;
- border-radius: 5px;
- text {
- font-size: 14px;
- color: #000;
- }
- }
- .huilist {
- background-color: #DCDCDC;
- text {
- color: #858585;
- }
- }
- .redlist {
- background-color: var(--fFB1Color);
- text {
- color: #ffffff;
- }
- }
- .huiilist {
- background-color: #808080;
- text {
- color: #cccccc;
- }
- }
- }
- }
- .one_3 {
- display: flex;
- .one_3_1 {
- margin: 0 2vw 0 0;
- text {
- font-size: 14px;
- color: #858585;
- }
- .limit {
- color: var(--fFB1Color);
- padding: 0 0 0 2vw;
- }
- }
- }
- }
- }
- .info_2 {
- display: flex;
- text-align: center;
- justify-content: space-between;
- .btns {
- width: 50vw;
- }
- .btn {
- width: 100vw;
- }
- button {
- width: 100%;
- border-radius: 0;
- background-color: var(--fFB1Color);
- color: #fff;
- border: 1px solid #f1f1f1;
- }
- .btncolor {
- background: #f1f1f1;
- color: #858585;
- }
- }
- }
- .info_3 {
- position: relative;
- flex-grow: 1;
- .list {
- margin: 0 2vw 2vw 2vw;
- border-radius: 10px;
- background-color: #FFF8DC;
- .list_1 {
- padding: 2vw;
- font-size: 14px;
- .title_1 {
- display: flex;
- justify-content: space-between;
- margin: 1vw 0;
- .l {
- text {
- margin: 0 1vw 0 0;
- font-size: 12px;
- border-radius: 5px;
- border: 0.5px solid var(--fFB1Color);
- color: var(--fFB1Color);
- }
- }
- }
- .title_2 {
- .specList {
- .name {
- margin: 0 0 1vw 0;
- }
- .giftList {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 0 0 1vw 0;
- border: 0.5px solid var(--f9Color);
- border-radius: 10px;
- .left {
- width: 85vw;
- }
- }
- }
- .text {
- color: var(--fFB1Color);
- }
- }
- }
- }
- }
- .info_4 {
- position: relative;
- display: flex;
- flex-direction: column;
- height: 54vh;
- .info_4 {
- position: relative;
- flex-grow: 1;
- .list {
- margin: 0 2vw 2vw 2vw;
- border-radius: 10px;
- background-color: var(--f9Color);
- .name {
- display: flex;
- padding: 2vw;
- font-size: 14px;
- .set {
- margin: 0 1vw 0 0;
- font-size: 12px;
- border-radius: 5px;
- padding: 0 1vw;
- color: #ffffff;
- background-color: #FF6347;
- border: 1px solid #FFA500;
- }
- }
- .set {
- display: flex;
- justify-content: space-around;
- flex-wrap: wrap;
- margin: 0 2vw;
- padding: 2vw;
- background-color: #fff;
- border-radius: 5px;
- .set_1 {
- width: 25vw;
- text-align: center;
- font-size: 14px;
- .spec {
- font-size: 12px;
- color: #858585;
- }
- .image {
- width: 20vw;
- height: 20vw;
- border-radius: 5px;
- background-color: #fff;
- }
- }
- }
- .bottom {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 2vw;
- .money {
- font-size: 12px;
- text {
- color: var(--fFB1Color);
- }
- }
- .add {
- button {
- background-color: var(--fFB1Color);
- color: #ffffff;
- border-radius: 5vw;
- }
- }
- }
- }
- }
- }
- }
- .dialog {
- position: fixed;
- width: 100vw;
- height: 100vh;
- background-color: #000000;
- z-index: 99999;
- display: flex;
- flex-direction: column;
- justify-content: center;
- swiper {
- height: 60vh;
- }
- .list {
- .list_1 {
- padding: 2vw;
- margin: 0 0 5vw 0;
- .image {
- width: 100%;
- height: 40vh;
- }
- }
- .name {
- text-align: center;
- margin: 0 10vw;
- background-color: #6666669f;
- border-radius: 25px;
- padding: 2vw;
- text {
- color: #fff;
- font-size: 15px;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- word-break: break-all;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
- }
- }
- }
- </style>
|