Commit 3c8dbf69 authored by fwz's avatar fwz

商城购买商品、首页领取挪车码

parent 42e01740
...@@ -9,13 +9,14 @@ ...@@ -9,13 +9,14 @@
<div class="address" v-if="addressShow"> <div class="address" v-if="addressShow">
<div class="address__left"> <div class="address__left">
<div class="right__title" @click="geMap"> <div class="right__title" @click="geMap">
北京市朝阳区李家董镇太阳宫社区大唐公寓 2号楼3单元303 {{addressInfo.address}}&emsp;{{addressInfo.detailInfo}}
</div> </div>
<div class="right__phone"> <div class="right__phone">
<span>默认</span> <span>我是收货人</span><span>19963353323</span> <span>{{addressInfo.userName}}</span> <span>{{addressInfo.telNumber}}</span>
<span v-if="addressInfo.defaultFlag">默认</span>
</div> </div>
</div> </div>
<div class="address__right"> <div class="address__right" @click="goAddress">
<image src="@/static/index/right.png" /> <image src="@/static/index/right.png" />
</div> </div>
<u-gap bgColor="transparent" height="15"></u-gap> <u-gap bgColor="transparent" height="15"></u-gap>
...@@ -116,7 +117,13 @@ export default { ...@@ -116,7 +117,13 @@ export default {
price2: '19.99', price2: '19.99',
img: require('@/static/index/get-car-code1.png') img: require('@/static/index/get-car-code1.png')
} }
] ],
//收货地址列表
addressList: [],
//选择收货地址id
addressId: '',
//选择的收货地址
addressInfo: {},
} }
}, },
methods: { methods: {
...@@ -130,14 +137,95 @@ export default { ...@@ -130,14 +137,95 @@ export default {
}); });
}, },
pay() { pay() {
this.show = true this.createOrder = {
addressId: this.addressId,
commodityList: [{
id: this.id,
nums: 1,
}],
}
let that = this
let opts = { url: '/app/mall/create/order', method: 'post' };
this.http.httpTokenRequest(opts, this.createOrder).then(res => {
if (res.data.code == 200) {
let orderIds = res.data.data
that.orderSubmit = {
appId: 6,
ids: orderIds,
channelCode: 'wx_lite',
}
let opts = { url: '/app/pay/order/submit/more', method: 'post' }
this.http.httpTokenRequest(opts, that.orderSubmit).then(res => {
if (res.data.code == 200) {
let paymentData = res.data.data.invokeResponse;
uni.requestPayment({
provider: 'wxpay', // 服务提提供商
timeStamp: paymentData.timeStamp,
nonceStr: paymentData.nonceStr,
package: paymentData.packageValue,
signType: paymentData.signType,
paySign: paymentData.paySign,
success: function (res) {
uni.navigateTo({
url: '/pagesC/pages/shop/payOk'
})
},
fail: function (err) {
console.log('支付失败',err);
},
});
} else {
}
})
}
})
}, },
add(){ add(){
this.nums++ this.nums++
}, },
addAddress() { addAddress() {
this.addressShow = !this.addressShow uni.navigateTo({
url: '/pagesD/pages/personal/addAddress'
});
},
getAddressList(){
let opts = { url: '/app/user/address/list', method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.addressList = res.data.data
if(this.addressList !== undefined && this.addressList != null && this.addressList.length > 0){
let defaultFlagExist = false
this.addressList.forEach(element => {
if(this.addressId){
if(element.id == this.addressId){
this.addressInfo = element
this.addressShow = true
defaultFlagExist = true
}
}else if(element.defaultFlag){
this.addressInfo = element
this.addressId = element.id
this.addressShow = true
defaultFlagExist = true
} }
});
if(!defaultFlagExist){
this.addressInfo = this.addressList[0]
this.addressShow = true
}
}
}
})
},
goAddress(){
uni.navigateTo({
url: '/pagesD/pages/personal/myAddress?pay=1'
})
},
},
onShow() {
this.getAddressList()
}, },
}; };
</script> </script>
...@@ -225,6 +313,7 @@ export default { ...@@ -225,6 +313,7 @@ export default {
padding: 30rpx 40rpx; padding: 30rpx 40rpx;
.address__left { .address__left {
width: 600rpx;
.right__title { .right__title {
font-size: 32rpx; font-size: 32rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -239,15 +328,6 @@ export default { ...@@ -239,15 +328,6 @@ export default {
align-items: center; align-items: center;
span:nth-of-type(1) { span:nth-of-type(1) {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: #F88D28;
padding: 2rpx 4rpx;
border: 1rpx solid #F88D28;
}
span:nth-of-type(2) {
font-size: 28rpx; font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
...@@ -255,12 +335,21 @@ export default { ...@@ -255,12 +335,21 @@ export default {
padding: 0 14rpx; padding: 0 14rpx;
} }
span:nth-of-type(3) { span:nth-of-type(2) {
font-size: 28rpx; font-size: 28rpx;
font-family: DIN; font-family: DIN;
font-weight: 500; font-weight: 500;
color: #666666; color: #666666;
} }
span:nth-of-type(3) {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: #F88D28;
margin-left: 20rpx;
padding: 2rpx 4rpx;
border: 1rpx solid #F88D28;
}
} }
} }
......
...@@ -23,20 +23,20 @@ ...@@ -23,20 +23,20 @@
<u-gap bgColor="transparent" height="30"></u-gap> <u-gap bgColor="transparent" height="30"></u-gap>
<div class="car_info"> <div class="car_info">
<div class="car_info__title">填写车辆信息</div> <div class="car_info__title">填写车辆信息</div>
<u--form labelPosition="left" :model="model1" :rules="rules" ref="form1" labelWidth="100"> <u--form labelPosition="left" :model="model1" ref="form1" labelWidth="100">
<u-form-item label="品牌" prop="userInfo.name" borderBottom ref="item1"> <u-form-item label="品牌" prop="carInfo.brand" borderBottom ref="item1">
<u--input class="self__input" v-model="model1.userInfo.name" placeholder="请输入" border="none"></u--input> <u--input v-model="model1.carInfo.brand" placeholder="请输入" border="none"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="车型" prop="userInfo.name" borderBottom ref="item1"> <u-form-item label="车型" prop="carInfo.carModel" borderBottom ref="item2">
<u--input class="self__input" v-model="model1.userInfo.name" placeholder="请输入" border="none"></u--input> <u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="行驶里程" prop="userInfo.name" borderBottom ref="item1"> <u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item3">
<div class="self__input__km"> <div class="self__input__km">
<u--input class="self__input" v-model="model1.userInfo.name" placeholder="请输入" border="none"></u--input><span>KM</span> <u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM
</div> </div>
</u-form-item> </u-form-item>
<u-form-item label="车牌号" ref="item1"> </u-form-item> <u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-model="carNumber"></car-number> <car-number v-model="model1.carInfo.carNo"></car-number>
</u--form> </u--form>
<div class="select__car" @click="goLoveCar"> <div class="select__car" @click="goLoveCar">
从爱车选择 <image src="@/static/index/zhankai.png" alt=""> 从爱车选择 <image src="@/static/index/zhankai.png" alt="">
...@@ -77,19 +77,29 @@ export default { ...@@ -77,19 +77,29 @@ export default {
return { return {
carNumber: "", carNumber: "",
model1: { model1: {
userInfo: { carInfo: {},
name: "",
sex: "",
},
}, },
rules: { rules: {
"userInfo.name": { "carInfo.brand": {
type: "string",
required: true,
message: "请填写品牌",
trigger: ["blur", "change"],
},
"carInfo.carModel": {
type: "string", type: "string",
required: true, required: true,
message: "请填写姓品牌", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": {
type: "string",
required: true,
message: "请填写车牌号",
trigger: ["blur", "change"],
}, },
},
carId: '',
}; };
}, },
watch: { watch: {
...@@ -100,16 +110,49 @@ export default { ...@@ -100,16 +110,49 @@ export default {
methods: { methods: {
goLoveCar(){ goLoveCar(){
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/pages/move-car/loveCar' url: '/pagesB/pages/move-car/loveCar?price=1'
}); });
}, },
getCarCode() { getCarCode() {
//跳转到获取挪车码页面 //跳转到获取挪车码页面
this.$refs.form1.validate().then(res => {
if(!this.model1.carInfo.id){
let opts = { url: '/app/vehicleAdmin/add', method: 'post' };
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
if (res.data.code == 200) {
}
})
}
uni.navigateTo({ uni.navigateTo({
url: '/pagesA/pages/index/getCarCode' url: '/pagesA/pages/index/getCarCode'
}); });
}).catch(errors => {
uni.$u.toast('校验失败')
})
},
getCarInfo(){
if(this.carId){
let opts = { url: '/app/vehicleAdmin/' + this.carId, method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.model1.carInfo = res.data.data
}else{
//展示删除失败
}
})
} }
},
},
onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules)
}, },
onShow() {
this.getCarInfo()
}
}; };
</script> </script>
...@@ -225,7 +268,7 @@ export default { ...@@ -225,7 +268,7 @@ export default {
color: #f1251b; color: #f1251b;
text-align: right; text-align: right;
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 200rpx;
image { image {
width: 10rpx; width: 10rpx;
height: 20rpx; height: 20rpx;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
我的爱车 我的爱车
</div> </div>
<div class="love-car__list"> <div class="love-car__list">
<div class="love__item" v-for="(vo,inx) in carList" :key="inx"> <div class="love__item" v-for="(vo,inx) in carList" :key="inx" @click="goGetPrice(vo.id)">
<div class="itme__img"> <div class="itme__img">
<image src="@/static/move-car/love-car6.png" /> <image src="@/static/move-car/love-car6.png" />
</div> </div>
...@@ -44,6 +44,7 @@ export default { ...@@ -44,6 +44,7 @@ export default {
deleteTitle: '删除车辆', deleteTitle: '删除车辆',
deleteContent: '确定删除车辆?', deleteContent: '确定删除车辆?',
carId: '', carId: '',
price: '',
}; };
}, },
methods: { methods: {
...@@ -92,10 +93,23 @@ export default { ...@@ -92,10 +93,23 @@ export default {
} }
}) })
}, },
goGetPrice(id){
if(this.price == 1){
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]
prevPage.$vm.carId = id;
uni.navigateBack({
delta: 1
})
}
}
}, },
onShow(){ onShow(){
this.getCarList() this.getCarList()
} },
onLoad(e) {
this.price = e.price
},
} }
</script> </script>
......
...@@ -8,21 +8,21 @@ ...@@ -8,21 +8,21 @@
</view> </view>
</u-swiper> </u-swiper>
<div class="shop__title"> <div class="shop__title">
<div>防晒布罩 加厚防风 大款 商务风</div> <div>{{mallInfo.title}} {{mallInfo.description}}</div>
<div> <div>
<span>48.00</span> <span>{{mallInfo.currentPrice/100}}</span>
<span>销量500</span> <span>销量{{mallInfo.sales}}</span>
</div> </div>
</div> </div>
<div class="shop__title__2">规格 <span>儿童数学思维训练游戏(套装共5册)</span></div> <div class="shop__title__2">规格 <span>{{mallInfo.spec}}</span></div>
<div class="shop__content"> <div class="shop__content">
<div class="content__title"> <div class="content__title">
商品详情 商品详情
</div> </div>
何秋光老师是“儿童数学思维训练”课程的创始人,既有儿童数学思维教育理论知识,又有丰富教学实践经验,本书集作者三十余年儿童数学教学、十余年儿童数学思维训练教学实践与理论研究的成果,是目前国内比较完整、系统和科学的对儿童进行数学思维训练与开发的丛书。本书于2012年首次出版,六年间加印十多次,市场认可度较好。之前五本图书分两次出版,体例有所不同,这次再版修订了之前体例不统一的问题,优化了部分题目的设计,重新编写了专家提示”的内容,对每一种类型题目的解题方法和对孩子的引导方法都做了更加详细的介绍。 {{mallInfo.detailContent}}
</div> </div>
</div> </div>
<div class="shop__btn view__no__bind" @click="pay">立即购买</div> <div class="shop__btn view__no__bind" @click="pay()">立即购买</div>
<u-gap bgColor="transparent" height="80"></u-gap> <u-gap bgColor="transparent" height="80"></u-gap>
</div> </div>
</view> </view>
...@@ -37,14 +37,32 @@ export default { ...@@ -37,14 +37,32 @@ export default {
require('@/static/shop/item.jpg'), require('@/static/shop/item.jpg'),
require('@/static/shop/item.jpg'), require('@/static/shop/item.jpg'),
], ],
//商品id
id: '',
//商品详情
mallInfo: {},
} }
}, },
methods: { methods: {
pay(){ pay(){
uni.navigateTo({ uni.navigateTo({
url: '/pagesC/pages/shop/pay' url: '/pagesC/pages/shop/pay?id=' + this.id
}) })
},
getMallInfo(){
let opts = { url: '/app/mall/' + this.id, method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.mallInfo = res.data.data
} }
})
},
},
onLoad(option) {
this.id = option.id
},
onShow() {
this.getMallInfo()
}, },
} }
</script> </script>
......
...@@ -14,27 +14,27 @@ ...@@ -14,27 +14,27 @@
<div class="view__content"> <div class="view__content">
<div class="view__title">超低价养车好物</div> <div class="view__title">超低价养车好物</div>
<div class="shop__list2"> <div class="shop__list2">
<div class="shop__item2" v-for="(vo,inx) in 4" :key="inx"> <div class="shop__item2" v-for="(vo,inx) in mallList" :key="inx" @click="goDetail(vo.id)">
<div class="item2__img"> <div class="item2__img">
<image src='@/static/shop/qy.jpeg' /> <image :src="getImage(vo.mainImgUrl)" />
</div> </div>
<div class="item2__title">临时停车牌111</div> <div class="item2__title">{{vo.title}}</div>
<div class="item2__price">25.5</div> <div class="item2__price">{{vo.currentPrice/100}}</div>
</div> </div>
</div> </div>
</div> </div>
<div class="shop__list__one"> <div class="shop__list__one">
<div class="view__title">车主精选 养车必备</div> <div class="view__title">车主精选 养车必备</div>
<div class="list__one__items"> <div class="list__one__items">
<div class="one__item" v-for="(vo,inx) in 4" :key="inx" @click="goDetail"> <div class="one__item" v-for="(vo,inx) in boutiqueMallList" :key="inx" @click="goDetail(vo.id)">
<div class="one__item__img"> <div class="one__item__img">
<image src="@/static/shop/item.jpg" /> <image :src="getImage(vo.mainImgUrl)" />
</div> </div>
<div class="one__item__title"> <div class="one__item__title">
临时停车牌 {{vo.title}}
</div> </div>
<div class="one__item__price"> <div class="one__item__price">
25.5<span class="num__two">¥39.9</span> {{vo.currentPrice/100}}<span class="num__two">{{vo.originalPrice/100}}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -60,6 +60,10 @@ export default { ...@@ -60,6 +60,10 @@ export default {
'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper1.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
], ],
//普通商品列表
mallList: [],
//精品商品
boutiqueMallList: [],
} }
}, },
methods: { methods: {
...@@ -68,12 +72,35 @@ export default { ...@@ -68,12 +72,35 @@ export default {
url: '/pagesC/pages/shop/search' url: '/pagesC/pages/shop/search'
}) })
}, },
goDetail() { goDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesC/pages/shop/detail' url: '/pagesC/pages/shop/detail?id=' + id
}) })
},
getMallList(){
let opts = { url: '/app/mall/list', method: 'get' };
this.http.httpTokenRequest(opts, {classification: "1"}).then(res => {
if (res.data.code == 200) {
this.mallList = res.data.data.rows
}
})
},
getBoutiqueMallList(){
let opts = { url: '/app/mall/list', method: 'get' };
this.http.httpTokenRequest(opts, {classification: "2"}).then(res => {
if (res.data.code == 200) {
this.boutiqueMallList = res.data.data.rows
} }
})
},
getImage(imageUrl){
return this.http.baseUrl + imageUrl;
}, },
},
onShow() {
this.getMallList()
this.getBoutiqueMallList()
}
}; };
</script> </script>
......
...@@ -5,20 +5,25 @@ ...@@ -5,20 +5,25 @@
<template> <template>
<view class="appCotent"> <view class="appCotent">
<div class="pay"> <div class="pay">
<div class="address"> <div class="address" v-if="addressShow">
<div class="address__left"> <div class="address__left">
<div class="right__title"> <div class="right__title">
北京市朝阳区李家董镇太阳宫社区大唐公寓 2号楼3单元303 {{addressInfo.address}}&emsp;{{addressInfo.detailInfo}}
</div> </div>
<div class="right__phone"> <div class="right__phone">
<span>默认</span> <span>我是收货人</span><span>19963353323</span> <span>{{addressInfo.userName}}</span>
<span>{{addressInfo.telNumber}}</span>
<span v-if="addressInfo.defaultFlag">默认</span>
</div> </div>
</div> </div>
<div class="address__right"> <div class="address__right" @click="goAddress">
<image src="@/static/index/right.png" /> <image src="@/static/index/right.png" />
</div> </div>
<u-gap bgColor="transparent" height="15"></u-gap> <u-gap bgColor="transparent" height="15"></u-gap>
</div> </div>
<div v-else class="add__address" @click="addAddress">
<image src="@/static/index/get-car-code5.png"> 添加收货地址
</div>
<div class="pay__item"> <div class="pay__item">
<div class="item"> <div class="item">
<div class="item__top"> <div class="item__top">
...@@ -27,24 +32,24 @@ ...@@ -27,24 +32,24 @@
</div> </div>
<div class="top__right"> <div class="top__right">
<div class="right__one one__text"> <div class="right__one one__text">
<span>强力清洗剂 大容量 标</span> <span>{{mallInfo.title}} </span>
<span>25.5</span> <span>{{mallInfo.currentPrice/100}}</span>
</div> </div>
<div class="right__two"> <div class="right__two">
<span>强力清洗剂 大容量 标120 ml*3瓶装</span> <span>{{mallInfo.description}}</span>
<span>×4</span> <span>×1</span>
</div> </div>
</div> </div>
</div> </div>
<div class="item__bottom"> <div class="item__bottom">
<div class="bottom__item"> <div class="bottom__item">
<div>商品总价:</div> <div>商品总价:</div>
<div>48.00</div> <div>{{mallInfo.currentPrice/100}}</div>
</div> </div>
<u-gap bgColor="transparent" height="15"></u-gap> <u-gap bgColor="transparent" height="15"></u-gap>
<div class="bottom__item"> <div class="bottom__item">
<div>总金额:</div> <div>总金额:</div>
<div class="bottom__price">48.00</div> <div class="bottom__price">{{mallInfo.currentPrice/100}}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -55,7 +60,7 @@ ...@@ -55,7 +60,7 @@
<span>1</span> <span>1</span>
</div> </div>
<div class="price__all"> <div class="price__all">
合计<span>48.00</span> 合计<span>{{mallInfo.currentPrice/100}}</span>
</div> </div>
</div> </div>
<div class="price__next" @click="pay"> <div class="price__next" @click="pay">
...@@ -68,12 +73,146 @@ ...@@ -68,12 +73,146 @@
<script> <script>
export default { export default {
data () {
return {
//商品id
id: '',
//商品详情
mallInfo: {},
//收货地址列表
addressList: [],
//选择收货地址id
addressId: '',
//选择的收货地址
addressInfo: {},
//商品总价
mallTotalPrice: '0.00',
//总金额
totalAmount: '0.00',
//总计
total: '0.00',
//弹出层
showAddress: false,
createOrder: {},
orderSubmit: {},
addressShow: false,
}
},
methods: { methods: {
pay() { pay() {
this.createOrder = {
addressId: this.addressId,
commodityList: [{
id: this.id,
nums: 1,
}],
}
let that = this
let opts = { url: '/app/mall/create/order', method: 'post' };
this.http.httpTokenRequest(opts, this.createOrder).then(res => {
if (res.data.code == 200) {
let orderIds = res.data.data
that.orderSubmit = {
appId: 6,
ids: orderIds,
channelCode: 'wx_lite',
}
let opts = { url: '/app/pay/order/submit/more', method: 'post' }
this.http.httpTokenRequest(opts, that.orderSubmit).then(res => {
console.log(res);
if (res.data.code == 200) {
let paymentData = res.data.data.invokeResponse;
uni.requestPayment({
provider: 'wxpay', // 服务提提供商
timeStamp: paymentData.timeStamp,
nonceStr: paymentData.nonceStr,
package: paymentData.packageValue,
signType: paymentData.signType,
paySign: paymentData.paySign,
success: function (res) {
console.log('支付成功',res);
uni.navigateTo({ uni.navigateTo({
url: '/pagesC/pages/shop/payOk' url: '/pagesC/pages/shop/payOk'
}) })
},
fail: function (err) {
console.log('支付失败',err);
},
});
} else {
}
})
} }
})
},
getMallInfo(){
let opts = { url: '/app/mall/' + this.id, method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.mallInfo = res.data.data
}
})
},
getAddressList(){
let opts = { url: '/app/user/address/list', method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.addressList = res.data.data
if(this.addressList !== undefined && this.addressList != null && this.addressList.length > 0){
let defaultFlagExist = false
this.addressList.forEach(element => {
if(this.addressId){
if(element.id == this.addressId){
this.addressInfo = element
this.addressShow = true
defaultFlagExist = true
}
}else if(element.defaultFlag){
this.addressInfo = element
this.addressId = element.id
this.addressShow = true
defaultFlagExist = true
}
});
if(!defaultFlagExist){
this.addressInfo = this.addressList[0]
this.addressShow = true
}
}
}
})
},
openAddress(){
this.showAddress = true
},
seleteAddress(address,index){
this.addressInfo = address
this.addressIndex = index
},
closeAddress(){
this.showAddress = false
},
goAddress(){
uni.navigateTo({
url: '/pagesD/pages/personal/myAddress?pay=1'
})
},
addAddress() {
uni.navigateTo({
url: '/pagesD/pages/personal/addAddress'
});
},
},
onLoad(option) {
this.id = option.id
},
onShow() {
this.getMallInfo()
this.getAddressList()
}, },
} }
</script> </script>
...@@ -157,6 +296,7 @@ export default { ...@@ -157,6 +296,7 @@ export default {
margin-bottom: 30rpx; margin-bottom: 30rpx;
.address__left { .address__left {
width: 600rpx;
.right__title { .right__title {
font-size: 32rpx; font-size: 32rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -170,16 +310,9 @@ export default { ...@@ -170,16 +310,9 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
span:nth-of-type(1) {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: #F88D28;
padding: 2rpx 4rpx;
border: 1rpx solid #F88D28;
}
span:nth-of-type(2) {
span:nth-of-type(1) {
font-size: 28rpx; font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
...@@ -187,11 +320,20 @@ export default { ...@@ -187,11 +320,20 @@ export default {
padding: 0 14rpx; padding: 0 14rpx;
} }
span:nth-of-type(3) { span:nth-of-type(2) {
font-size: 28rpx; font-size: 28rpx;
font-family: DIN; font-family: DIN;
font-weight: 500; font-weight: 500;
color: #666666; color: #666666;
}
span:nth-of-type(3) {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: #F88D28;
margin-left: 20rpx;
padding: 2rpx 4rpx;
border: 1rpx solid #F88D28;
} }
} }
} }
...@@ -203,7 +345,27 @@ export default { ...@@ -203,7 +345,27 @@ export default {
} }
} }
} }
.add__address {
width: 670rpx;
height: 90rpx;
background: #ffffff;
box-shadow: 0rpx 0rpx 28rpx 1rpx rgba(232, 232, 232, 0.16);
border-radius: 10rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: #F88D28;
display: flex;
margin: 0 auto;
align-items: center;
justify-content: center;
image {
width: 34rpx;
height: 36rpx;
margin-right: 20rpx;
}
}
.pay__item { .pay__item {
padding: 30rpx 40rpx; padding: 30rpx 40rpx;
......
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
}) })
}, },
}, },
created() { onShow() {
this.getUserInfo() this.getUserInfo()
}, },
}; };
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
<view class="appCotent"> <view class="appCotent">
<div class="myAddress"> <div class="myAddress">
<div class="address__content"> <div class="address__content">
<div class="ress__item" v-for="(vo,inx) in addressList" :key="inx"> <div class="ress__item" v-for="(vo,inx) in addressList" :key="inx" @click="goPay(vo.id)">
<div class="item__top"> <div class="item__top" >
<span>{{vo.userName}}</span> <span>{{vo.userName}}</span>
<span>{{vo.telNumber}}</span> <span>{{vo.telNumber}}</span>
<span v-if="vo.defaultFlag">默认</span> <span v-if="vo.defaultFlag">默认</span>
</div> </div>
<div class="item__two"> <div class="item__two" >
<span>{{vo.address}}&emsp;{{vo.detailInfo}}</span> <span>{{vo.address}}&emsp;{{vo.detailInfo}}</span>
<span @click="edit(vo.id)"> <span @click="edit(vo.id)">
<image src="@/static/my/my-address1.png" /> <image src="@/static/my/my-address1.png" />
...@@ -32,6 +32,8 @@ export default { ...@@ -32,6 +32,8 @@ export default {
data() { data() {
return { return {
addressList: [], addressList: [],
pay: '',
carCode: '',
} }
}, },
methods: { methods: {
...@@ -53,11 +55,23 @@ export default { ...@@ -53,11 +55,23 @@ export default {
} }
}) })
}, },
goPay(id){
if(this.pay==1){
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]
prevPage.$vm.addressId = id;
uni.navigateBack({
delta: 1
})
}
}
}, },
onShow(){ onShow(){
this.getAddressList() this.getAddressList()
}, },
onLoad(e) {
this.pay = e.pay
},
} }
</script> </script>
......
...@@ -165,6 +165,8 @@ export default { ...@@ -165,6 +165,8 @@ export default {
}, { }, {
name: '退款/售后' name: '退款/售后'
}], }],
//商品订单列表
orderList: [],
} }
}, },
onLoad: function (e) { onLoad: function (e) {
...@@ -186,7 +188,19 @@ export default { ...@@ -186,7 +188,19 @@ export default {
changeVal(v) { changeVal(v) {
this.current = v.index this.current = v.index
}, },
getOrderList(){
let order = {orderStatus: this.current}
let opts = { url: '/app/user/order/list', method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.orderList = res.data.data
}
})
}, },
},
onShow() {
this.getOrderList()
}
} }
</script> </script>
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<div class="info__cover" @click="select"> <div class="info__cover" @click="select">
<span class="cover__name">头像</span> <span class="cover__name">头像</span>
<div class="cover"> <div class="cover">
<image :src="image" /> <image v-if="image" :src="image" />
<image v-else src="@/static/my/my2.png" />
<!-- 此处应该有默认头像 --> <!-- 此处应该有默认头像 -->
<!-- <image v-else src="@/static/my/my2.png" />--> <!-- <image v-else src="@/static/my/my2.png" />-->
<span> <span>
...@@ -27,7 +28,8 @@ ...@@ -27,7 +28,8 @@
<u-popup :show="show__six" @close="close__sex" closeOnClickOverlay> <u-popup :show="show__six" @close="close__sex" closeOnClickOverlay>
<div class="user__input user__sex" @click="select__sex('男')"> <div class="user__input user__sex" @click="select__sex('男')">
<div class="user__name__border user__name__border__sex" @click="select__sex('女')"></div> </div>
<div class="user__input user__sex" @click="select__sex('女')">
</div> </div>
</u-popup> </u-popup>
...@@ -145,10 +147,11 @@ export default { ...@@ -145,10 +147,11 @@ export default {
if (element.label === '性别') { if (element.label === '性别') {
element.rules.label = val element.rules.label = val
let opts = { url: '/app/user/update', method: 'post' }; let opts = { url: '/app/user/update', method: 'post' };
let userInfoItem = { type: 3, val: val }; let sex = (val=='男'?"0":"1")
that.http.httpTokenRequest(opts, userInfoItem).then(response => { let userInfoItem = { type: 3, val: sex };
this.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
that.userInfo.avatar = res.data.url
} }
}) })
} }
...@@ -159,12 +162,12 @@ export default { ...@@ -159,12 +162,12 @@ export default {
save() { save() {
this.formData.forEach(element => { this.formData.forEach(element => {
if (element.label === '昵称') { if (element.label === '昵称') {
element.rules.label = this.user__nikename element.rules.value = this.user__nikename
let opts = { url: '/app/user/update', method: 'post' }; let opts = { url: '/app/user/update', method: 'post' };
let userInfoItem = { type: 2, val: this.user__nikename }; let userInfoItem = { type: 2, val: this.user__nikename };
that.http.httpTokenRequest(opts, userInfoItem).then(response => { that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
that.userInfo.avatar = res.data.url
} }
}) })
} }
...@@ -211,13 +214,17 @@ export default { ...@@ -211,13 +214,17 @@ export default {
formData: { formData: {
file: tempFilePaths[0] file: tempFilePaths[0]
}, },
// 请求头一定要加,否则 iOS 图片上传会失败
header: {
'content-type': 'multipart/form-data'
},
success: (res) => { success: (res) => {
let uploadData = JSON.parse(res.data) let uploadData = JSON.parse(res.data)
let opts = { url: '/app/user/update', method: 'post' }; let opts = { url: '/app/user/update', method: 'post' };
let userInfoItem = { type: 1, val: uploadData.data.fileName }; let userInfoItem = { type: 1, val: uploadData.data.fileName };
that.http.httpTokenRequest(opts, userInfoItem).then(response => { that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
that.userInfo.avatar = res.data.url that.image = that.http.baseUrl + uploadData.data.fileName
} }
}) })
} }
...@@ -225,29 +232,6 @@ export default { ...@@ -225,29 +232,6 @@ export default {
} }
}); });
},
getUserInfo(){
let opts = { url: '/app/user/info', method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.userInfo = res.data.data
this.image = this.http.baseUrl + this.userInfo.avatar
for(let item in this.formData){
if(this.formData[item].rules.name == "mobile"){
this.formData[item].rules.value = this.userInfo.mobile
}
else if(this.formData[item].rules.name == "nickName"){
this.formData[item].rules.value = this.userInfo.nickName
}
else if(this.formData[item].rules.name == "sex"){
this.formData[item].rules.value = this.userInfo.sex==0?"男":"女"
}
else if(this.formData[item].rules.name == "birthday"){
this.formData[item].rules.value = this.userInfo.birthday
}
}
}
})
}, },
select() { select() {
let that = this let that = this
...@@ -287,20 +271,20 @@ export default { ...@@ -287,20 +271,20 @@ export default {
if (res.data.code == 200) { if (res.data.code == 200) {
this.userInfo = res.data.data this.userInfo = res.data.data
this.image = this.http.baseUrl + this.userInfo.avatar this.image = this.http.baseUrl + this.userInfo.avatar
for(let item in this.formData){ this.formData.forEach(element => {
if(this.formData[item].rules.name == "mobile"){ if (element.label === '手机号') {
this.formData[item].rules.value = this.userInfo.mobile element.rules.value = this.userInfo.mobile
}
else if(this.formData[item].rules.name == "nickName"){
this.formData[item].rules.value = this.userInfo.nickName
} }
else if(this.formData[item].rules.name == "sex"){ if (element.label === '昵称') {
this.formData[item].rules.value = this.userInfo.sex==0?"男":"女" element.rules.value = this.userInfo.nickName
} }
else if(this.formData[item].rules.name == "birthday"){ if (element.label === '性别') {
this.formData[item].rules.value = this.userInfo.birthday element.rules.label = this.userInfo.sex=="0"?"男":"女"
} }
if (element.label === '生日') {
element.rules.value = this.userInfo.birthday
} }
})
} }
}) })
}, },
...@@ -312,7 +296,7 @@ export default { ...@@ -312,7 +296,7 @@ export default {
} }
}, },
}, },
created() { onShow() {
this.getUserInfo() this.getUserInfo()
}, },
......
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