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

优化

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