|
@@ -4,20 +4,23 @@
|
|
<top-swiper :imgList="imgList"></top-swiper>
|
|
<top-swiper :imgList="imgList"></top-swiper>
|
|
<!-- 标题 -->
|
|
<!-- 标题 -->
|
|
<product-content :goodsObjact="goodsObjact"></product-content>
|
|
<product-content :goodsObjact="goodsObjact"></product-content>
|
|
- <!-- 拼货时间及优惠 -->
|
|
+ <view class="c-list">
|
|
- <!-- <discounts @clickCoupon="Getcoupon" :Info="goodsObjact.store_info" :showCoupon="true"></discounts> -->
|
|
+ <view class="c-row b-b" @click="toggleSpec">
|
|
- <!-- 猜你喜欢 -->
|
|
+ <text class="tit">购买数量</text>
|
|
- <!-- <guess-like @Addcar='Addcar' @clickNavTo='navToDetailPage' :goodList = 'good_list||[]'></guess-like> -->
|
|
+ <view class="con">
|
|
|
|
+ <text class="selected-text">{{ goodsNumber }}</text>
|
|
|
|
+ </view>
|
|
|
|
+ <text class="iconfont iconenter"></text>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
<!-- 评价 -->
|
|
<!-- 评价 -->
|
|
<estimate @navTo="navTo('/pages/product/reply?id=' + goodsid)" v-if="reply" :reply="reply" :list="list"></estimate>
|
|
<estimate @navTo="navTo('/pages/product/reply?id=' + goodsid)" v-if="reply" :reply="reply" :list="list"></estimate>
|
|
- <!-- 规格信息 -->
|
|
|
|
- <fresh-detail :goodsObjact="goodsObjact"></fresh-detail>
|
|
|
|
<!-- 图文详情 -->
|
|
<!-- 图文详情 -->
|
|
<content-text :description="description"></content-text>
|
|
<content-text :description="description"></content-text>
|
|
<!-- 底部高度撑开 -->
|
|
<!-- 底部高度撑开 -->
|
|
<view class="contentBottomHeight"></view>
|
|
<view class="contentBottomHeight"></view>
|
|
<!-- 底部操作菜单 -->
|
|
<!-- 底部操作菜单 -->
|
|
- <product-bottom @buy="buy" :goodsObjact="goodsObjact" :goodsid="goodsid" @specOPne="specOPne"></product-bottom>
|
|
+ <product-bottom @buy="buy" :goodsObjact="goodsObjact" :goodsid="goodsid" @specOPne="specOPne" :is_gold="is_gold"></product-bottom>
|
|
<!-- 规格-模态层弹窗 -->
|
|
<!-- 规格-模态层弹窗 -->
|
|
<view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
|
|
<view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
|
|
<!-- 遮罩层 -->
|
|
<!-- 遮罩层 -->
|
|
@@ -26,13 +29,13 @@
|
|
<view class="a-t">
|
|
<view class="a-t">
|
|
<image :src="actionImage"></image>
|
|
<image :src="actionImage"></image>
|
|
<view class="right">
|
|
<view class="right">
|
|
- <text class="name">{{ goodsObjact.store_name }}</text>
|
|
+ <view class="good-name clamp">{{ goodsObjact.store_name }}</view>
|
|
- <text class="price">¥{{ actionPrice * goodsNumber }}</text>
|
|
+ <text class="price">¥{{ actionPrice }}</text>
|
|
- <text class="stock">库存:{{ goodsStore }}件</text>
|
|
+ <!-- <text class="stock">库存:{{ goodsObjact.stock }}件</text>
|
|
- <view class="selected" v-if="specList != ''">
|
|
+ <view class="selected" v-if="goodsType == 0">
|
|
已选:
|
|
已选:
|
|
<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
|
|
<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
|
|
- </view>
|
|
+ </view> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-for="(item, index) in specList" :key="index" class="attr-list">
|
|
<view v-for="(item, index) in specList" :key="index" class="attr-list">
|
|
@@ -49,20 +52,20 @@
|
|
</text>
|
|
</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <!-- <view class="attr-list">
|
|
+ <view class="attr-list">
|
|
<text>购买数量</text>
|
|
<text>购买数量</text>
|
|
<view class="item-list">
|
|
<view class="item-list">
|
|
<uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax" @eventChange="numberChange"></uni-number-box>
|
|
<uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax" @eventChange="numberChange"></uni-number-box>
|
|
</view>
|
|
</view>
|
|
- </view> -->
|
|
+ </view>
|
|
- <button class="btn" @click.stop="buy" v-show="buys_show">完成</button>
|
|
+ <button class="btn" @click.stop="buy">完成</button>
|
|
- <button class="btn" style="background-color: #999999;" v-show="buys_shows">售罄</button>
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import uniNumberBox from '@/components/uni-number-box.vue';
|
|
import { goodsDetail, cartAdd } from '@/api/product.js';
|
|
import { goodsDetail, cartAdd } from '@/api/product.js';
|
|
import { mapState } from 'vuex';
|
|
import { mapState } from 'vuex';
|
|
import store from '@/store/index.js';
|
|
import store from '@/store/index.js';
|
|
@@ -88,6 +91,7 @@ import guessLike from './common/guessLike.vue';
|
|
import estimate from './common/estimate.vue';
|
|
import estimate from './common/estimate.vue';
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
|
|
+ uniNumberBox,
|
|
guessLike,
|
|
guessLike,
|
|
topSwiper,
|
|
topSwiper,
|
|
productContent,
|
|
productContent,
|
|
@@ -109,6 +113,7 @@ export default {
|
|
reply: '', //评论
|
|
reply: '', //评论
|
|
list: '', //商品详情的数据
|
|
list: '', //商品详情的数据
|
|
type: 1, //默认支付方式add为
|
|
type: 1, //默认支付方式add为
|
|
|
|
+ is_gold: 0,//是否是金豆商品
|
|
goodsType: 0,
|
|
goodsType: 0,
|
|
goodsNumber: 1, //购买数量
|
|
goodsNumber: 1, //购买数量
|
|
goodsid: '', //商品id
|
|
goodsid: '', //商品id
|
|
@@ -167,6 +172,10 @@ export default {
|
|
//保存商品id
|
|
//保存商品id
|
|
this.goodsid = options.id;
|
|
this.goodsid = options.id;
|
|
this.goodsType = options.type;
|
|
this.goodsType = options.type;
|
|
|
|
+ // 判断是否是金豆商品
|
|
|
|
+ if (options.is_gold){
|
|
|
|
+ obj.is_gold = options.is_gold
|
|
|
|
+ }
|
|
// 判断有无人邀请
|
|
// 判断有无人邀请
|
|
if (options.spread) {
|
|
if (options.spread) {
|
|
// 存储邀请人
|
|
// 存储邀请人
|
|
@@ -279,30 +288,6 @@ export default {
|
|
url: '/pages/product/reply?id=' + this.goodsid
|
|
url: '/pages/product/reply?id=' + this.goodsid
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- //加入购物车
|
|
|
|
- Addcar(item) {
|
|
|
|
- let obj = this;
|
|
|
|
- cartAdd({
|
|
|
|
- cartNum: '1', //商品数量
|
|
|
|
- uniqueId: '', //商品标签
|
|
|
|
- new: 0, //商品是否新增加到购物车1为不加入0为加入
|
|
|
|
- mer_id: '',
|
|
|
|
- productId: item.id //商品编号
|
|
|
|
- })
|
|
|
|
- .then(function(e) {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '成功加入购物车',
|
|
|
|
- type: 'top',
|
|
|
|
- duration: 500,
|
|
|
|
- icon: 'none'
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- obj.goodsDetail();
|
|
|
|
- })
|
|
|
|
- .catch(e => {
|
|
|
|
- console.log(e);
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
goodsDetail() {
|
|
goodsDetail() {
|
|
let obj = this;
|
|
let obj = this;
|
|
// 获取普通商品信息
|
|
// 获取普通商品信息
|
|
@@ -317,33 +302,28 @@ export default {
|
|
} //小程序商品详情图超出屏幕问题
|
|
} //小程序商品详情图超出屏幕问题
|
|
obj.imgList = goods.slider_image; //保存轮播图
|
|
obj.imgList = goods.slider_image; //保存轮播图
|
|
obj.specList = data.productAttr; //保存分类列表
|
|
obj.specList = data.productAttr; //保存分类列表
|
|
- if (Array.isArray(data.productValue) != true) {
|
|
+ obj.productValue = data.productValue; //保存分类查询数据
|
|
- obj.many = 2;
|
|
+ obj.actionPrice = goods.price; //保存默认选中商品价格
|
|
- obj.specList = data.productAttr; //保存产品属性
|
|
+ obj.actionImage = goods.image_base; //保存默认选中商品价格
|
|
- obj.productValue = data.productValue; //保存属性值
|
|
+ obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
|
|
- 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;
|
|
|
|
- obj.productValue = data.productValue; //保存分类查询数据
|
|
|
|
- obj.actionPrice = goods.price; //保存默认选中商品价格
|
|
|
|
- obj.actionImage = goods.image_base; //保存默认选中商品图片
|
|
|
|
- obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
|
|
|
|
- }
|
|
|
|
obj.shopId = data.mer_id; //保存商店id
|
|
obj.shopId = data.mer_id; //保存商店id
|
|
|
|
+ // 保存默认选中的对象
|
|
|
|
+ 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(',');
|
|
|
|
+ // 设置默认值
|
|
|
|
+ // obj.actionImage = obj.productValue[str].image;
|
|
|
|
+ // obj.uniqueId = obj.productValue[str].unique;
|
|
|
|
+ // #ifdef H5
|
|
|
|
+ // obj.shareDate();
|
|
|
|
+ // #endif
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 立即购买
|
|
// 立即购买
|
|
@@ -354,7 +334,8 @@ export default {
|
|
cartNum: obj.goodsNumber, //商品数量
|
|
cartNum: obj.goodsNumber, //商品数量
|
|
new: 1,
|
|
new: 1,
|
|
productId: obj.goodsid, //商品编号
|
|
productId: obj.goodsid, //商品编号
|
|
- uniqueId: obj.uniqueId
|
|
+ uniqueId: obj.uniqueId,
|
|
|
|
+ is_gold: obj.is_gold,//是否是金豆商品
|
|
};
|
|
};
|
|
|
|
|
|
if (obj.type == 2) {
|
|
if (obj.type == 2) {
|
|
@@ -366,7 +347,7 @@ export default {
|
|
if (obj.type == 1) {
|
|
if (obj.type == 1) {
|
|
// 跳转到支付页
|
|
// 跳转到支付页
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: '/pages/order/createOrder?id=' + da.cartId
|
|
+ url: '/pages/order/createOrder?id=' + da.cartId + '&is_gold=' + obj.is_gold
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (obj.type == 2) {
|
|
if (obj.type == 2) {
|
|
@@ -496,18 +477,15 @@ export default {
|
|
}
|
|
}
|
|
/* 规格选择弹窗 */
|
|
/* 规格选择弹窗 */
|
|
.attr-content {
|
|
.attr-content {
|
|
- padding: 25rpx 30rpx;
|
|
+ padding: 10rpx 30rpx;
|
|
-
|
|
|
|
.a-t {
|
|
.a-t {
|
|
display: flex;
|
|
display: flex;
|
|
-
|
|
|
|
image {
|
|
image {
|
|
width: 170rpx;
|
|
width: 170rpx;
|
|
height: 170rpx;
|
|
height: 170rpx;
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
border-radius: 8rpx;
|
|
border-radius: 8rpx;
|
|
}
|
|
}
|
|
-
|
|
|
|
.right {
|
|
.right {
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
@@ -515,30 +493,30 @@ export default {
|
|
font-size: $font-sm + 2rpx;
|
|
font-size: $font-sm + 2rpx;
|
|
color: $font-color-base;
|
|
color: $font-color-base;
|
|
line-height: 42rpx;
|
|
line-height: 42rpx;
|
|
- width: 75%;
|
|
+ .good-name {
|
|
-
|
|
+ padding-top: 20rpx;
|
|
- .price {
|
|
+ max-width: 320rpx;
|
|
- font-size: $font-lg;
|
|
+ font-size: 30rpx;
|
|
- color: $uni-color-primary;
|
|
+ font-family: PingFang SC;
|
|
- margin: 10rpx 0rpx;
|
|
+ font-weight: bold;
|
|
|
|
+ color: #1d2023;
|
|
|
|
+ line-height: 42rpx;
|
|
|
|
+ margin-bottom: 15rpx;
|
|
}
|
|
}
|
|
-
|
|
+ .price {
|
|
- .name {
|
|
+ font-size: 60rpx;
|
|
- font-size: 32rpx;
|
|
+ font-family: PingFang SC;
|
|
- color: $font-color-dark;
|
|
+ font-weight: bold;
|
|
- height: 50rpx;
|
|
+ color: #ff6f0f;
|
|
- overflow: hidden;
|
|
+ // font-size: $font-lg;
|
|
- text-overflow: ellipsis;
|
|
+ // color: $uni-color-primary;
|
|
- white-space: nowrap;
|
|
+ // margin-bottom: 10rpx;
|
|
- display: block;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
.selected-text {
|
|
.selected-text {
|
|
margin-right: 10rpx;
|
|
margin-right: 10rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
.attr-list {
|
|
.attr-list {
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
@@ -547,17 +525,16 @@ export default {
|
|
padding-top: 30rpx;
|
|
padding-top: 30rpx;
|
|
padding-left: 10rpx;
|
|
padding-left: 10rpx;
|
|
}
|
|
}
|
|
-
|
|
|
|
.item-list {
|
|
.item-list {
|
|
padding: 20rpx 0 0;
|
|
padding: 20rpx 0 0;
|
|
display: flex;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
flex-wrap: wrap;
|
|
-
|
|
+ .tit {
|
|
- text {
|
|
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
background: #eee;
|
|
background: #eee;
|
|
|
|
+ // margin-left: 10rpx;
|
|
margin-right: 20rpx;
|
|
margin-right: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
border-radius: 100rpx;
|
|
border-radius: 100rpx;
|
|
@@ -567,14 +544,56 @@ export default {
|
|
font-size: $font-base;
|
|
font-size: $font-base;
|
|
color: $font-color-dark;
|
|
color: $font-color-dark;
|
|
}
|
|
}
|
|
-
|
|
|
|
.selected {
|
|
.selected {
|
|
- background: #ddffdf;
|
|
+ background: #fbebee;
|
|
color: $uni-color-primary;
|
|
color: $uni-color-primary;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+.c-list {
|
|
|
|
+ margin-top: 20rpx;
|
|
|
|
+ font-size: $font-sm + 2rpx;
|
|
|
|
+ color: $font-color-base;
|
|
|
|
+ background: #fff;
|
|
|
|
+ .c-row {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
|
+ position: relative;
|
|
|
|
+ }
|
|
|
|
+ .tit {
|
|
|
|
+ width: 140rpx;
|
|
|
|
+ }
|
|
|
|
+ .con {
|
|
|
|
+ flex: 1;
|
|
|
|
+ color: $font-color-dark;
|
|
|
|
+ .selected-text {
|
|
|
|
+ margin-right: 10rpx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .bz-list {
|
|
|
|
+ height: 40rpx;
|
|
|
|
+ font-size: $font-sm + 2rpx;
|
|
|
|
+ color: $font-color-dark;
|
|
|
|
+ text {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ margin-right: 30rpx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .con-list {
|
|
|
|
+ flex: 1;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ color: $font-color-dark;
|
|
|
|
+ line-height: 40rpx;
|
|
|
|
+ }
|
|
|
|
+ .red {
|
|
|
|
+ color: $uni-color-primary;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
//默认商品底部高度
|
|
//默认商品底部高度
|
|
.goodsBottom {
|
|
.goodsBottom {
|
|
height: 160rpx;
|
|
height: 160rpx;
|