Commit d2352ab7 authored by 程新智's avatar 程新智 👽

优化

parent df77d25a
...@@ -272,10 +272,11 @@ export default { ...@@ -272,10 +272,11 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
overflow: hidden;
overflow-x: scroll;
.shop__item2 { .shop__item2 {
width: 25%; width: 24%;
margin-right: 1%;
.item2__img { .item2__img {
margin-bottom: 20rpx; margin-bottom: 20rpx;
text-align: center; text-align: center;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<span v-if="addressInfo.defaultFlag">默认</span> <span v-if="addressInfo.defaultFlag">默认</span>
</div> </div>
</div> </div>
<div class="address__right" > <div class="address__right">
<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>
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
export default { export default {
data() { data() {
return { return {
nums:0, nums: 0,
show: false, show: false,
addressShow: false, addressShow: false,
content: "地址不能为空", content: "地址不能为空",
...@@ -153,7 +153,7 @@ export default { ...@@ -153,7 +153,7 @@ export default {
// //
selectMallList: [], selectMallList: [],
//选择商品的数量 //选择商品的数量
countNum: 0, countNum: 1,
//商品变更为零或者1 //商品变更为零或者1
quantityChange: false, quantityChange: false,
countMoney: 0, countMoney: 0,
...@@ -164,10 +164,10 @@ export default { ...@@ -164,10 +164,10 @@ export default {
}, },
methods: { methods: {
pay() { pay() {
if(!this.addressId) { if (!this.addressId) {
uni.showToast({ uni.showToast({
title:'请添加一个收货地址', title: '请添加一个收货地址',
icon:'none', icon: 'none',
}) })
} else { } else {
let list = [{ let list = [{
...@@ -175,9 +175,12 @@ export default { ...@@ -175,9 +175,12 @@ export default {
nums: 1, nums: 1,
}] }]
let idMap = this.mallSelectMap let idMap = this.mallSelectMap
for(let id in idMap){ for (let id in idMap) {
if(idMap[id] > 0){ if (idMap[id] > 0) {
let commodity = { id: id, nums: idMap[id] } let commodity = {
id: id,
nums: idMap[id]
}
list.push(commodity) list.push(commodity)
} }
} }
...@@ -186,17 +189,23 @@ export default { ...@@ -186,17 +189,23 @@ export default {
commodityList: list, commodityList: list,
} }
let that = this let that = this
let opts = { url: '/app/mall/create/order', method: 'post' }; let opts = {
url: '/app/mall/create/order',
method: 'post'
};
this.http.httpTokenRequest(opts, this.createOrder).then(res => { this.http.httpTokenRequest(opts, this.createOrder).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
let orderIds = res.data.data let orderIds = res.data.data
if(orderIds && orderIds.length > 0) { if (orderIds && orderIds.length > 0) {
that.orderSubmit = { that.orderSubmit = {
appId: 6, appId: 6,
ids: orderIds, ids: orderIds,
channelCode: 'wx_lite', channelCode: 'wx_lite',
} }
let opts = { url: '/app/pay/order/submit/more', method: 'post' } let opts = {
url: '/app/pay/order/submit/more',
method: 'post'
}
this.http.httpTokenRequest(opts, that.orderSubmit).then(res => { this.http.httpTokenRequest(opts, that.orderSubmit).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
let paymentData = res.data.data.invokeResponse; let paymentData = res.data.data.invokeResponse;
...@@ -228,14 +237,14 @@ export default { ...@@ -228,14 +237,14 @@ export default {
} else { } else {
uni.showToast({ uni.showToast({
title: res.data.msg, title: res.data.msg,
icon:'none', icon: 'none',
}) })
} }
}) })
} }
}, },
add(){ add() {
this.nums++ this.nums++
}, },
addAddress() { addAddress() {
...@@ -243,28 +252,31 @@ export default { ...@@ -243,28 +252,31 @@ export default {
url: '/pagesD/pages/personal/addAddress' url: '/pagesD/pages/personal/addAddress'
}); });
}, },
getAddressList(){ getAddressList() {
let opts = { url: '/app/user/address/list', method: 'get' }; let opts = {
url: '/app/user/address/list',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.addressList = res.data.data this.addressList = res.data.data
if(this.addressList !== undefined && this.addressList != null && this.addressList.length > 0){ if (this.addressList !== undefined && this.addressList != null && this.addressList.length > 0) {
let defaultFlagExist = false let defaultFlagExist = false
this.addressList.forEach(element => { this.addressList.forEach(element => {
if(this.addressId){ if (this.addressId) {
if(element.id == this.addressId){ if (element.id == this.addressId) {
this.addressInfo = element this.addressInfo = element
this.addressShow = true this.addressShow = true
defaultFlagExist = true defaultFlagExist = true
} }
}else if(element.defaultFlag){ } else if (element.defaultFlag) {
this.addressInfo = element this.addressInfo = element
this.addressId = element.id this.addressId = element.id
this.addressShow = true this.addressShow = true
defaultFlagExist = true defaultFlagExist = true
} }
}); });
if(!defaultFlagExist){ if (!defaultFlagExist) {
this.addressInfo = this.addressList[0] this.addressInfo = this.addressList[0]
this.addressShow = true this.addressShow = true
} }
...@@ -272,53 +284,61 @@ export default { ...@@ -272,53 +284,61 @@ export default {
} }
}) })
}, },
goAddress(){ goAddress() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesD/pages/personal/myAddress?pay=1' url: '/pagesD/pages/personal/myAddress?pay=1'
}) })
}, },
getMoveCode(){ getMoveCode() {
let opts = { url: '/app/mall/free/code', method: 'get' }; let opts = {
url: '/app/mall/free/code',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.freeCode = res.data.data this.freeCode = res.data.data
} }
}) })
}, },
getMallList(){ getMallList() {
let opts = { url: '/app/mall/add/purchase', method: 'get' }; let opts = {
url: '/app/mall/add/purchase',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.mallList = res.data.data this.mallList = res.data.data
this.mallList.forEach(element=>{ this.mallList.forEach(element => {
element.selectNum = 0 element.selectNum = 0
}) })
} }
}) })
}, },
selectMoney(value){ selectMoney(value) {
this.mallMoney = value this.mallMoney = value
}, },
selectMall(num){ selectMall(num) {
//当添加数量且数量为1就加总共商品数量 //当添加数量且数量为1就加总共商品数量
this.quantityChange = (num.value == 0 || num.value == 1) this.quantityChange = (num.value == 0 || num.value == 1)
}, },
plusMall(vo){ plusMall(vo) {
if(!this.mallSelectMap[vo.id] || this.mallSelectMap[vo.id] == 0){
this.countNum = this.countNum + 1 this.countNum = this.countNum + 1
if (!this.mallSelectMap[vo.id] || this.mallSelectMap[vo.id] == 0) {
this.mallSelectMap[vo.id] = 1 this.mallSelectMap[vo.id] = 1
}else{ } else {
this.mallSelectMap[vo.id] += 1 this.mallSelectMap[vo.id] += 1
} }
this.countMoney += vo.currentPrice this.countMoney += vo.currentPrice
//console.log(this.mallSelectMap) //console.log(this.mallSelectMap)
}, },
minusMall(vo){ minusMall(vo) {
if(this.mallSelectMap[vo.id] && this.mallSelectMap[vo.id] > 0){ if (this.countNum == 0) {
if(this.mallSelectMap[vo.id] == 1){ return
this.countNum -= 1
} }
this.countNum = this.countNum - 1
if (this.mallSelectMap[vo.id] && this.mallSelectMap[vo.id] > 0) {
if (this.mallSelectMap[vo.id] == 1) {}
this.mallSelectMap[vo.id] -= 1 this.mallSelectMap[vo.id] -= 1
this.countMoney -= vo.currentPrice this.countMoney -= vo.currentPrice
} }
...@@ -340,9 +360,11 @@ export default { ...@@ -340,9 +360,11 @@ export default {
/deep/ .u-modal__content__text { /deep/ .u-modal__content__text {
text-align: center !important; text-align: center !important;
} }
/deep/ .u-input__content__field-wrapper__field { /deep/ .u-input__content__field-wrapper__field {
text-align: right !important; text-align: right !important;
} }
.price__bottom { .price__bottom {
width: 100%; width: 100%;
height: 156rpx; height: 156rpx;
...@@ -421,6 +443,7 @@ export default { ...@@ -421,6 +443,7 @@ export default {
.address__left { .address__left {
width: 600rpx; width: 600rpx;
.right__title { .right__title {
font-size: 32rpx; font-size: 32rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -448,6 +471,7 @@ export default { ...@@ -448,6 +471,7 @@ export default {
font-weight: 500; font-weight: 500;
color: #666666; color: #666666;
} }
span:nth-of-type(3) { span:nth-of-type(3) {
font-size: 24rpx; font-size: 24rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -600,6 +624,7 @@ export default { ...@@ -600,6 +624,7 @@ export default {
margin: 0 20rpx; margin: 0 20rpx;
margin-left: 100rpx; margin-left: 100rpx;
width: 400rpx; width: 400rpx;
.money__title { .money__title {
font-size: 32rpx; font-size: 32rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -654,7 +679,8 @@ export default { ...@@ -654,7 +679,8 @@ export default {
} }
} }
} }
.minus {
.minus {
width: 22px; width: 22px;
height: 22px; height: 22px;
border-width: 1px; border-width: 1px;
...@@ -666,13 +692,13 @@ export default { ...@@ -666,13 +692,13 @@ export default {
@include flex; @include flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.input { .input {
padding: 0 10px; padding: 0 10px;
} }
.plus { .plus {
width: 22px; width: 22px;
height: 22px; height: 22px;
background-color: #FF0000; background-color: #FF0000;
...@@ -682,5 +708,5 @@ export default { ...@@ -682,5 +708,5 @@ export default {
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
</style> </style>
...@@ -98,6 +98,12 @@ export default { ...@@ -98,6 +98,12 @@ export default {
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.mileage": {
type: "number",
required: false,
message: "请填写正确的里程数",
trigger: ["blur", "change"],
},
"carInfo.carNo": [{ "carInfo.carNo": [{
min: 7, min: 7,
max: 8, max: 8,
...@@ -185,7 +191,6 @@ export default { ...@@ -185,7 +191,6 @@ export default {
this.getMoveCode() this.getMoveCode()
}) })
}, },
onLoad(e) { onLoad(e) {
this.orderId = e.orderId this.orderId = e.orderId
......
...@@ -71,6 +71,12 @@ export default { ...@@ -71,6 +71,12 @@ export default {
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.mileage": {
type: "number",
required: false,
message: "请填写正确的里程数",
trigger: ["blur", "change"],
},
"carInfo.carNo": [{ "carInfo.carNo": [{
min: 7, min: 7,
max: 8, max: 8,
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
carNumber: "", carNumber: "",
model1: { model1: {
addressInfo: { addressInfo: {
address : '' address: ''
}, },
value: false, value: false,
}, },
...@@ -61,12 +61,25 @@ export default { ...@@ -61,12 +61,25 @@ export default {
message: "收货人不能为空", message: "收货人不能为空",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"addressInfo.telNumber": { "addressInfo.telNumber": [{
type: "string", type: "string",
required: true, required: true,
message: "手机号不能为空", message: "手机号不能为空",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
{
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说,返回true表示校验通过,返回false表示不通过
// uni.$u.test.mobile()就是返回true或者false的
return uni.$u.test.mobile(value);
},
message: '手机格式错误,请输入11位手机号',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}
],
"addressInfo.address": { "addressInfo.address": {
type: "string", type: "string",
required: true, required: true,
...@@ -88,13 +101,16 @@ export default { ...@@ -88,13 +101,16 @@ export default {
delta: 1 delta: 1
}) })
}, },
addAddress(){ addAddress() {
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
this.model1.addressInfo.defaultFlag = false this.model1.addressInfo.defaultFlag = false
if(this.model1.value){ if (this.model1.value) {
this.model1.addressInfo.defaultFlag = true this.model1.addressInfo.defaultFlag = true
} }
let opts = { url: '/app/user/address', method: 'post' }; let opts = {
url: '/app/user/address',
method: 'post'
};
this.http.httpTokenRequest(opts, this.model1.addressInfo).then(res => { this.http.httpTokenRequest(opts, this.model1.addressInfo).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
//添加成功 //添加成功
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--> -->
<template> <template>
<view class="appCotent"> <view class="appCotent">
<div class="editAddress"> <div class="editAddress">
<u-gap bgColor="transparent" height="20"></u-gap> <u-gap bgColor="transparent" height="20"></u-gap>
<div class="car_info"> <div class="car_info">
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
<u--input v-model="model1.addressInfo.address" placeholder="点击选择收货地址" border="none"></u--input> <u--input v-model="model1.addressInfo.address" placeholder="点击选择收货地址" border="none"></u--input>
<span @click.stop="getAuthorize"> <span @click.stop="getAuthorize">
<span class="app__gps"> <span class="app__gps">
<image src="@/static/my/gps.png" > <image src="@/static/my/gps.png">
</span> </span>
<span class="app__right"> <span class="app__right">
<image src="@/static/my/my6.png" > <image src="@/static/my/my6.png">
</span> </span>
</span> </span>
</u-form-item> </u-form-item>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<div class="view__btn view__back" @click="del"> <div class="view__btn view__back" @click="del">
删除该地址 删除该地址
</div> </div>
</div> </div>
</view> </view>
</template> </template>
...@@ -62,12 +62,24 @@ export default { ...@@ -62,12 +62,24 @@ export default {
message: "收货人不能为空", message: "收货人不能为空",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"addressInfo.telNumber": { "addressInfo.telNumber": [{
type: "string", type: "string",
required: true, required: true,
message: "手机号不能为空", message: "手机号不能为空",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
{
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说,返回true表示校验通过,返回false表示不通过
// uni.$u.test.mobile()就是返回true或者false的
return uni.$u.test.mobile(value);
},
message: '手机格式错误,请输入11位手机号',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}
],
"addressInfo.address": { "addressInfo.address": {
type: "string", type: "string",
required: true, required: true,
...@@ -91,14 +103,17 @@ export default { ...@@ -91,14 +103,17 @@ export default {
delta: 1 delta: 1
}) })
}, },
del(){ del() {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定删除该地址吗?', content: '确定删除该地址吗?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
//提示删除成功 //提示删除成功
let opts = { url: '/app/user/address/' + this.id, method: 'delete' }; let opts = {
url: '/app/user/address/' + this.id,
method: 'delete'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
uni.showToast({ uni.showToast({
...@@ -115,17 +130,23 @@ export default { ...@@ -115,17 +130,23 @@ export default {
} }
}); });
}, },
getAddress(){ getAddress() {
let opts = { url: '/app/user/address/info/' + this.id, method: 'get' }; let opts = {
url: '/app/user/address/info/' + this.id,
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.model1.addressInfo = res.data.data this.model1.addressInfo = res.data.data
} }
}) })
}, },
editAddress(){ editAddress() {
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
let opts = { url: '/app/user/address', method: 'put' }; let opts = {
url: '/app/user/address',
method: 'put'
};
this.http.httpTokenRequest(opts, this.model1.addressInfo).then(res => { this.http.httpTokenRequest(opts, this.model1.addressInfo).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
//添加成功 //添加成功
...@@ -219,7 +240,7 @@ export default { ...@@ -219,7 +240,7 @@ export default {
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
}, },
onShow(){ onShow() {
this.getAddress() this.getAddress()
}, },
...@@ -228,22 +249,26 @@ export default { ...@@ -228,22 +249,26 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.editAddress { .editAddress {
.app__gps{ .app__gps {
display: inline-block; display: inline-block;
image{
image {
width: 34rpx; width: 34rpx;
height: 36rpx; height: 36rpx;
} }
} }
.app__right{
.app__right {
display: inline-block; display: inline-block;
padding-left: 20rpx; padding-left: 20rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
image{
image {
width: 11rpx; width: 11rpx;
height: 18rpx; height: 18rpx;
} }
} }
.love__btn { .love__btn {
height: 76rpx; height: 76rpx;
background: url('@/static/move-car/love-car4.png') no-repeat; background: url('@/static/move-car/love-car4.png') no-repeat;
...@@ -258,6 +283,7 @@ export default { ...@@ -258,6 +283,7 @@ export default {
margin: 0 auto; margin: 0 auto;
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
image { image {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
......
No preview for this file type
...@@ -32,7 +32,7 @@ const store = new Vuex.Store({ ...@@ -32,7 +32,7 @@ const store = new Vuex.Store({
{ {
pagePath: '/pagesC/pages/releaseBtn/releaseBtn', pagePath: '/pagesC/pages/releaseBtn/releaseBtn',
iconPath: '', iconPath: '',
selectedIconPath: '/static/tarbar/index31.png' selectedIconPath: ''
}, },
{ {
pagePath: '/pagesC/pages/shop/index', pagePath: '/pagesC/pages/shop/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