Commit ba161133 authored by 罗超's avatar 罗超

修改部分BUG

parent 276d0d5e
......@@ -147,6 +147,20 @@ export default {
g: {},
skuObj: null,
notStockGood: [],
forms:{
list: [
{
mch_id: 0,
goods_list: [],
distance: 0,
remark: "",
order_form: [],
use_integral: 0,
user_coupon_id: 0,
},
],
address_id: 0,
}
};
},
mounted() {
......@@ -224,7 +238,6 @@ export default {
},
buy() {
if (this.skuObj && this.skuObj.id) {
let goods = [];
let g = {
id: this.skuObj.goods_id,
num: this.gc,
......@@ -238,12 +251,11 @@ export default {
attr_group_id: x.attr_group_id,
});
});
goods.push(g);
console.log(goods);
this.forms.list[0].goods_list.push(g)
this.forms.list[0].mch_id=this.g.mch_id
uni.navigateTo({
url:
"/pages/order-submit/order-submit?goods=" +
encodeURIComponent(JSON.stringify(goods)),
"/pages/order-submit/order-submit?formData=" + encodeURIComponent(JSON.stringify(this.forms)),
complete(res) {
console.log(res);
},
......
......@@ -10,41 +10,49 @@
style="width: 100%; height: 100%;"
/>
</view>
<view class="good-name">{{ cx.name }}</view>
<view class="good-name" v-if="setting.is_show_goods_name=='1'">{{ cx.name }}</view>
<view class="good-info">
<view class="price" :style="{ color: mainColor }">{{
cx.price_content
}}</view>
<view class="sell">{{ cx.sales }}</view>
<view class="cart" @click.stop="showSkuHandler(cx)">
<view class="sell" v-if="setting.is_show_sales_num=='1'">{{ cx.sales }}</view>
<view v-if="setting.is_show_cart=='1'" class="cart" @click.stop="showSkuHandler(cx)">
<u-icon name="cart-o" size="40" :color="mainColor" />
</view>
</view>
</view>
</u-col>
</u-row>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
<good-sku
v-if="showSku"
:option-type="2"
borderRadius="20"
v-model="showSku"
:good="sku"
></good-sku>
</view>
</template>
<script>
import goodSku from '../goods/goodsku'
import goodSku from "../goods/goodsku";
export default {
components:{
goodSku
components: {
goodSku,
},
props: ["list"],
data() {
return {
g: [],
showSku:false,
sku:{},
mainColor:""
showSku: false,
sku: {},
mainColor: "",
setting:{}
};
},
mounted() {
this.g = this.list;
this.mainColor = this.$uiConfig.mainColor;
this.initConfig()
},
watch: {
list: {
......@@ -52,19 +60,22 @@ export default {
immediate: true,
handler: function (newVal, oldVal) {
this.g = newVal;
}
},
},
},
methods: {
initConfig() {
this.setting = uni.getStorageSync("basedata").mall.setting
},
clickHandler(url) {
uni.navigateTo({
url: url,
});
},
showSkuHandler(g){
this.sku=g
this.showSku=true
}
showSkuHandler(g) {
this.sku = g;
this.showSku = true;
},
},
};
</script>
......
......@@ -5,6 +5,9 @@
"pages": [{
"path": "pages/index/index"
},
{
"path": "pages/order-submit/order-submit"
},
{
"path": "pages/search/search"
},
......
......@@ -26,122 +26,138 @@
mode="car"
></u-empty>
<view
class="cartList"
:style="{ 'margin-bottom': listbottom }"
v-if="list.length > 0"
v-for="(c, i) in list"
:key="i"
>
<view
style="padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5;width: 100%;"
>
<u-checkbox-group @change="mch_SelectAll(c.checked,i)">
<u-checkbox v-model="c.checked" shape="circle" :active-color="mc"
>{{c.name}}</u-checkbox
>
</u-checkbox-group>
</view>
<template v-if="list.length > 0">
<view
class="cartList_item"
v-for="(item, index) in c.goods_list"
:key="index"
:name="item.name"
class="cartList"
:style="{ 'margin-bottom': listbottom }"
v-for="(c, i) in list"
:key="i"
>
<u-checkbox-group
v-if='item.new_status==0 || editType==true'
@change="clickcheckbox(item.checked, item.attrs.price, index,i)"
>
<u-checkbox
v-model="item.checked"
shape="circle"
:active-color="mc"
></u-checkbox>
</u-checkbox-group>
<Text v-if='item.new_status!=0 && editType==false' style='color: #a0a09d;width: 22px;'>失效</Text>
<image
:src="item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic"
mode="aspectFill"
style="
width: 150rpx;
height: 150rpx;
margin-left: 30rpx;
border-radius: 5px;
"
/>
<view
style="
display: flex;
flex-direction: column;
justify-content: space-between;
width: 460rpx;
height: 150rpx;
margin-left: 20rpx;
padding: 0 12px 12px 12px;
border-bottom: 1rpx solid #f5f5f5;
width: 100%;
"
>
<u-checkbox-group @change="mch_SelectAll(c.checked, i)">
<u-checkbox v-model="c.checked" shape="circle" :active-color="mc">{{
c.name
}}</u-checkbox>
</u-checkbox-group>
</view>
<view
class="cartList_item"
v-for="(item, index) in c.goods_list"
:key="index"
:name="item.name"
>
<u-checkbox-group
v-if="item.new_status == 0 || editType == true"
@change="clickcheckbox(item.checked, item.attrs.price, index, i)"
>
<u-checkbox
v-model="item.checked"
shape="circle"
:active-color="mc"
></u-checkbox>
</u-checkbox-group>
<Text
style="
font-size: 28rpx;
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>{{ item.goods.name }}</Text
v-if="item.new_status != 0 && editType == false"
style="color: #a0a09d; width: 22px;"
>失效</Text
>
<view
<image
:src="
item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic
"
mode="aspectFill"
style="
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 150rpx;
height: 150rpx;
margin-left: 30rpx;
border-radius: 5px;
"
>
<view v-for="(attr, inde2x) in item.attrs.attr" :key="inde2x">
<Text
style="color: #a0a09d; font-size: 24rpx; margin-right: 5rpx;"
>{{ attr.attr_group_name }}:{{ attr.attr_name }}</Text
>
</view>
</view>
/>
<view
style="
display: flex;
flex-direction: row;
align-items: center;
flex-direction: column;
justify-content: space-between;
width: 460rpx;
height: 150rpx;
margin-left: 20rpx;
"
>
<Text style="font-size: 30rpx;" :style="{ color: mc }"
>¥<Text style="40rpx">{{ item.attrs.price }}</Text></Text
<Text
style="
font-size: 28rpx;
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>{{ item.goods.name }}</Text
>
<!-- <u-number-box :value="item.num" :min="1" :max='100' :input-width="100" @change="valChange(i,index, item.num,item.attrs.price,$event)"></u-number-box> -->
<view class="item_input">
<view
class="item_input_l"
:style="{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(i,index, item.attrs.price)"
>-</view
>
<input type="number" class="item_input_c"
:value="item.num"
@blur='inputblur(i,index, item.num,item.attrs.price,$event)'
@input='onKeyInput(i,index, item.num,item.attrs.price,$event)'/>
<view
class="item_input_r"
style="color: #9b9b9b;"
@click="plus(i,index, item.attrs.price)"
>+</view
<view
style="
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>
<view v-for="(attr, inde2x) in item.attrs.attr" :key="inde2x">
<Text
style="color: #a0a09d; font-size: 24rpx; margin-right: 5rpx;"
>{{ attr.attr_group_name }}:{{ attr.attr_name }}</Text
>
</view>
</view>
<view
style="
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
"
>
<Text style="font-size: 30rpx;" :style="{ color: mc }"
>¥<Text style="40rpx">{{ item.attrs.price }}</Text></Text
>
<!-- <u-number-box :value="item.num" :min="1" :max='100' :input-width="100" @change="valChange(i,index, item.num,item.attrs.price,$event)"></u-number-box> -->
<view class="item_input">
<view
class="item_input_l"
:style="{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(i, index, item.attrs.price)"
>-</view
>
<input
type="number"
class="item_input_c"
:value="item.num"
@blur="
inputblur(i, index, item.num, item.attrs.price, $event)
"
@input="
onKeyInput(i, index, item.num, item.attrs.price, $event)
"
/>
<view
class="item_input_r"
style="color: #9b9b9b;"
@click="plus(i, index, item.attrs.price)"
>+</view
>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<view class="box_bottom" :style="{ 'margin-bottom': bottommargin }">
<div style="margin-left: 30rpx;">
......@@ -209,7 +225,7 @@ export default {
listbottom: 0,
editType: false,
list: [],
cart_id_list: [],
mc: "",
secondary: "",
......@@ -278,9 +294,9 @@ export default {
let list = res.data.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j)=>{
j.checked = false;
})
x.goods_list.forEach((j) => {
j.checked = false;
});
});
this.list = list;
} else {
......@@ -290,35 +306,35 @@ export default {
);
},
clickcheckbox(checked, price, index,i) {
clickcheckbox(checked, price, index, i) {
if (checked == true) {
this.checkCount += 1;
this.TotalPrice += price * this.list[i].goods_list[index].num;
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.forEach((x) => {
if(this.editType == false){//编辑的时候不判断
if (x.checked == false&& x.new_status==0) {
goods_list_all = false;
}
}else{
if (x.checked == false) {
goods_list_all = false;
}
}
if (this.editType == false) {
//编辑的时候不判断
if (x.checked == false && x.new_status == 0) {
goods_list_all = false;
}
} else {
if (x.checked == false) {
goods_list_all = false;
}
}
});
if (goods_list_all == true) {
this.list[i].checked = true;
}
let list_all = true; //判断所有商场是否全选
this.list.forEach((x)=>{
if(x.checked == false){
list_all=false
}
})
if (list_all == true) {
this.allchecked = true;
}
let list_all = true; //判断所有商场是否全选
this.list.forEach((x) => {
if (x.checked == false) {
list_all = false;
}
});
if (list_all == true) {
this.allchecked = true;
}
if (this.editType == true) {
let obj = {
mch_id: 0,
......@@ -330,17 +346,17 @@ export default {
this.TotalPrice -= price * this.list[i].goods_list[index].num;
this.checkCount -= 1;
this.allchecked = false;
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.forEach((x) => {
if (x.checked == false) {
goods_list_all = false;
}
});
if (goods_list_all == false) {
this.list[i].checked = false;
}
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.forEach((x) => {
if (x.checked == false) {
goods_list_all = false;
}
});
if (goods_list_all == false) {
this.list[i].checked = false;
}
if (this.editType == true) {
this.cart_id_list.forEach((x,j) => {
this.cart_id_list.forEach((x, j) => {
if (x.id == this.list[i].goods_list[index].id) {
this.cart_id_list.splice(j, 1);
}
......@@ -348,132 +364,126 @@ export default {
}
}
},
mch_SelectAll(checked,i){
if(checked == true){
let add_cartlist=[];
let new_statusnum=0
this.list[i].goods_list.forEach((x)=>{
if(x.new_status==0){
this.TotalPrice +=x.attrs.price*x.num;
x.checked = true;
new_statusnum++
}
//编辑时候的商城全选
if(this.editType ==true){
if(this.cart_id_list.length>0){
this.cart_id_list.forEach((z) => {
if (x.id != z.id) {
let obj = {
mch_id: 0,
id: x.id,
};
add_cartlist.push(obj);
}
});
}else{
let obj = {
mch_id: 0,
id: x.id,
};
add_cartlist.push(obj);
}
}
})
this.cart_id_list= this.cart_id_list.concat(add_cartlist)
let list_all = true; //判断所有商场是否全选
this.list.forEach((x)=>{
if(x.checked == false){
list_all=false
}
})
if (list_all == true) {
this.allchecked = true;
}
this.checkCount+=new_statusnum;
}else{
let new_statusnum=0
this.list[i].goods_list.forEach((x)=>{
if(x.new_status==0){
x.checked = false;
this.TotalPrice -=x.attrs.price*x.num;
new_statusnum++
}
//编辑时候的商城全选
this.cart_id_list.forEach((z,m) => {
if (x.id == z.id) {
this.cart_id_list.splice(m,1)
}
});
})
this.allchecked = false;
this.checkCount-=new_statusnum;
}
},
mch_SelectAll(checked, i) {
if (checked == true) {
let add_cartlist = [];
let new_statusnum = 0;
this.list[i].goods_list.forEach((x) => {
if (x.new_status == 0) {
this.TotalPrice += x.attrs.price * x.num;
x.checked = true;
new_statusnum++;
}
//编辑时候的商城全选
if (this.editType == true) {
if (this.cart_id_list.length > 0) {
this.cart_id_list.forEach((z) => {
if (x.id != z.id) {
let obj = {
mch_id: 0,
id: x.id,
};
add_cartlist.push(obj);
}
});
} else {
let obj = {
mch_id: 0,
id: x.id,
};
add_cartlist.push(obj);
}
}
});
this.cart_id_list = this.cart_id_list.concat(add_cartlist);
let list_all = true; //判断所有商场是否全选
this.list.forEach((x) => {
if (x.checked == false) {
list_all = false;
}
});
if (list_all == true) {
this.allchecked = true;
}
this.checkCount += new_statusnum;
} else {
let new_statusnum = 0;
this.list[i].goods_list.forEach((x) => {
if (x.new_status == 0) {
x.checked = false;
this.TotalPrice -= x.attrs.price * x.num;
new_statusnum++;
}
//编辑时候的商城全选
this.cart_id_list.forEach((z, m) => {
if (x.id == z.id) {
this.cart_id_list.splice(m, 1);
}
});
});
this.allchecked = false;
this.checkCount -= new_statusnum;
}
},
SelectAll() {
let list = this.list;
let list = this.list;
if (this.allchecked == true) {
this.checkCount = 0;
this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach((x) => {
x.checked = true;
x.goods_list.forEach((j)=>{
if(j.new_status==0){
j.checked = true;
this.checkCount++;
this.TotalPrice+=j.attrs.price*j.num
}
//编辑的时候
if (this.editType == true) {
this.cart_id_list.push({
mch_id: 0,
id: j.id,
});
}
})
});
this.checkCount = 0;
this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach((x) => {
x.checked = true;
x.goods_list.forEach((j) => {
if (j.new_status == 0) {
j.checked = true;
this.checkCount++;
this.TotalPrice += j.attrs.price * j.num;
}
//编辑的时候
if (this.editType == true) {
this.cart_id_list.push({
mch_id: 0,
id: j.id,
});
}
});
});
} else {
this.checkCount = 0;
this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j)=>{
j.checked = false;
})
});
this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j) => {
j.checked = false;
});
});
}
},
inputblur(i, index, num, price, e) {
let value = Number(e.target.value);
if (value == 0) {
this.list[i].goods_list[index].num = 1;
this.TotalPrice += price * 1;
}
},
onKeyInput(i, index, num, price, e) {
//输入的数量
let value = Number(e.target.value);
this.list[i].goods_list[index].num = value;
if (this.list[i].goods_list[index].checked == true) {
if (value > num) {
this.TotalPrice += price * (value - num);
} else if (value < num) {
this.TotalPrice -= price * (num - value);
}
}
},
inputblur(i,index,num,price,e){
let value= Number(e.target.value)
if(value==0){
this.list[i].goods_list[index].num=1;
this.TotalPrice += price * 1;
}
},
onKeyInput(i,index,num,price,e){//输入的数量
let value= Number(e.target.value)
this.list[i].goods_list[index].num = value;
if(this.list[i].goods_list[index].checked == true){
if(value>num){
this.TotalPrice += price * (value -num);
}else if(value<num){
this.TotalPrice -= price * (num - value);
}
}
},
reduce(i,index, price) {
reduce(i, index, price) {
//减
if (this.list[i].goods_list[index].num > 1) {
this.list[i].goods_list[index].num -= 1;
......@@ -482,9 +492,9 @@ export default {
}
}
},
plus(i,index, price) {
plus(i, index, price) {
//加
this.list[i].goods_list[index].num +=1;
this.list[i].goods_list[index].num += 1;
if (this.list[i].goods_list[index].checked == true) {
this.TotalPrice += price * 1;
}
......@@ -493,18 +503,17 @@ export default {
this.editType = !this.editType;
this.allchecked = false;
this.TotalPrice = 0;
this.checkCount = 0;
this.cart_id_list = [];
let list = this.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j)=>{
j.checked = false
})
});
this.checkCount = 0;
this.cart_id_list = [];
let list = this.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j) => {
j.checked = false;
});
});
},
delete_btn() {
if (this.cart_id_list.length > 0) {
uni.showNavigationBarLoading();
let h = this.apiheader();
......@@ -526,7 +535,7 @@ export default {
this.TotalPrice = 0;
this.editType = false;
this.allchecked = false;
this.checkCount = 0;
this.checkCount = 0;
uni.hideNavigationBarLoading();
}
);
......@@ -541,29 +550,44 @@ export default {
},
settlement() {
if (this.checkCount > 0) {
let goods = [];
this.list.forEach((x) => {
if (x.checked) {
let g = {
id: x.goods_id,
num: x.num,
cart_id: x.id,
goods_attr_id: x.attr_id,
attr: [],
};
x.attrs.attr.forEach((x) => {
g.attr.push({
attr_id: x.attr_id,
attr_group_id: x.attr_group_id,
});
});
goods.push(g);
let forms = {
list: [],
address_id:0,
};
this.list.forEach((y) => {
let good={
mch_id:y.mch_id,
goods_list: [],
distance: 0,
remark: "",
order_form: [],
use_integral: 0,
user_coupon_id: 0,
}
y.goods_list.forEach((x) => {
if (x.checked) {
let g = {
id: x.goods_id,
num: x.num,
cart_id: x.id,
goods_attr_id: x.attr_id,
attr: [],
};
x.attrs.attr.forEach((x) => {
g.attr.push({
attr_id: x.attr_id,
attr_group_id: x.attr_group_id,
});
});
good.goods_list.push(g)
}
});
forms.list.push(good)
});
uni.navigateTo({
url:
"/pages/order-submit/order-submit?goods=" +
encodeURIComponent(JSON.stringify(goods))
"/pages/order-submit/order-submit?formData=" +
encodeURIComponent(JSON.stringify(forms)),
});
} else {
uni.showToast({
......
......@@ -11,6 +11,7 @@
:border-radius="0"
@click="previewImage"
></u-swiper>
<!-- TODO 分销价格未做 is_share_price -->
</view>
<view class="g-info">
<view class="g-name u-skeleton-rect">{{ g.name }}</view>
......@@ -24,9 +25,11 @@
: g.price_min + "-" + g.price_max
}}</text>
</view>
<!-- TODO is_common_user_member_price 普通用户会员价 -->
<!-- TODO is_member_user_member_price 会员用户会员价 -->
<view class="sell u-skeleton-rect">
<text class="oprice">{{ g.original_price }}</text>
<text>已售出{{ g.sales }}{{ g.unit }}</text>
<text class="oprice" v-if="setting.is_underline_price=='1'">{{ g.original_price }}</text>
<text v-if="setting.is_sales=='1'">已售出{{ g.sales }}{{ g.unit }}</text>
</view>
</view>
<view class="right u-skeleton-rect">
......@@ -91,7 +94,7 @@
</view>
</view>
<view class="sku-box u-skeleton-rect">
<view class="sku-box u-skeleton-rect" v-if="setting.is_express=='1'">
<view class="label">快递</view>
<view class="content">
{{ g.express == "" ? "免运费" : g.express }}
......@@ -120,7 +123,7 @@
<view
class="sku-box u-skeleton-rect"
v-if="comments.comments.length == 0"
v-if="comments.comments.length == 0 && setting.is_comment=='1'"
>
<view class="label">暂无评论信息</view>
</view>
......@@ -168,7 +171,8 @@
</view>
<u-skeleton
:loading="loading"
v-if="loading"
:loading="true"
:animation="true"
bgColor="#FFF"
></u-skeleton>
......@@ -211,7 +215,7 @@ export default {
data() {
return {
id: 0,
loading: false,
loading: true,
g: {},
imgs: [],
mc: "",
......@@ -226,6 +230,7 @@ export default {
currentSku: {},
isExsitGoods: true,
pageTitle: "商品详情",
setting:{}
};
},
components: {
......@@ -240,6 +245,7 @@ export default {
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.initPage();
this.setting = uni.getStorageSync("basedata").mall.setting
},
methods: {
initPage() {
......
......@@ -267,7 +267,7 @@ export default {
if (option.goods) {
this.formData.list[0].goods_list = JSON.parse(decodeURIComponent(option.goods));
} else if (option.formData) {
this.formData = JSON.parse(option.formData);
this.formData = JSON.parse(decodeURIComponent(option.formData));
} else {
uni.redirectTo({
url: '/pages/index/index'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment