|
|
@@ -72,7 +72,7 @@
|
|
|
<view class="shop_names">{{ detail.goods_name }}</view>
|
|
|
<view class="goods_msg" v-if="type == 1">¥{{ detail.total_amount }}</view>
|
|
|
<view class="goods_msg" v-else-if="type == 2">{{ detail.trade_price }}元+{{ detail.trade_num }}批发券+{{ detail.treasure_price }}茶宝</view>
|
|
|
- <view class="goods_msg" v-else>¥{{ detail.cost_price }}</view>
|
|
|
+ <view class="goods_msg" v-else>¥{{ afterSpecPrice }}</view>
|
|
|
<view class="num_con flex_r flex_je" v-if="type != 6">
|
|
|
<uni-number-box :min="1" @change="bindChange" :value="buyNum"></uni-number-box>
|
|
|
</view>
|
|
|
@@ -89,6 +89,34 @@
|
|
|
<view class="raido_text">零售产品置换</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view>
|
|
|
+ <view v-if="detail.goods_spec_list.length > 0">
|
|
|
+ <view class="goods_spec">
|
|
|
+ <text>{{detail.goods_spec}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="goods_spec_list">
|
|
|
+ <view class="goods_spec_list_item"
|
|
|
+ v-for="(item,index) in detail.goods_spec_list" :key="index"
|
|
|
+ :class="goodsSpecIndex == index ? 'goods_spec_list_item_active' : ''"
|
|
|
+ @click="goodsSpecChange(item,index)">
|
|
|
+ <span>{{item.spec_name}}</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-if="detail.goods_attr_list.length > 0">
|
|
|
+ <view class="goods_spec">
|
|
|
+ <text>{{detail.goods_attr}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="goods_spec_list">
|
|
|
+ <view class="goods_spec_list_item"
|
|
|
+ v-for="(item,index) in detail.goods_attr_list" :key="index"
|
|
|
+ :class="goodsAttrIndex == index ? 'goods_spec_list_item_active' : ''"
|
|
|
+ @click="goodsAttrChange(item,index)">
|
|
|
+ <span>{{item.attr_name}}</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<checkbox-group class="flex_r flex_ac flex_jc" @change="checkboxChange">
|
|
|
<label class="option_box">
|
|
|
<checkbox value="1" :checked="checked" color="#2DB389" style="transform: scale(0.7)" />
|
|
|
@@ -97,7 +125,8 @@
|
|
|
<text @tap.stop="getProPage" v-else-if="type == 6">《天天捡漏协议》</text>
|
|
|
</label>
|
|
|
</checkbox-group>
|
|
|
- <view class="confim flex_r flex_ac flex_jc" @tap="ToPayPage">确定</view>
|
|
|
+ <view class="confim flex_r flex_ac flex_jc" v-if="type == 1" @tap="ToPayPage">立即支付</view>
|
|
|
+ <view class="confim flex_r flex_ac flex_jc" v-else @tap="ToPayPage">立即支付 ¥{{afterSpecPrice * buyNum}}</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
<!-- 购买或加入购物车弹窗-end -->
|
|
|
@@ -170,6 +199,8 @@ export default {
|
|
|
id: "", //合伙人套餐ID
|
|
|
detail: {
|
|
|
goods: {},
|
|
|
+ goods_spec_list: [],
|
|
|
+ goods_attr_list: [],
|
|
|
}, // 商品详情
|
|
|
checked: false, //是否选中协议
|
|
|
buyNum: 1, //购买数量
|
|
|
@@ -181,6 +212,11 @@ export default {
|
|
|
userinfo: {},
|
|
|
goodsDa: {},
|
|
|
unid: "",
|
|
|
+ goodsSpecIndex: 0,
|
|
|
+ goodsAttrIndex: 0,
|
|
|
+ specId: "0",
|
|
|
+ attrId: "0",
|
|
|
+ afterSpecPrice: 0, // 规格选择后显示价格
|
|
|
};
|
|
|
},
|
|
|
onLoad: function(e) {
|
|
|
@@ -199,10 +235,18 @@ export default {
|
|
|
post("v1/goods/goodsDetail", da).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
this.detail = res.data.data;
|
|
|
+ this.afterSpecPrice = this.detail.cost_price
|
|
|
let imgs = [];
|
|
|
imgs.push(this.detail.original_img);
|
|
|
imgs.push(...this.detail.goods_img);
|
|
|
this.detail.goods_img = imgs;
|
|
|
+ if (this.detail.goods_spec_list.length > 0) {
|
|
|
+ this.specId = this.detail.goods_spec_list[0].id
|
|
|
+ }
|
|
|
+ if (this.detail.goods_attr_list.length > 0) {
|
|
|
+ this.attrId = this.detail.goods_attr_list[0].id
|
|
|
+ }
|
|
|
+ this.getPrice()
|
|
|
} else {
|
|
|
uni.showModal({
|
|
|
title: "提示",
|
|
|
@@ -235,6 +279,10 @@ export default {
|
|
|
...this.goodsDa,
|
|
|
num: Number(this.buyNum),
|
|
|
is_sell: ['1', '2'].includes(this.type) ? this.pfway : "0",
|
|
|
+ spec_id: this.specId,
|
|
|
+ attr_id: this.attrId,
|
|
|
+ goods_id: this.detail.goods_id,
|
|
|
+
|
|
|
};
|
|
|
this.goto("/pages/to-pay-list/index", da);
|
|
|
},
|
|
|
@@ -324,6 +372,32 @@ export default {
|
|
|
async getuserInfo() {
|
|
|
this.userinfo = await uni.userfun();
|
|
|
},
|
|
|
+ // 选择规格
|
|
|
+ goodsSpecChange(item,index){
|
|
|
+ this.goodsSpecIndex = index;
|
|
|
+ this.specId = item.id
|
|
|
+ this.getPrice()
|
|
|
+ },
|
|
|
+ goodsAttrChange(item,index){
|
|
|
+ this.goodsAttrIndex = index
|
|
|
+ this.attrId = item.id
|
|
|
+ this.getPrice()
|
|
|
+ },
|
|
|
+ getPrice(){
|
|
|
+ post("v1/goods/getPrice", {
|
|
|
+ goods_id: this.detail.goods_id,
|
|
|
+ spec_id: this.specId,
|
|
|
+ attr_id: this.attrId,
|
|
|
+ type: this.type
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ if(res.data){
|
|
|
+ this.afterSpecPrice = res.data.cost_price
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
onShareAppMessage() {
|
|
|
let userinfo = uni.getStorageSync("userinfo");
|
|
|
@@ -513,11 +587,20 @@ page {
|
|
|
}
|
|
|
|
|
|
.num_con {
|
|
|
- width: 100%;
|
|
|
+ // width: 100%;
|
|
|
overflow: hidden;
|
|
|
padding-bottom: 3rpx;
|
|
|
}
|
|
|
-
|
|
|
+.quota_text{
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #545454;
|
|
|
+ padding-left: 6rpx;
|
|
|
+}
|
|
|
+.quota_num_text{
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #545454;
|
|
|
+ padding-left: 6rpx;
|
|
|
+}
|
|
|
.num_str {
|
|
|
font-size: 14px;
|
|
|
color: #989898;
|
|
|
@@ -592,7 +675,7 @@ page {
|
|
|
.goods_msg {
|
|
|
width: 100%;
|
|
|
overflow: hidden;
|
|
|
- font-size: 28rpx;
|
|
|
+ font-size: 34rpx;
|
|
|
color: #18bb88;
|
|
|
font-family: "SourceHanSansCN-Medium";
|
|
|
font-weight: 500;
|
|
|
@@ -640,4 +723,55 @@ page {
|
|
|
padding: 0 16rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// 商品规格样式-start
|
|
|
+.goods_spec{
|
|
|
+ font-size: 28rpx;
|
|
|
+ padding-top: 28rpx;
|
|
|
+}
|
|
|
+.goods_spec_list{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ padding-top: 20rpx;
|
|
|
+
|
|
|
+ &_item{
|
|
|
+ font-size: 24rpx;
|
|
|
+ padding: 14rpx 28rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ border: 2rpx solid #F7F7F7;
|
|
|
+ margin-right: 12rpx;
|
|
|
+ margin-bottom: 14rpx;
|
|
|
+ background-color: #F7F7F7;
|
|
|
+
|
|
|
+ }
|
|
|
+ &_item_active{
|
|
|
+ color: #ff6d44;
|
|
|
+ border: 2rpx solid #ff6d44;
|
|
|
+ background-color: #FFF8F2;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 商品规格样式-end
|
|
|
+
|
|
|
+::v-deep .uni-numbox{
|
|
|
+ border-radius: 10rpx !important;
|
|
|
+ background-color: #F7F7F7 !important;
|
|
|
+
|
|
|
+}
|
|
|
+::v-deep .uni-numbox__value{
|
|
|
+ border-radius: 10rpx !important;
|
|
|
+ background-color: #F7F7F7 !important;
|
|
|
+}
|
|
|
+::v-deep .uni-numbox__minus, ::v-deep .uni-numbox__plus{
|
|
|
+ // border: 1rpx solid #888888 !important;
|
|
|
+ // color: #fff !important;
|
|
|
+ background-color: #f0f0f0 !important;
|
|
|
+}
|
|
|
+// ::v-deep .uni-numbox--text{
|
|
|
+// color: #fff !important;
|
|
|
+// }
|
|
|
+// ::v-deep .uni-numbox--disabled{
|
|
|
+// color: #cecece !important;
|
|
|
+// }
|
|
|
</style>
|