|
@@ -26,25 +26,21 @@
|
|
|
<text>{{info.send_time}}内发货</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="four">
|
|
|
- <view class="four_1">
|
|
|
+ <view class="thr">
|
|
|
+ <view class="thr_1">
|
|
|
<image class="image" :src="shop.logo&&shop.logo.length>0?shop.logo[0].url:''"></image>
|
|
|
<view class="other">
|
|
|
<view class="name">{{shop.name}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="four_2">
|
|
|
+ <view class="thr_2">
|
|
|
<view class="grade">商品:<text>{{shop.goods_score||5}}</text></view>|
|
|
|
<view class="grade">发货:<text>{{shop.send_score||5}}</text></view>|
|
|
|
<view class="grade">服务:<text>{{shop.service_score||5}}</text></view>
|
|
|
</view>
|
|
|
- <view class="four_2">
|
|
|
- <view class="btn" @tap="toShop('pagesHome/shop/index')">进入店铺</view>
|
|
|
- <view class="btn" @tap="shopCollect">{{shop_collect==true?'已关注':'关注'}}</view>
|
|
|
- </view>
|
|
|
</view>
|
|
|
- <view class="five">
|
|
|
- <view class="five_1">
|
|
|
+ <view class="four">
|
|
|
+ <view class="four_1">
|
|
|
<rich-text :nodes="info.brief"></rich-text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -52,7 +48,7 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view class="foot">
|
|
|
- <uni-goods-nav :options="options" :button-group="buttonGroup" @click="onClick"
|
|
|
+ <uni-goods-nav :options="options" :buttonGroup="buttonGroup" @click="onClick"
|
|
|
@buttonClick="buttonClick" />
|
|
|
</view>
|
|
|
</view>
|
|
@@ -71,41 +67,15 @@
|
|
|
<uni-popup ref="popup" background-color="#fff" type="bottom">
|
|
|
<view class="content">
|
|
|
<view class="one">
|
|
|
- <image class="image" v-if="specsInfo.file&&specsInfo.file.length>0"
|
|
|
- :src="specsInfo.file&&specsInfo.file.length>0?specsInfo.file[0].url:''"></image>
|
|
|
- <image class="image" v-else :src="info.file&&info.file.length>0?info.file[0].url:''"></image>
|
|
|
- <view class="other">
|
|
|
- <view class="money">
|
|
|
- <text>¥</text>
|
|
|
- <text>{{specsInfo.sell_money}}</text>
|
|
|
- </view>
|
|
|
- <view class="other_1">
|
|
|
- 已选: <text>{{specsInfo.name}}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="button">
|
|
|
- <text @click="toClose" class="iconfont icon-shanchu"></text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="two">
|
|
|
- <view class="two_1">规格</view>
|
|
|
- <view class="two_2">
|
|
|
- <text v-for="(item,index) in specs" :key="index" @click="toStyle(item,index)"
|
|
|
- :class="{ 'style': isActive==index}">{{item.name}}
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="thr">
|
|
|
<text>数量</text>
|
|
|
<view class="count">
|
|
|
- <uni-number-box :min="1" :max="specsInfo.num" :disabled="disabled" v-model="num"
|
|
|
- @change="toCount">
|
|
|
+ <uni-number-box :min="1" :max="info.num" v-model="num" @change="toCount">
|
|
|
</uni-number-box>
|
|
|
</view>
|
|
|
- <text>库存{{specsInfo.num||0}}</text>
|
|
|
+ <text>库存{{info.num||0}}</text>
|
|
|
</view>
|
|
|
- <view class="btn" @click="toBuy">
|
|
|
- 立即兑换
|
|
|
+ <view class="btn">
|
|
|
+ <text @click="toExchange" class="button">立即兑换</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
@@ -138,27 +108,12 @@
|
|
|
normal: require('@/static/my.png'),
|
|
|
},
|
|
|
],
|
|
|
- options: [
|
|
|
- // {
|
|
|
- // icon: 'shop',
|
|
|
- // text: '店铺',
|
|
|
- // route: 'pagesHome/shop/index',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // icon: 'cart',
|
|
|
- // text: '购物车',
|
|
|
- // route: 'pages/market/index',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // icon: 'chat',
|
|
|
- // text: '客服',
|
|
|
- // }
|
|
|
- ],
|
|
|
buttonGroup: [{
|
|
|
- text: '立即兑换',
|
|
|
- backgroundColor: 'linear-gradient(90deg, #EF1224, #EF1224)',
|
|
|
+ text: '兑换',
|
|
|
+ backgroundColor: 'linear-gradient(90deg, #6A5ACD, #6A5ACD)',
|
|
|
color: '#fff',
|
|
|
}],
|
|
|
+ options: [],
|
|
|
// 商品id
|
|
|
id: '',
|
|
|
user: {},
|
|
@@ -168,28 +123,16 @@
|
|
|
info: {},
|
|
|
// 商店详情
|
|
|
shop: {},
|
|
|
- // 规格情况
|
|
|
- specs: [],
|
|
|
- // 已选
|
|
|
- specsInfo: {},
|
|
|
// 是否显示返回顶部
|
|
|
isShow: false,
|
|
|
topItem: '',
|
|
|
- // 商品收藏
|
|
|
- collection: false,
|
|
|
// 店铺收藏
|
|
|
shop_collect: false,
|
|
|
// 菜单显示
|
|
|
menu: false,
|
|
|
disabled: true,
|
|
|
- // 显示文字判断
|
|
|
- type: '0',
|
|
|
- // 选择规格
|
|
|
- isActive: -1,
|
|
|
- // 计数器
|
|
|
+ // 数量
|
|
|
num: 1,
|
|
|
- // 评论数
|
|
|
- comment: 0,
|
|
|
};
|
|
|
},
|
|
|
onLoad: async function(e) {
|
|
@@ -198,61 +141,12 @@
|
|
|
},
|
|
|
onShow: async function() {
|
|
|
const that = this;
|
|
|
+ // 监听用户是否登录
|
|
|
+ await that.watchLogin();
|
|
|
await that.search();
|
|
|
- await that.searchOther();
|
|
|
await that.configShare();
|
|
|
},
|
|
|
methods: {
|
|
|
- // //店铺,
|
|
|
- // // 购物车,客服跳转
|
|
|
- // onClick(e) {
|
|
|
- // const that = this;
|
|
|
- // if (e.index == '0' && e.content.route) {
|
|
|
- // // 进入店铺
|
|
|
- // that.toShop();
|
|
|
- // } else {
|
|
|
- // uni.reLaunch({
|
|
|
- // url: `/${e.content.route}`
|
|
|
- // })
|
|
|
- // }
|
|
|
- // },
|
|
|
- // 进入店铺
|
|
|
- toShop() {
|
|
|
- const that = this;
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pagesHome/shop/index?id=${that.shop._id}`
|
|
|
- })
|
|
|
- },
|
|
|
- // 商品评价
|
|
|
- toAppraise(e) {
|
|
|
- const that = this;
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pagesHome/order/appraise?id=${that.id}`
|
|
|
- })
|
|
|
- },
|
|
|
- // 关注商铺
|
|
|
- async shopCollect() {
|
|
|
- const that = this;
|
|
|
- let user = that.user;
|
|
|
- if (user && user._id) {
|
|
|
- let res = await that.$api(`/storeShop`, `POST`, {
|
|
|
- customer: user._id,
|
|
|
- shop: that.shop._id
|
|
|
- });
|
|
|
- if (res.errcode == '0') {
|
|
|
- uni.showToast({
|
|
|
- title: res.data.msg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- that.$set(that, `shop_collect`, res.data.result)
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: '无用户登录无法关注商铺',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
//主菜单跳转
|
|
|
toPath(e) {
|
|
|
if (e && e.route) uni.reLaunch({
|
|
@@ -276,119 +170,76 @@
|
|
|
const that = this;
|
|
|
that.topItem = 'top'
|
|
|
},
|
|
|
- //立即兑换弹窗
|
|
|
+ //立即兑换
|
|
|
buttonClick(e) {
|
|
|
const that = this;
|
|
|
that.$refs.popup.open();
|
|
|
},
|
|
|
- // 修改样式
|
|
|
- toStyle(e, index) {
|
|
|
- const that = this;
|
|
|
- that.$set(that, `isActive`, index)
|
|
|
- that.$set(that, `specsInfo`, e)
|
|
|
- that.disabled = false;
|
|
|
- },
|
|
|
// 计数器
|
|
|
toCount(e) {
|
|
|
const that = this;
|
|
|
that.num = e;
|
|
|
},
|
|
|
// 立即兑换
|
|
|
- toBuy(e) {
|
|
|
+ async toExchange() {
|
|
|
const that = this;
|
|
|
- uni.getStorage({
|
|
|
- key: 'token',
|
|
|
- success: async function(res) {
|
|
|
- let user = that.$jwt(res.data);
|
|
|
- that.$set(that, `user`, user)
|
|
|
- if (that.specsInfo._id) {
|
|
|
- let specs_id = that.specsInfo._id
|
|
|
- let data = {
|
|
|
- customer: user._id,
|
|
|
- shop: that.shop._id,
|
|
|
- goods: that.info._id,
|
|
|
- goodsSpec: specs_id,
|
|
|
- num: that.num
|
|
|
- }
|
|
|
- let arr = await that.$api(`/util/checkCanBuy`, 'POST', data)
|
|
|
- if (arr.errcode == '0') {
|
|
|
- if (arr.data.result == true) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pagesIntegral/order/index?key=${arr.data.key}`
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: arr.data.msg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: arr.errmsg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
+ let user = that.user;
|
|
|
+ if (user._id) {
|
|
|
+ let data = {
|
|
|
+ shop: that.shop._id,
|
|
|
+ goods: that.id,
|
|
|
+ num: that.num
|
|
|
+ };
|
|
|
+ let arr = await that.$api(`/zrOrder/checkCanBuy`, `POST`, data, `integral`)
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ if (arr.data.result == true) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesIntegral/order/index?key=${arr.data.key}`
|
|
|
+ })
|
|
|
} else {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '请选择规格',
|
|
|
- confirmColor: '#ff0000',
|
|
|
- showCancel: false,
|
|
|
- success: function(res) {}
|
|
|
- });
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.data.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
}
|
|
|
- },
|
|
|
- fail: function(err) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/login/index`
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.errmsg,
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- // 关闭弹框
|
|
|
- toClose() {
|
|
|
- const that = this;
|
|
|
- that.$refs.popup.close()
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/login/index`
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- // 详情数据
|
|
|
- async search() {
|
|
|
+ // 监听用户是否登录
|
|
|
+ watchLogin() {
|
|
|
const that = this;
|
|
|
uni.getStorage({
|
|
|
key: 'token',
|
|
|
- success: async function(res) {
|
|
|
+ success: function(res) {
|
|
|
let user = that.$jwt(res.data);
|
|
|
if (user) that.$set(that, `user`, user);
|
|
|
- let arr = await that.$api(`/zrGoods/${that.id}`, `POST`, {}, `integral`)
|
|
|
- if (arr.errcode == '0') {
|
|
|
- if (arr.data.brief) arr.data.brief = arr.data.brief.replace(/\<img/gi,
|
|
|
- '<img class="rich-img"');
|
|
|
- that.$set(that, `info`, arr.data)
|
|
|
- that.$set(that, `bannerList`, arr.data.file)
|
|
|
- let shop = await that.$api(`/shop/${arr.data.shop}`, `GET`)
|
|
|
- if (shop.errcode == '0') {
|
|
|
- that.$set(that, `shop`, shop.data)
|
|
|
- }
|
|
|
- let con = await that.$api(`/goodsRate`, `GET`, {
|
|
|
- goods: arr.data._id
|
|
|
- })
|
|
|
- if (con.errcode == '0') {
|
|
|
- that.$set(that, `comment`, con.total)
|
|
|
- }
|
|
|
- }
|
|
|
},
|
|
|
fail: function(err) {}
|
|
|
});
|
|
|
},
|
|
|
- async searchOther() {
|
|
|
+ // 详情数据
|
|
|
+ async search() {
|
|
|
const that = this;
|
|
|
- let user = that.user;
|
|
|
- // 商铺是否收藏
|
|
|
- let arr = await that.$api(`/storeShop/check`, `GET`, {
|
|
|
- customer: user._id,
|
|
|
- shop: that.shop._id
|
|
|
- });
|
|
|
+ let arr = await that.$api(`/zrGoods/${that.id}`, `POST`, {}, `integral`)
|
|
|
if (arr.errcode == '0') {
|
|
|
- that.$set(that, `shop_collect`, arr.data)
|
|
|
+ if (arr.data.brief) arr.data.brief = arr.data.brief.replace(/\<img/gi,
|
|
|
+ '<img class="rich-img"');
|
|
|
+ that.$set(that, `info`, arr.data)
|
|
|
+ that.$set(that, `bannerList`, arr.data.file)
|
|
|
+ let shop = await that.$api(`/shop/${arr.data.shop}`, `GET`)
|
|
|
+ if (shop.errcode == '0') {
|
|
|
+ that.$set(that, `shop`, shop.data)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 配置分享内容
|
|
@@ -498,14 +349,16 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .four {
|
|
|
+
|
|
|
+ .thr {
|
|
|
margin: 2vw 0 0 0;
|
|
|
padding: 2vw;
|
|
|
background-color: var(--mainColor);
|
|
|
|
|
|
- .four_1 {
|
|
|
+ .thr_1 {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
|
|
|
.image {
|
|
|
width: 15vw;
|
|
@@ -532,7 +385,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .four_2 {
|
|
|
+ .thr_2 {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
justify-content: space-evenly;
|
|
@@ -561,10 +414,10 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .five {
|
|
|
+ .four {
|
|
|
margin: 2vw 0 0 0;
|
|
|
|
|
|
- .five_1 {
|
|
|
+ .four_1 {
|
|
|
background-color: var(--mainColor);
|
|
|
padding: 2vw;
|
|
|
|
|
@@ -643,79 +496,21 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .uni-tab__cart-sub-left {
|
|
|
+ padding: 0 !important;
|
|
|
+ }
|
|
|
+
|
|
|
uni-popup {
|
|
|
z-index: 999999 !important;
|
|
|
}
|
|
|
|
|
|
.content {
|
|
|
- height: 100vw;
|
|
|
+ height: 60vw;
|
|
|
|
|
|
.one {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- justify-content: space-between;
|
|
|
- margin: 2vw;
|
|
|
- padding: 2vw 0;
|
|
|
- border-bottom: 1px solid var(--f9Color);
|
|
|
-
|
|
|
- .image {
|
|
|
- width: 25vw;
|
|
|
- height: 25vw;
|
|
|
- margin: 0 2vw 0 0;
|
|
|
- }
|
|
|
-
|
|
|
- .other {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- flex-grow: 1;
|
|
|
- margin: 0 0 0 2vw;
|
|
|
-
|
|
|
- .money {
|
|
|
- color: var(--fFB1Color);
|
|
|
- font-size: var(--font20Szie);
|
|
|
- padding: 2vw 0;
|
|
|
- }
|
|
|
-
|
|
|
- .other_1 {
|
|
|
- font-size: var(--font14Size);
|
|
|
-
|
|
|
- text {
|
|
|
- padding: 0 2vw;
|
|
|
- color: var(--f85Color);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .two {
|
|
|
- margin: 0 2vw;
|
|
|
- padding: 2vw 0;
|
|
|
- font-size: var(--font12Size);
|
|
|
- border-bottom: 1px solid var(--f9Color);
|
|
|
-
|
|
|
- .two_2 {
|
|
|
- display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- padding: 1vw;
|
|
|
- margin: 1vw 0 0 0;
|
|
|
-
|
|
|
- text {
|
|
|
- margin: 1vw 2vw 0 0;
|
|
|
- padding: 1vw;
|
|
|
- border-radius: 1vw;
|
|
|
- background-color: var(--f9Color);
|
|
|
- }
|
|
|
-
|
|
|
- .style {
|
|
|
- color: var(--mainColor);
|
|
|
- background-color: var(--ff0Color);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .thr {
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
margin: 0 2vw;
|
|
|
padding: 2vw 0;
|
|
|
|
|
@@ -731,19 +526,19 @@
|
|
|
}
|
|
|
|
|
|
.btn {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
position: fixed;
|
|
|
bottom: 0;
|
|
|
- width: 100vw;
|
|
|
- padding: 4vw 0;
|
|
|
- background-color: var(--fFB1Color);
|
|
|
- text-align: center;
|
|
|
- font-size: var(--font18Szie);
|
|
|
- color: var(--mainColor);
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- .uni-tab__cart-sub-left {
|
|
|
- padding: 0 !important;
|
|
|
+ .button {
|
|
|
+ width: 100vw;
|
|
|
+ padding: 4vw 0;
|
|
|
+ background-color: #6A5ACD;
|
|
|
+ text-align: center;
|
|
|
+ font-size: var(--font18Szie);
|
|
|
+ color: var(--mainColor);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|