Commit 08cc844b authored by 罗超's avatar 罗超

新增订单确认页面

parent 14c25d3b
...@@ -100,6 +100,7 @@ export default { ...@@ -100,6 +100,7 @@ export default {
<style lang="scss"> <style lang="scss">
@import "uview-ui/index.scss"; @import "uview-ui/index.scss";
swiper{ swiper{
height: unset; height: unset;
} }
......
@font-face {
font-family: 'iconfont';
/* project id 1830471 */
src: url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.eot');
src: url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.eot?#iefix') format('embedded-opentype'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.woff2') format('woff2'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.woff') format('woff'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.ttf') format('truetype'), url('https://at.alicdn.com/t/font_1830471_h2mse3jucma.svg#iconfont') format('svg');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.iconweibiaoti-:before {
content: "\e607";
}
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class="actionsheet" class="actionsheet"
:style="{ 'padding-bottom': bian ? '28px' : '0px' }" :style="{ 'padding-bottom': bian ? '28px' : '0px' }"
> >
<view class="item" @click="setFavorite" style="width:36px;"> <view class="item" style="width:36px;" @click="goCart">
<view style="width: 22px; margin: auto;"> <view style="width: 22px; margin: auto;">
<u-icon name="cart-o" size="44" :color="mc"></u-icon> <u-icon name="cart-o" size="44" :color="mc"></u-icon>
</view> </view>
...@@ -99,9 +99,13 @@ export default { ...@@ -99,9 +99,13 @@ export default {
this.favorStatus = this.favorite; this.favorStatus = this.favorite;
}, },
methods: { methods: {
goCart(){
uni.redirectTo({
url: '/pages/cart/cart'
});
},
setFavorite() { setFavorite() {
let h=this.apiheader() let h=this.apiheader()
console.log(h)
this.request( this.request(
{ {
url: "", url: "",
......
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
skued: { skued: {
type: Object, type: Object,
default: {}, default: {},
} },
}, },
data() { data() {
...@@ -153,14 +153,12 @@ export default { ...@@ -153,14 +153,12 @@ export default {
this.g = this.good; this.g = this.good;
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
this.skuObj=this.skued.id?this.skued:null this.skuObj = this.skued.id ? this.skued : null;
if(this.skuObj){ if (this.skuObj) {
this.goodimage = this.skuObj.pic_url || this.g.cover_pic; this.goodimage = this.skuObj.pic_url || this.g.cover_pic;
this.goodprice = ( this.goodprice = (parseFloat(this.skuObj.price) * 1).toFixed(2);
parseFloat(this.skuObj.price) * 1
).toFixed(2);
this.goodamount = this.skuObj.stock; this.goodamount = this.skuObj.stock;
}else{ } else {
this.goodimage = this.g.cover_pic; this.goodimage = this.g.cover_pic;
this.goodprice = this.g.price_min; this.goodprice = this.g.price_min;
this.goodamount = this.g.goods_stock; this.goodamount = this.g.goods_stock;
...@@ -168,28 +166,62 @@ export default { ...@@ -168,28 +166,62 @@ export default {
this.bian = this.$utils.is_biang; this.bian = this.$utils.is_biang;
this.btn1.background = this.secondary; this.btn1.background = this.secondary;
this.btn2.background = this.mc; this.btn2.background = this.mc;
if(this.optionType==2){ if (this.optionType == 2) {
this.btn1.borderRadius="40px 0 0 40px" this.btn1.borderRadius = "40px 0 0 40px";
this.btn2.borderRadius="0 40px 40px 0" this.btn2.borderRadius = "0 40px 40px 0";
} }
console.log(this.skued) console.log(this.skued);
this.g.attr_groups.forEach((x) => { this.g.attr_groups.forEach((x) => {
if(!this.skuObj){ if (!this.skuObj) {
(x.checkId = 0), (x.checkName = x.attr_group_name); (x.checkId = 0), (x.checkName = x.attr_group_name);
}else{ } else {
let sign=`:${this.skuObj.sign_id}:` let sign = `:${this.skuObj.sign_id}:`;
x.attr_list.forEach(y=>{ x.attr_list.forEach((y) => {
if(sign.indexOf(`:${y.attr_id}:`)!=-1){ if (sign.indexOf(`:${y.attr_id}:`) != -1) {
x.checkId=y.attr_id x.checkId = y.attr_id;
x.checkName=y.attr_name x.checkName = y.attr_name;
} }
}) });
} }
}); });
this.formatDisableSku(); this.formatDisableSku();
this.formatChosenTips(); this.formatChosenTips();
}, },
methods: { methods: {
joinCar() {
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
if (this.skuObj && this.skuObj.id) {
this.request(
{
url: "",
data: {
r: 'api/cart/add',
goods_id: this.g.id,
attr: this.skuObj.id,
num: this.gc == 0 ? 1 : this.gc,
},
header: h,
method: "POST",
},
(res) => {
uni.showToast({
title: "加入购物车成功",
icon: "success",
duration: 2000,
});
this.popupClose();
}
);
} else {
uni.showToast({
title: '请选择商品',
position:"bottom",
icon:"none",
duration: 2000
});
}
},
close() { close() {
this.popupClose(); this.popupClose();
}, },
...@@ -240,7 +272,7 @@ export default { ...@@ -240,7 +272,7 @@ export default {
}); });
if (sign.length == this.g.attr_groups.length - 1) { if (sign.length == this.g.attr_groups.length - 1) {
this.formatDisable(sign) this.formatDisable(sign);
} else if (sign.length == this.g.attr_groups.length) { } else if (sign.length == this.g.attr_groups.length) {
let t = sign.join(":"); let t = sign.join(":");
let len = -1; let len = -1;
...@@ -253,12 +285,12 @@ export default { ...@@ -253,12 +285,12 @@ export default {
this.g.attr_groups[len].checkId = 0; this.g.attr_groups[len].checkId = 0;
this.g.attr_groups[len].checkName = this.g.attr_groups[len].attr_name; this.g.attr_groups[len].checkName = this.g.attr_groups[len].attr_name;
this.formatDisableSku(); this.formatDisableSku();
}else{ } else {
this.formatDisable(sign.splice(sign.length-1,1)) this.formatDisable(sign.splice(sign.length - 1, 1));
} }
} }
}, },
formatDisable(sign){ formatDisable(sign) {
this.notStockGood = []; this.notStockGood = [];
this.g.attr.forEach((x) => { this.g.attr.forEach((x) => {
if (x.stock == 0) { if (x.stock == 0) {
...@@ -298,7 +330,7 @@ export default { ...@@ -298,7 +330,7 @@ export default {
}, },
// 弹窗关闭 // 弹窗关闭
popupClose() { popupClose() {
this.$emit("close",this.skuObj); this.$emit("close", this.skuObj);
this.$emit("input", false); this.$emit("input", false);
}, },
valChange(e) { valChange(e) {
......
<template> <template>
<view class="u-field" :class="{'u-field-border': itemIndex > 0 }"> <view class="u-field" :style="{'padding':padding}" :class="{'u-field-border': itemIndex > 0 }">
<view class="u-field-inner" :class="[type == 'textarea' ? 'u-textarea-inner' : '', 'u-label-postion-' + labelPosition]"> <view class="u-field-inner" :class="[type == 'textarea' ? 'u-textarea-inner' : '', 'u-label-postion-' + labelPosition]">
<view class="u-label" :class="[required ? 'u-required' : '']" :style="{ <view class="u-label" :class="[required ? 'u-required' : '']" :style="{
justifyContent: justifyContent, justifyContent: justifyContent,
...@@ -125,6 +125,10 @@ export default { ...@@ -125,6 +125,10 @@ export default {
type: [String, Boolean], type: [String, Boolean],
default: '' default: ''
}, },
padding:{
type:String,
default:"20px 28px"
},
placeholder: String, placeholder: String,
placeholderStyle: String, placeholderStyle: String,
focus: Boolean, focus: Boolean,
......
...@@ -2,7 +2,15 @@ ...@@ -2,7 +2,15 @@
"easycom": { "easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
}, },
"pages": [ "pages": [{
"path": "pages/order-submit/order-submit"
},
{
"path": "pages/goods/goods"
},
{
"path": "pages/goods/comment-list"
},
{ {
"path": "pages/index/index" "path": "pages/index/index"
}, },
...@@ -15,12 +23,6 @@ ...@@ -15,12 +23,6 @@
{ {
"path": "pages/cats/cats" "path": "pages/cats/cats"
}, },
{
"path": "pages/goods/goods"
},
{ {
"path": "pages/webbox/webbox" "path": "pages/webbox/webbox"
}, },
......
<template> <template>
<div class='cartStyle' v-if="!isloading"> <div class="cartStyle" v-if="!isloading">
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;padding: 0 15rpx;"> <view
<Text class='grid-text'>商品库存有限,请尽快下单</Text> style="
<Text @click='edit' v-if='editType==false' class='grid-text_r'>编辑</Text> display: flex;
<Text @click='edit' v-if='editType==true' class='grid-text_r'>完成</Text> flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 15rpx;
"
>
<Text class="grid-text">商品库存有限,请尽快下单</Text>
<Text @click="edit" v-if="editType == false" class="grid-text_r"
>编辑</Text
>
<Text @click="edit" v-if="editType == true" class="grid-text_r"
>完成</Text
>
</view> </view>
<view style="width: 100%;height: 30rpx;background: #F7F7F7;margin: 20rpx 0;"></view> <view
<view v-if="list.length==0" style="width: 100%;height: 400rpx;display: flex;flex-direction: column;justify-content: center;align-items: center;"> style="width: 100%; height: 30rpx; background: #f7f7f7; margin: 20rpx 0;"
<view style="width: 180rpx;height: 180rpx;border-radius: 50%;background: #DFDFE9;display: flex;align-items: center;justify-content: center;"> ></view>
<image src='../../static/images/icon/Shopping.png' style='width:60rpx ;height: 60rpx;'></image> <view
v-if="list.length == 0"
style="
width: 100%;
height: 400rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
>
<view
style="
width: 180rpx;
height: 180rpx;
border-radius: 50%;
background: #dfdfe9;
display: flex;
align-items: center;
justify-content: center;
"
>
<image
src="../../static/images/icon/Shopping.png"
style="width: 60rpx; height: 60rpx;"
></image>
</view> </view>
<Text style='margin-top: 20rpx;color: #939393;'>购物车还是空的哦</Text> <Text style="margin-top: 20rpx; color: #939393;">购物车还是空的哦</Text>
</view> </view>
<view style="padding: 25rpx;border-bottom: 1rpx solid #E4E4E4;" v-if="list.length>0"> <view
<u-checkbox-group @change='SelectAll'> style="padding: 25rpx; border-bottom: 1rpx solid #e4e4e4;"
<u-checkbox v-model="allchecked" shape="circle" active-color="red">赞羊严选</u-checkbox> v-if="list.length > 0"
>
<u-checkbox-group @change="SelectAll">
<u-checkbox v-model="allchecked" shape="circle" active-color="red"
>赞羊严选</u-checkbox
>
</u-checkbox-group> </u-checkbox-group>
</view> </view>
<view class="cartList" <view
:style="{'margin-bottom':listbottom}" class="cartList"
v-if="list.length>0" :style="{ 'margin-bottom': listbottom }"
v-if="list.length > 0"
>
<view
class="cartList_item"
v-for="(item, index) in list"
:key="index"
:name="item.name"
>
<u-checkbox-group
@change="clickcheckbox(item.checked, item.goods.price, index)"
> >
<view class="cartList_item" <u-checkbox
v-for="(item, index) in list" :key="index" v-model="item.checked"
:name="item.name"> shape="circle"
<u-checkbox-group @change='clickcheckbox(item.checked,item.goods.price,index)'> active-color="red"
<u-checkbox v-model="item.checked" shape="circle" active-color="red"></u-checkbox> ></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<image <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="aspectFit" mode="aspectFit"
style="width: 150rpx; height: 150rpx;margin-left: 30rpx;" style="width: 150rpx; height: 150rpx; margin-left: 30rpx;"
/> />
<view style="display: flex;flex-direction: column;justify-content: space-between;width: 460rpx;height: 150rpx;margin-left: 20rpx;"> <view
<Text style='font-size: 28rpx;width: 460rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;'>{{item.goods.name}}</Text> style="
<view style='width: 460rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;'> display: flex;
<view v-for="(attr, inde2x) in item.attrs.attr" :key="index2" > flex-direction: column;
<Text style='color: #A0A09D;font-size: 24rpx;margin-right: 5rpx;'>{{attr.attr_group_name}}:{{attr.attr_name}}</Text> justify-content: space-between;
width: 460rpx;
height: 150rpx;
margin-left: 20rpx;
"
>
<Text
style="
font-size: 28rpx;
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>{{ item.goods.name }}</Text
>
<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> </view>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;"> <view
<Text style='color: #E35943;font-size:30rpx ;'><Text style='40rpx'>{{item.goods.price}}</Text></Text> style="
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
"
>
<Text style="color: #e35943; font-size: 30rpx;"
><Text style="40rpx">{{ item.goods.price }}</Text></Text
>
<view class="item_input"> <view class="item_input">
<view class="item_input_l" <view
class="item_input_l"
:style="{ :style="{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B', color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}" }"
@click="reduce(index,item.goods.price)">-</view> @click="reduce(index, item.goods.price)"
<input type="number" class="item_input_c" :value="item.num" > >-</view
<view class="item_input_r" style="color: #9B9B9B;" @click="plus(index,item.goods.price)">+</view> >
<input type="number" class="item_input_c" :value="item.num" />
<view
class="item_input_r"
style="color: #9b9b9b;"
@click="plus(index, item.goods.price)"
>+</view
>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="box_bottom" <view class="box_bottom" :style="{ 'margin-bottom': bottommargin }">
:style="{'margin-bottom':bottommargin}" <div style="margin-left: 30rpx;">
<u-checkbox-group @change="SelectAll">
<u-checkbox v-model="allchecked" shape="circle" active-color="red"
>全选</u-checkbox
> >
<div style='margin-left: 30rpx;'>
<u-checkbox-group @change='SelectAll'>
<u-checkbox v-model="allchecked" shape="circle" active-color="red">全选</u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<Text style='color: #ff4544;font-size:30rpx ;' v-if='editType==false'>{{TotalPrice}}</Text> <Text style="color: #ff4544; font-size: 30rpx;" v-if="editType == false"
>{{ TotalPrice }}</Text
>
</div> </div>
<div class='bottom_btn' <div
:style="{'background':TotalPrice>0 ? '#ff4544':'#989898'}" class="bottom_btn"
v-if='editType==false' :style="{ background: TotalPrice > 0 ? '#ff4544' : '#989898' }"
@click='settlement' v-if="editType == false"
@click="settlement"
> >
<Text style='font-size: 28rpx;color: white;' >去结算</Text> <Text style="font-size: 28rpx; color: white;">去结算</Text>
</div> </div>
<u-button v-if='editType==true&& cart_id_list.length ==0' shape="circle" size="medium" class='Deletestyle'>删除</u-button> <u-button
<u-button v-if='editType==true&& cart_id_list.length >0' shape="circle" size="medium" class='Deletestyle' @click='Delete' type="error">删除</u-button> v-if="editType == true && cart_id_list.length == 0"
shape="circle"
size="medium"
class="Deletestyle"
>删除</u-button
>
<u-button
v-if="editType == true && cart_id_list.length > 0"
shape="circle"
size="medium"
class="Deletestyle"
@click="Delete"
type="error"
>删除</u-button
>
</view> </view>
<tabbars></tabbars> <tabbars></tabbars>
</div> </div>
</template> </template>
<script> <script>
import tabbars from "@/components/tabbar/index"; import tabbars from "@/components/tabbar/index";
export default { export default {
data(){ data() {
return{ return {
isloading: true, isloading: true,
pageTitle: "购物车", pageTitle: "购物车",
navHeight: 0, navHeight: 0,
contentHeight:0, contentHeight: 0,
cstyle:{}, cstyle: {},
allchecked:false, allchecked: false,
TotalPrice:0,//总价格 TotalPrice: 0, //总价格
bottommargin:0, bottommargin: 0,
listbottom:0, listbottom: 0,
editType:false, editType: false,
list:[], list: [],
cart_id_list:[], cart_id_list: [],
};
}
}, },
created(){ created() {},
components: {
},
components:{
tabbars, tabbars,
}, },
onLoad() { onLoad() {
...@@ -128,8 +234,8 @@ ...@@ -128,8 +234,8 @@
mounted() { mounted() {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
let c = this.$uiConfig.is_bang ? 80 : 52; let c = this.$uiConfig.is_bang ? 80 : 52;
this.bottommargin = (c-2)+'px'; this.bottommargin = c - 2 + "px";
this.listbottom = (c-2+50)+'px'; this.listbottom = c - 2 + 50 + "px";
this.contentHeight = this.$utils.calcContentHeight(c); this.contentHeight = this.$utils.calcContentHeight(c);
let u = "/" + currentPages[currentPages.length - 1].route; let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata") let pages = wx.getStorageSync("basedata")
...@@ -142,7 +248,7 @@ ...@@ -142,7 +248,7 @@
}); });
this.init(); this.init();
}, },
methods:{ methods: {
goHome() { goHome() {
uni.redirectTo({ url: "/pages/index/main" }); uni.redirectTo({ url: "/pages/index/main" });
}, },
...@@ -152,217 +258,199 @@ ...@@ -152,217 +258,199 @@
this.request( this.request(
{ {
url: "", url: "",
header:{ header: {
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ', "X-Access-Token": "Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ",
'X-App-Platform': 'wxapp', "X-App-Platform": "wxapp",
'X-App-Version':'4.2.47', "X-App-Version": "4.2.47",
'X-Form-Id-List': JSON.stringify([]), "X-Form-Id-List": JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest', "X-Requested-With": "XMLHttpRequest",
'X-User-Id': 21269 "X-User-Id": 21269,
}, },
data: { data: {
r: "api/cart/list", r: "api/cart/list",
}, },
}, },
(res) => { (res) => {
uni.hideNavigationBarLoading() uni.hideNavigationBarLoading();
this.isloading = false; this.isloading = false;
if(res.data.list.length>0){ if (res.data.list.length > 0) {
let goods_list = res.data.list[0].goods_list; let goods_list = res.data.list[0].goods_list;
goods_list.forEach((x) => { goods_list.forEach((x) => {
x.checked = false x.checked = false;
}); });
this.list =goods_list; this.list = goods_list;
console.log(this.list) console.log(this.list);
}else{ } else {
this.list=[] this.list = [];
} }
} }
); );
}, },
clickcheckbox(checked,price,index){ clickcheckbox(checked, price, index) {
if (checked == true) {
if(checked==true){ this.TotalPrice += price * this.list[index].num;
this.TotalPrice += price*this.list[index].num;
let all = true; let all = true;
this.list.forEach((x)=>{ this.list.forEach((x) => {
if(x.checked==false){ if (x.checked == false) {
all=false all = false;
} }
}) });
if(all==true){ if (all == true) {
this.allchecked = true this.allchecked = true;
} }
if(this.editType==true){ if (this.editType == true) {
let obj = { let obj = {
'mch_id':0, mch_id: 0,
'id':this.list[index].id id: this.list[index].id,
} };
this.cart_id_list.push(obj) this.cart_id_list.push(obj);
} }
}else{ } else {
this.TotalPrice -= price*this.list[index].num this.TotalPrice -= price * this.list[index].num;
this.allchecked = false; this.allchecked = false;
if(this.editType==true){ if (this.editType == true) {
this.cart_id_list.forEach((x)=>{ this.cart_id_list.forEach((x) => {
if(x.id==this.list[index].id){ if (x.id == this.list[index].id) {
this.cart_id_list.splice(x,1) this.cart_id_list.splice(x, 1);
} }
}) });
} }
} }
}, },
SelectAll(){ SelectAll() {
if (this.allchecked == true) {
if(this.allchecked==true){ this.TotalPrice = 0;
this.TotalPrice= 0; this.cart_id_list = [];
this.cart_id_list=[]; this.list.forEach((x) => {
this.list.forEach((x)=>{ x.checked = true;
x.checked=true; this.TotalPrice += x.goods.price * x.num;
this.TotalPrice += x.goods.price*x.num; if (this.editType == true) {
if(this.editType==true){
this.cart_id_list.push({ this.cart_id_list.push({
'mch_id':0, mch_id: 0,
'id':x.id id: x.id,
}) });
} }
}) });
} else {
this.list.forEach((x) => {
}else { x.checked = false;
this.list.forEach((x)=>{ this.TotalPrice = 0;
x.checked=false; if (this.editType == true) {
this.TotalPrice =0; this.cart_id_list = [];
if(this.editType==true){
this.cart_id_list=[]
} }
}) });
} }
}, },
reduce(index,price){//减 reduce(index, price) {
if(this.list[index].num>1){ //减
this.list[index].num = this.list[index].num -1; if (this.list[index].num > 1) {
if(this.list[index].checked==true){ this.list[index].num = this.list[index].num - 1;
this.TotalPrice -= price*1 if (this.list[index].checked == true) {
this.TotalPrice -= price * 1;
} }
} }
}, },
plus(index,price){//加 plus(index, price) {
this.list[index].num = this.list[index].num +1; //加
if(this.list[index].checked==true){ this.list[index].num = this.list[index].num + 1;
this.TotalPrice += price*1 if (this.list[index].checked == true) {
this.TotalPrice += price * 1;
} }
}, },
edit(){ edit() {
this.editType=!this.editType; this.editType = !this.editType;
this.allchecked =false; this.allchecked = false;
this.TotalPrice= 0 this.TotalPrice = 0;
this.list.forEach((x)=>{ this.list.forEach((x) => {
x.checked=false x.checked = false;
}) });
}, },
Delete(){ Delete() {
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
this.request( this.request(
{ {
url: "", url: "",
method:"POST", method: "POST",
header:{ header: {
'content-type': 'application/x-www-form-urlencoded', "content-type": "application/x-www-form-urlencoded",
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ', "X-Access-Token": "Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ",
'X-App-Platform': 'wxapp', "X-App-Platform": "wxapp",
'X-App-Version':'4.2.47', "X-App-Version": "4.2.47",
'X-Form-Id-List':JSON.stringify([{"value":"873015dc76a242cc8c7ae1c25cdbdf4c","type":0,"remains":1,"expires_at":"2020-05-25 19:03:25"}]), "X-Form-Id-List": JSON.stringify([
{
'X-Requested-With': 'XMLHttpRequest', value: "873015dc76a242cc8c7ae1c25cdbdf4c",
'X-User-Id': 21269, type: 0,
remains: 1,
expires_at: "2020-05-25 19:03:25",
},
]),
"X-Requested-With": "XMLHttpRequest",
"X-User-Id": 21269,
}, },
data: { data: {
r: "api/cart/delete", r: "api/cart/delete",
cart_id_list:JSON.stringify(this.cart_id_list) , cart_id_list: JSON.stringify(this.cart_id_list),
}, },
}, },
(res) => { (res) => {
this.init() this.init();
this.TotalPrice= 0 this.TotalPrice = 0;
this.editType=false; this.editType = false;
this.allchecked =false; this.allchecked = false;
uni.hideNavigationBarLoading() uni.hideNavigationBarLoading();
} }
); );
}, },
settlement(){ settlement() {},
},
} };
}
}
</script> </script>
<style> <style>
.cartStyle{ .cartStyle {
height: 100%; height: 100%;
position: relative; position: relative;
} }
.cartStyle .grid-text { .cartStyle .grid-text {
font-size: 24rpx; font-size: 24rpx;
margin-top: 4rpx; margin-top: 4rpx;
color: #939393; color: #939393;
} }
.cartStyle .grid-text_r{ .cartStyle .grid-text_r {
margin-top: 4rpx; margin-top: 4rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
.cartStyle .cartList{ .cartStyle .cartList {
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
overflow-y: hidden; overflow-y: hidden;
} }
.cartStyle .cartList .cartList_item{ .cartStyle .cartList .cartList_item {
width: 100%; width: 100%;
padding:40rpx 30rpx; padding: 40rpx 30rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
border-bottom: 1rpx solid #E4E4E4; border-bottom: 1rpx solid #e4e4e4;
} }
.cartList .cartList_item .item_input{ .cartList .cartList_item .item_input {
width: 200rpx; width: 200rpx;
height: 60rpx; height: 60rpx;
background: #F7F7F7; background: #f7f7f7;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.cartList .item_input .item_input_l,.item_input_r{ .cartList .item_input .item_input_l,
.item_input_r {
width: 50rpx; width: 50rpx;
height: 60rpx; height: 60rpx;
font-size: 28rpx; font-size: 28rpx;
...@@ -370,35 +458,33 @@ ...@@ -370,35 +458,33 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.cartStyle .item_input .item_input_c{ .cartStyle .item_input .item_input_c {
text-align: center; text-align: center;
width: 50rpx; width: 50rpx;
height: 60rpx; height: 60rpx;
} }
.cartStyle .box_bottom{ .cartStyle .box_bottom {
width: 100%; width: 100%;
height: 50px; height: 50px;
position: fixed; position: fixed;
background: #FFF; background: #fff;
left: 0; left: 0;
bottom: 0; bottom: 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
border-top: 1rpx solid #E4E4E4; border-top: 1rpx solid #e4e4e4;
z-index: 999; z-index: 999;
} }
.cartStyle .bottom_btn{ .cartStyle .bottom_btn {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 250rpx; width: 250rpx;
height: 50px; height: 50px;
} }
.cartStyle .Deletestyle{ .cartStyle .Deletestyle {
margin-right: 40rpx; margin-right: 40rpx;
} }
</style> </style>
<template> <template>
<div v-if="!isloading"> <div v-if="!isloading">
<search :styleStr="searchStyle"></search> <search :styleStr="searchStyle"></search>
<div :style="{'height':contentHeight+'px'}" style="voerflow:hidden;overflow-y:auto;"> <div
<style1 v-if="cstyle.cat_style==1" :d="types" :h='(navHeight+54)'></style1> :style="{ height: contentHeight + 'px' }"
<style2 v-if="cstyle.cat_style==2" :d="types" :h='(navHeight+54)'></style2> style="voerflow: hidden; overflow-y: auto;"
<style3 v-if="cstyle.cat_style==3" :d="types" :h='(navHeight+54)'></style3> >
<style4 v-if="cstyle.cat_style==5" :d="types" :h='(navHeight+54)'></style4> <style1
<style5 v-if="cstyle.cat_style==6" :d="types" :h='(navHeight+54)'></style5> v-if="cstyle.cat_style == 1"
<style6 v-if="cstyle.cat_style==4" :d="types" :h='(navHeight+54)'></style6> :d="types"
<style7 v-if="cstyle.cat_style==7" :d="types" :h='(navHeight+54)'></style7> :h="(navHeight+54)"
<style8 v-if="cstyle.cat_style==8" :d="types" :h='(navHeight+54)'></style8> ></style1>
<style9 v-if="cstyle.cat_style==9" :d="types" :h='(navHeight+54)'></style9> <style2
<style10 v-if="cstyle.cat_style==10" :d="types" :h='(navHeight+54)'></style10> v-if="cstyle.cat_style == 2"
<style11 v-if="cstyle.cat_style==11" :d="types" :h='(navHeight+54)'></style11> :d="types"
:h="(navHeight+54)"
></style2>
<style3
v-if="cstyle.cat_style == 3"
:d="types"
:h="(navHeight+54)"
></style3>
<style4
v-if="cstyle.cat_style == 5"
:d="types"
:h="(navHeight+54)"
></style4>
<style5
v-if="cstyle.cat_style == 6"
:d="types"
:h="(navHeight+54)"
></style5>
<style6
v-if="cstyle.cat_style == 4"
:d="types"
:h="(navHeight+54)"
></style6>
<style7
v-if="cstyle.cat_style == 7"
:d="types"
:h="(navHeight+54)"
></style7>
<style8
v-if="cstyle.cat_style == 8"
:d="types"
:h="(navHeight+54)"
></style8>
<style9
v-if="cstyle.cat_style == 9"
:d="types"
:h="(navHeight+54)"
></style9>
<style10
v-if="cstyle.cat_style == 10"
:d="types"
:h="(navHeight+54)"
></style10>
<style11
v-if="cstyle.cat_style == 11"
:d="types"
:h="(navHeight+54)"
></style11>
</div> </div>
<tabbars></tabbars> <tabbars></tabbars>
</div> </div>
...@@ -48,8 +95,8 @@ export default { ...@@ -48,8 +95,8 @@ export default {
}, },
types: [], types: [],
changeHeight: 0, changeHeight: 0,
contentHeight:0, contentHeight: 0,
cstyle:{} cstyle: {},
}; };
}, },
components: { components: {
...@@ -65,7 +112,7 @@ export default { ...@@ -65,7 +112,7 @@ export default {
style8, style8,
style9, style9,
style10, style10,
style11 style11,
}, },
onLoad() { onLoad() {
this.navHeight = this.$navHeight - 2; this.navHeight = this.$navHeight - 2;
...@@ -85,7 +132,7 @@ export default { ...@@ -85,7 +132,7 @@ export default {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
let c = this.$uiConfig.is_bang ? 80 : 52; let c = this.$uiConfig.is_bang ? 80 : 52;
this.contentHeight = this.$utils.calcContentHeight(c); this.contentHeight = this.$utils.calcContentHeight(c);
console.log(this.contentHeight) console.log(this.contentHeight);
let u = "/" + currentPages[currentPages.length - 1].route; let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata") let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title ? wx.getStorageSync("basedata").bar_title
...@@ -95,6 +142,9 @@ export default { ...@@ -95,6 +142,9 @@ export default {
this.pageTitle = x.new_name ? x.new_name : x.name; this.pageTitle = x.new_name ? x.new_name : x.name;
} }
}); });
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.init(); this.init();
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
}, },
...@@ -121,7 +171,7 @@ export default { ...@@ -121,7 +171,7 @@ export default {
} }
}); });
this.isloading = false; this.isloading = false;
uni.hideNavigationBarLoading() uni.hideNavigationBarLoading();
} }
); );
}, },
......
<template>
<view class="comment-list" v-if="commentCount && commentCount.length > 0">
<u-tabs
name="name"
:list="commentCount"
:is-scroll="false"
:active-color="mc"
:current="current"
@change="tabsChange"
></u-tabs>
<view class="comment-details" style="heigh: calc(100% - 40px);" v-if="comments.length>0">
<scroll-view
:scroll-y="true"
@scrolltolower="lower"
:enable-back-to-top="true"
:enable-flex="true"
style="height: 100%; padding-bottom: 0px;"
>
<view class="comment">
<view class="content" v-for="(x, i) in comments" :key="i">
<view class="u-box">
<view class="user">
<u-avatar :src="x.avatar" :size="50"></u-avatar>
<text style="margin-left: 10px;">{{ x.nickname }}</text>
</view>
<view class="timer">{{ x.time }}</view>
</view>
<view class="ucontent">{{ x.content }}</view>
<view class="imagebox" v-for="(y, yi) in x.formatPic" :key="yi">
<view
class="item"
v-for="(z, zi) in y"
:key="zi"
:style="{ 'max-width': yi == 0 ? 'unset' : '31.9%' }"
>
<view class="scal" @click="previewImage(z,x.pic_url)">
<image :src="z" mode="aspectFill" class="image" />
<view
class="more"
v-if="
x.pic_url.length > 4 &&
(yi + 1) * (zi + 1) == x.pic_url.length
"
>
<view style="width: 100%;">
<view class="big">5图</view>\n\r
<view class="small">查看全部</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#fff"
/>
</scroll-view>
</view>
<u-empty
text="没有找到相关评论"
mode="news"
v-else
></u-empty>
</view>
</template>
<script>
export default {
data() {
return {
current: 0, // tabs组件的current值,表示当前活动的tab选项
page: 1,
pageCount: 0,
id: 0,
comments: [],
commentCount: [],
loading: false,
mc: "",
pageTitle: "全部评论",
status: "loadmore",
isover: false,
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多评论了",
},
};
},
onLoad(option) {
uni.showNavigationBarLoading();
this.id = option.id || 46942;
this.mc = this.$uiConfig.mainColor;
this.init();
this.initPage();
},
methods: {
previewImage(i,images) {
uni.previewImage({
urls: images,
current: i,
longPressActions: {
itemList: ["发送给朋友", "保存图片", "收藏"],
success: function (data) {
console.log(
"选中了第" +
(data.tapIndex + 1) +
"个按钮,第" +
(data.index + 1) +
"张图片"
);
},
fail: function (err) {
console.log(err.errMsg);
},
},
});
},
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
init() {
this.isover = false;
this.loading = true;
this.showLoading = this.page != 1;
this.request(
{
url: "",
data: {
r: "api/goods/comments-list",
goods_id: this.id,
page: this.page,
status: this.commentCount.length>0?this.commentCount[this.current].index:0,
},
},
(res) => {
this.comments = res.data.comments;
this.comments.forEach((x) => {
x.formatPic = this.formatPic(x.pic_url);
});
//TODO 缺陷待处理
this.commentCount = res.data.comment_count;
this.pageCount = Math.ceil(
parseFloat(this.commentCount[0].count) / 10.0
);
this.commentCount.forEach((x) => {
x.name = x.name + "(" + x.count + ")";
});
this.showLoading = true;
if (this.pageCount == 1) {
this.isover = true;
this.status = "nomore";
} else {
this.status = "loadmore";
}
this.loading = false;
uni.hideNavigationBarLoading();
}
);
},
formatPic(pics) {
let arr = [];
let temp = [];
pics.forEach((x, i) => {
temp.push(x);
if (i == 2) {
arr.push(temp);
temp = [];
} else if (i == 5) {
arr.push(temp);
temp = [];
} else if (i == pics.length - 1) {
arr.push(temp);
}
});
return arr;
},
tabsChange(index) {
this.current = index;
this.init()
this.page=1
},
lower(e) {
if (this.page < this.pageCount) {
if (!this.loading) {
this.status = "loading";
this.page++;
this.init();
}
} else {
this.isover = true;
this.status = "nomore";
}
},
},
};
</script>
<style>
.comment-list {
width: 100vw;
height: 100vh;
overflow: hidden;
}
.comment-list .comment-details {
height: calc(100% - 40px);
padding: 10px 0 0 0;
}
.comment-list .comment-details .comment {
/* margin: 10px 0;
background: #fff;
padding: 10px; */
}
.comment-list .comment-details .comment .chead {
padding-bottom: 10px;
border-bottom: 1px solid #f1f1f1;
}
.comment-list .comment-details .comment .content {
display: flex;
flex-direction: column;
margin-bottom: 10px;
padding: 10px;
background: #fff;
}
.comment-list .comment-details .comment .content .u-box {
display: flex;
margin-bottom: 10px;
align-items: center;
}
.comment-list .comment-details .comment .content .u-box .user {
flex: 1;
font-size: 12px;
color: gray;
align-items: center;
display: flex;
}
.comment-list .comment-details .comment .content .u-box .timer {
font-size: 12px;
color: gray;
text-align: right;
flex: 1;
}
.comment-list .comment-details .comment .content .u-box .ucontent {
font-size: 12px;
color: #000;
margin-top: 10px;
}
.comment-list .comment-details .comment .content .imagebox {
display: flex;
/* justify-content:space-evenly; */
margin-right: -5px;
margin-bottom: -5px;
margin-top: 5px;
/* flex-wrap: wrap; */
}
.comment-list .comment-details .comment .content .imagebox .item {
flex: 1;
max-width: 70vw;
margin-right: 5px;
margin-bottom: 5px;
min-width: 31.9%;
}
.comment-list .comment-details .comment .content .imagebox .item .scal {
width: 100%;
padding-bottom: 100%;
height: 0;
position: relative;
overflow: hidden;
}
.comment-list .comment-details .comment .content .imagebox .item .scal .image {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 1;
height: 100%;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item:first-child
.scal {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item:last-child
.scal {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.comment-list .comment-details .comment .content .imagebox .item .scal .more {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 2;
height: 100%;
background: rgba(0, 0, 0, 0.5);
color: #fff;
display: flex;
align-items: center;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item
.scal
.more
.big {
font-size: 18px;
font-weight: 500;
text-align: center;
margin-bottom: 5px;
}
.comment-list
.comment-details
.comment
.content
.imagebox
.item
.scal
.more
.small {
font-size: 14px;
text-align: center;
}
</style>
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
:show-split="false" :show-split="false"
:title="`商品评价(${comments.comments.length})`" :title="`商品评价(${comments.comments.length})`"
sub-title="查看更多" sub-title="查看更多"
@click="clickCommentHandler"
font-size="24" font-size="24"
></u-section> ></u-section>
</view> </view>
...@@ -225,6 +226,7 @@ export default { ...@@ -225,6 +226,7 @@ export default {
ot: 0, ot: 0,
currentSku: {}, currentSku: {},
isExsitGoods: true, isExsitGoods: true,
pageTitle:"商品详情"
}; };
}, },
components: { components: {
...@@ -234,12 +236,33 @@ export default { ...@@ -234,12 +236,33 @@ export default {
auth, auth,
}, },
onLoad(option) { onLoad(option) {
this.id = option.id ? option.id : 59512; //40887 59512 this.id = option.id ? option.id : 46942; //40887 59512 46942
this.init(); this.init();
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
this.initPage()
}, },
methods: { methods: {
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
clickCommentHandler(){
uni.navigateTo({
url: '/pages/goods/comment-list?id='+this.id
});
},
init() { init() {
this.loading = true; this.loading = true;
this.request( this.request(
......
<template>
<view class="ordersubmit">
<view class="add-box">
<view class="add-info">
<view class="address">{{
address.province + address.city + address.district
}}</view>
<view class="area">{{ address.detail }}</view>
<view class="address">
<text style="margin-right: 10px;">{{ address.name }}</text>
<text>{{ address.mobile }}</text>
</view>
</view>
<view class="arrow">
<u-icon name="arrow" size="32" color="#444"></u-icon>
</view>
</view>
<view class="pay">
<view>支付方式</view>
<view style="text-align: right;">在线支付</view>
</view>
<view class="goods" v-for="(x, i) in mchs" :key="i">
<view class="store">
<u-icon name="shop-o" size="30" color="#232323"></u-icon>
<text style="margin-left: 10px;">{{ x.mch.name }}</text>
</view>
<view v-if="x.goods_list.length == 1" class="store-list">
<view class="goodbox" v-for="(y, yi) in x.goods_list" :key="yi">
<image :src="y.cover_pic" mode="aspectFill" class="image" />
<view class="goodinfo">
<view class="name">{{ y.name }}</view>
<view class="attr">已选择 {{ y.attrStr }}</view>
<view class="price">
<view class="left" :style="{ color: mc }">
<text class="small"></text>
<text>{{ y.goods_attr.price.split(".")[0] }}</text>
<text class="small"
>.{{ y.goods_attr.price.split(".")[1] || "00" }}</text
>
</view>
<view class="right">x{{ y.num }}</view>
</view>
</view>
</view>
<view class="peisong">
<view>配送</view>
<view>快递配送</view>
</view>
<view class="liuyan">
<u-field
padding="0px"
label-width="80"
v-model="mobile"
label="留言"
placeholder="建议留言前先与客服沟通确认"
></u-field>
</view>
</view>
</view>
<view class="discountbox">
<view class="filed">
<view class="left">优惠券</view>
<view class="right">
<text class="content">选择优惠券</text>
<u-icon name="ellipsis" size="36"></u-icon>
</view>
</view>
<view class="filed" v-if="integral.can_use">
<view class="left">积分抵扣</view>
<view class="right">
<text class="content" :style="{ color: secondary }">{{
`使用${integral.use_num}积分抵扣${integral.deduction_price}元`
}}</text>
<u-checkbox-group>
<u-checkbox
v-model="userInt"
:active-color="mc"
@change="changeUseInt"
:icon-size="28"
shape="circle"
></u-checkbox>
</u-checkbox-group>
</view>
</view>
<!-- <view class="filed">
<view class="left">积分赠送</view>
<view class="right">
<text class="content">100积分</text>
<u-icon name="ellipsis" size="36"></u-icon>
</view>
</view> -->
</view>
<view class="discountbox">
<view class="filed">
<view class="left">商品金额</view>
<view class="right">
<text class="price">{{ goodPrice.toFixed(2) }}</text>
</view>
</view>
<view class="filed">
<view class="left">运费</view>
<view class="right">
<text class="price" :style="{ color: mc }"
>+{{ expressPrice.toFixed(2) }}</text
>
</view>
</view>
<view class="filed">
<view class="left">优惠</view>
<view class="right">
<text class="price" :style="{ color: mc }"
>-{{ couponPrice.toFixed(2) }}</text
>
</view>
</view>
</view>
<view class="btton-box">
<view class="left" :style="{ color: mc }">
<text></text>
<text class="bold">{{ ds.total_price.split(".")[0] }}</text>
<text>.{{ ds.total_price.split(".")[1] || "00" }}</text>
</view>
<view class="right">
<u-button
size="80"
:ripple="true"
shape="circle"
:custom-style="{
backgroundColor: mc,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
}"
>提交订单</u-button
>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
formData: {
list: [
{
mch_id: 0,
goods_list: [],
distance: 0,
remark: "",
order_form: [],
use_integral: 0,
user_coupon_id: 0,
},
],
address_id: 0,
},
pageTitle: "填写订单",
address: {},
mchs: [],
mc: "",
ds: {},
expressPrice: 0.0,
goodPrice: 0.0,
couponPrice: 0.0,
integral: {
can_use: false,
use: false,
use_num: 0,
deduction_price: 0,
},
secondary: "",
userInt: false,
};
},
onLoad(option) {
if (option.goods) {
this.formData.list[0].goods_list = JSON.parse(
decodeURIComponent(option.goods)
);
} else {
this.formData.list[0].goods_list = [
{
id: 40887,
attr: [
{
attr_id: 1,
attr_group_id: 1,
},
{
attr_id: 4,
attr_group_id: 2,
},
],
num: 1,
cat_id: 0,
goods_attr_id: 224815,
cart_id: 0,
},
];
}
this.initPage();
this.init();
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
},
methods: {
changeUseInt(e) {
this.userInt=e.value
if(this.userInt){
this.couponPrice+=parseFloat(this.integral.deduction_price)
this.ds.total_price=(parseFloat(this.ds.total_price)-parseFloat(this.integral.deduction_price)).toFixed(2)
}else{
this.couponPrice-=parseFloat(this.integral.deduction_price)
this.ds.total_price=(parseFloat(this.ds.total_price)+parseFloat(this.integral.deduction_price)).toFixed(2)
}
},
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
init() {
let h = this.apiheader();
h["content-type"] = "application/x-www-form-urlencoded";
this.request(
{
url: "",
data: {
r: "api/order/preview",
form_data: JSON.stringify(this.formData),
},
header: h,
method: "POST",
},
(res) => {
this.address = res.data.address;
this.mchs = res.data.mch_list;
this.ds = res.data;
this.formatPrice();
this.formatAttr();
}
);
},
formatPrice() {
this.mchs.forEach((x) => {
this.goodPrice += parseFloat(x.total_goods_price);
this.expressPrice += parseFloat(x.express_price);
this.couponPrice += parseFloat(x.coupon.coupon_discount || 0.0);
if (x.integral.can_use) {
this.integral.can_use = true;
this.integral.use = false;
this.integral.use_num += x.integral.use_num;
this.integral.deduction_price += parseFloat(
x.integral.deduction_price
);
}
});
},
formatAttr() {
this.mchs.forEach((x) => {
x.goods_list.forEach((y) => {
let attrStr = "";
y.attr_list.forEach((z, i) => {
if (i > 0) {
attrStr += " ";
}
attrStr += z.attr_group_name + " " + z.attr_name;
});
y.attrStr = attrStr;
});
});
},
},
};
</script>
<style>
@font-face {
font-family: "oswald";
src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf");
}
.ordersubmit {
height: 100vh;
padding: 0 5px;
background: #f6f6f6;
padding-bottom: 40px;
overflow-y: auto;
}
.ordersubmit .add-box {
padding: 10px;
background: #fff;
display: flex;
align-items: center;
position: relative;
border-radius: 10px;
overflow: hidden;
margin-bottom: 12px;
}
.ordersubmit .add-box .arrow {
width: 16px;
height: 16px;
}
.ordersubmit .add-box .add-info {
width: 1px;
flex: 1;
min-height: 60px;
display: block;
padding: 10px 0;
}
.ordersubmit .add-box .add-info .address {
font-size: 13px;
color: #333;
margin-bottom: 5px;
}
.ordersubmit .add-box .add-info .area {
font-size: 18px;
color: #000;
margin-bottom: 5px;
font-weight: 600;
}
.ordersubmit .add-box::before {
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 2px;
background: repeating-linear-gradient(
-45deg,
#ff6c6c 0,
#ff6c6c 20%,
transparent 0,
transparent 25%,
#1989fa 0,
#1989fa 45%,
transparent 0,
transparent 50%
);
background-size: 80px;
content: "";
}
.ordersubmit .pay {
margin-bottom: 12px;
background: #fff;
border-radius: 10px;
padding: 10px;
align-items: center;
height: 50px;
color: #232323;
display: flex;
}
.ordersubmit .pay view {
flex: 1;
}
.ordersubmit .goods {
padding: 20px 10px;
margin-bottom: 12px;
background: #fff;
border-radius: 10px;
}
.ordersubmit .goods .store {
color: #000;
margin-bottom: 20px;
display: flex;
}
.ordersubmit .goodbox {
margin-bottom: 20px;
display: flex;
}
.ordersubmit .goodbox .image {
width: 200rpx;
height: 200rpx;
border-radius: 5px;
margin-right: 10px;
}
.ordersubmit .goodbox .goodinfo {
width: 1px;
flex: 1;
}
.ordersubmit .goodbox .goodinfo .name {
height: 16px;
font-size: 14px;
color: #232323;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 15px;
}
.ordersubmit .goodbox .goodinfo .attr {
height: 14px;
font-size: 12px;
color: #999;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 12px;
}
.ordersubmit .goodbox .goodinfo .price {
display: flex;
align-items: center;
}
.ordersubmit .goodbox .goodinfo .price .left {
font-size: 18px;
font-family: "oswald";
width: 1px;
flex: 1;
}
.ordersubmit .goodbox .goodinfo .price .left .small {
font-size: 13px;
}
.ordersubmit .goodbox .goodinfo .price .right {
color: #444;
font-size: 13px;
}
.ordersubmit .store-list .peisong {
margin-bottom: 20px;
display: flex;
align-items: center;
color: #333;
}
.ordersubmit .store-list .peisong view {
flex: 1;
}
.ordersubmit .store-list .peisong view:last-child {
text-align: right;
}
.ordersubmit .discountbox {
padding: 20px 0;
margin-bottom: 20px;
background: #fff;
border-radius: 10px;
display: block;
}
.ordersubmit .filed {
display: flex;
align-items: flex-start;
margin-bottom: 20px;
padding: 0 10px;
}
.ordersubmit .filed:last-child {
margin-bottom: 0;
}
.ordersubmit .filed .left,
.ordersubmit .filed .right {
flex: 1;
color: #232323;
}
.ordersubmit .filed .left {
width: 120px;
}
.ordersubmit .filed .right {
text-align: right;
display: flex;
}
.ordersubmit .filed .right .icon {
width: 18px;
height: 18px;
}
.ordersubmit .filed .right .content {
flex: 1;
text-align: right;
margin-right: 5px;
}
.ordersubmit .filed .right .price {
font-size: 14px;
flex: 1;
text-align: right;
font-family: "oswald";
}
.ordersubmit .btton-box {
height: 50px;
display: flex;
padding: 5px 10px;
border-top: 1px solid #f5f5f5;
position: fixed;
bottom: 0;
left: 0;
right: 0;
align-items: center;
background: #fff;
}
.ordersubmit .btton-box .left {
font-size: 16px;
flex: 1;
font-family: "oswald";
}
.ordersubmit .btton-box .left .bold {
font-size: 24px;
}
.ordersubmit .btton-box .right {
width: 120px;
}
</style>
...@@ -5,7 +5,7 @@ export default { ...@@ -5,7 +5,7 @@ export default {
Vue.prototype.request = function(param, success, failed) { Vue.prototype.request = function(param, success, failed) {
//网络请求 //网络请求
uni.request({ uni.request({
url: this.host + "&r="+ param.data.r, url: this.host + "&r=" + param.data.r,
method: param.method || "GET", method: param.method || "GET",
header: param.header || { header: param.header || {
'content-type': "application/json" 'content-type': "application/json"
...@@ -38,9 +38,9 @@ export default { ...@@ -38,9 +38,9 @@ export default {
'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr', 'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp', 'X-App-Platform': 'wxapp',
'X-App-Version': '4.2.47', 'X-App-Version': '4.2.47',
'X-Form-Id-List': [], 'X-Form-Id-List': '[]',
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 19992, 'X-User-Id': '19992',
'content-type': "application/json" 'content-type': "application/json"
} }
} }
......
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