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,22 +26,24 @@
mode="car"
></u-empty>
<template v-if="list.length > 0">
<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
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>
<view
......@@ -51,8 +53,8 @@
:name="item.name"
>
<u-checkbox-group
v-if='item.new_status==0 || editType==true'
@change="clickcheckbox(item.checked, item.attrs.price, index,i)"
v-if="item.new_status == 0 || editType == true"
@change="clickcheckbox(item.checked, item.attrs.price, index, i)"
>
<u-checkbox
v-model="item.checked"
......@@ -60,9 +62,15 @@
:active-color="mc"
></u-checkbox>
</u-checkbox-group>
<Text v-if='item.new_status!=0 && editType==false' style='color: #a0a09d;width: 22px;'>失效</Text>
<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"
:src="
item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic
"
mode="aspectFill"
style="
width: 150rpx;
......@@ -124,17 +132,24 @@
:style="{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(i,index, item.attrs.price)"
@click="reduce(i, index, item.attrs.price)"
>-</view
>
<input type="number" class="item_input_c"
<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)'/>
@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)"
@click="plus(i, index, item.attrs.price)"
>+</view
>
</view>
......@@ -142,6 +157,7 @@
</view>
</view>
</view>
</template>
<view class="box_bottom" :style="{ 'margin-bottom': bottommargin }">
<div style="margin-left: 30rpx;">
......@@ -278,9 +294,9 @@ export default {
let list = res.data.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j)=>{
x.goods_list.forEach((j) => {
j.checked = false;
})
});
});
this.list = list;
} else {
......@@ -290,32 +306,32 @@ 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) {
if (this.editType == false) {
//编辑的时候不判断
if (x.checked == false && x.new_status == 0) {
goods_list_all = false;
}
}else{
} 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
this.list.forEach((x) => {
if (x.checked == false) {
list_all = false;
}
})
});
if (list_all == true) {
this.allchecked = true;
}
......@@ -340,7 +356,7 @@ export default {
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,21 +364,20 @@ 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;
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++
new_statusnum++;
}
//编辑时候的商城全选
if(this.editType ==true){
if(this.cart_id_list.length>0){
if (this.editType == true) {
if (this.cart_id_list.length > 0) {
this.cart_id_list.forEach((z) => {
if (x.id != z.id) {
let obj = {
......@@ -372,7 +387,7 @@ export default {
add_cartlist.push(obj);
}
});
}else{
} else {
let obj = {
mch_id: 0,
id: x.id,
......@@ -380,38 +395,36 @@ export default {
add_cartlist.push(obj);
}
}
})
this.cart_id_list= this.cart_id_list.concat(add_cartlist)
});
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
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){
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;
this.TotalPrice -= x.attrs.price * x.num;
new_statusnum++
new_statusnum++;
}
//编辑时候的商城全选
this.cart_id_list.forEach((z,m) => {
this.cart_id_list.forEach((z, m) => {
if (x.id == z.id) {
this.cart_id_list.splice(m,1)
this.cart_id_list.splice(m, 1);
}
});
})
});
this.allchecked = false;
this.checkCount-=new_statusnum;
this.checkCount -= new_statusnum;
}
},
SelectAll() {
......@@ -422,11 +435,11 @@ export default {
this.cart_id_list = [];
list.forEach((x) => {
x.checked = true;
x.goods_list.forEach((j)=>{
if(j.new_status==0){
x.goods_list.forEach((j) => {
if (j.new_status == 0) {
j.checked = true;
this.checkCount++;
this.TotalPrice+=j.attrs.price*j.num
this.TotalPrice += j.attrs.price * j.num;
}
//编辑的时候
......@@ -436,44 +449,41 @@ export default {
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)=>{
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;
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)
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){
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;
}
......@@ -498,13 +508,12 @@ export default {
let list = this.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j)=>{
j.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();
......@@ -541,8 +550,21 @@ export default {
},
settlement() {
if (this.checkCount > 0) {
let goods = [];
this.list.forEach((x) => {
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,
......@@ -557,13 +579,15 @@ export default {
attr_group_id: x.attr_group_id,
});
});
goods.push(g);
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