增加新功能

This commit is contained in:
hejiangming
2025-03-23 20:36:06 +08:00
parent 2ae62b59ed
commit 78270eeda0
184 changed files with 2690 additions and 1496 deletions
+30 -38
View File
@@ -96,13 +96,17 @@
<view class="product_but_warp">
<view class="product_but_left">
<view class="left_item">
<up-image src="/static/product/home.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpHome"></up-image>
<up-image src="/static/product/home.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpOther('home')"></up-image>
<view>首页</view>
</view>
<view class="left_item">
<up-image src="/static/product/kefu.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpShare"></up-image>
<up-image src="/static/product/kefu.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpOther('share')"></up-image>
<view>咨询</view>
</view>
<view class="left_item">
<up-image src="/static/product/cart.png" width="24" height="20" bgColor="#f1f6ff00" @click="jumpOther('cart')"></up-image>
<view>购物车</view>
</view>
</view>
<view class="product_but_right">
<view class="but_comm join_warp" @click="checkSpecification(true,'addCart')">加入购物车</view>
@@ -111,7 +115,7 @@
</view>
<!-- 选择规格的弹框 -->
<up-popup
v-model:show="specificationShow"
:show="specificationShow"
:round="10"
:closeOnClickOverlay="false"
:closeable="true"
@@ -212,19 +216,7 @@
currentNum:1,
specificationShow:false,
specificationShowType:'',// 弹框类型
orderInfo:{
id:1,
url:"/static/common/product_def.png",
price:87.00,
oPrice:199.00,
couponPrice:50,
inventory:100,// 库存
quantity:1,
addressObj:{
name:'李个',
address:'郑州市金水区东风路街道白庙小区五号楼'
},
},
orderInfo:{},
specificationList:[],//规格
selectSpecification:[],// 选择的规格
specificationTempl:[],// 规格模版数据
@@ -246,16 +238,20 @@
delta: 1 // 返回的页面数,默认为1,返回到上一级
});
},
jumpHome(){
uni.switchTab({
url: '/pages/home/home',
})
},
// 分享
jumpShare(){
uni.navigateTo({
url: '/pages/invite_friends/invite_friends',
})
jumpOther(type){
if(type === 'home'){
uni.switchTab({// 首页
url: '/pages/home/home',
})
}else if(type === "share"){// 分享
uni.navigateTo({
url: '/pages/invite_friends/invite_friends',
})
}else if(type === "cart"){// 购物车
uni.switchTab({
url: '/pages/shopping_cart/shopping_cart',
})
}
},
/**
* 查询详细内容
@@ -275,14 +271,16 @@
data.quantity=1// 数量
data.inventory=0// 库存
this.orderInfo = data;
this.getSpecification(data.specs);
}
},
checkSpecification(val,type){
async checkSpecification(val,type){
// 需要查询一下最新的规格
if(val){
this.querySpecification()
await this.querySpecification()
const data = this.orderInfo;
this.getSpecification(data.specs);
}else{
this.specificationList=[];//规格
this.selectSpecification=[];// 选择的规格
@@ -293,12 +291,10 @@
},
// 拆解规格
getSpecification(specs){
console.log("specs",specs);
const optionArr=[];
if(specs){
const arr = JSON.parse(specs);
arr.map(item=>{
console.log("item",item);
optionArr.push({
type:item.type,
items:item.items,
@@ -373,9 +369,7 @@
}
this.orderInfo.quantity = currentQuantity;
},
/**
* 立即购买,确定订单页面
*/
// 立即购买,确定订单页面
byFun(){
// 先加入购物车,再去购买
this.addCart();
@@ -383,9 +377,7 @@
url: '/pages/order_submit/order_submit',
})
},
/**
* 加入购入车
*/
// 加入购入车
async addCart(){
const selectTempl = this.selectSpecificationTempl;
if(!selectTempl || Object.keys(selectTempl).length ===0){
@@ -546,7 +538,7 @@
.product_but_left{
display: flex;
justify-content: space-between;
width: 30%;
width: 36%;
.left_item{
width: 50%;
text-align: center;