完成3.0功能升级

This commit is contained in:
Gao xiaosong
2020-07-12 22:44:37 +08:00
parent 34565e6bf4
commit e8240a54a7
58 changed files with 1916 additions and 15048 deletions

View File

@ -370,7 +370,7 @@ export default {
getBargainDetail(that.bargainId)
.then(res => {
that.bargain = res.data.bargain;
that.datatime = that.bargain.stopTime;
that.datatime = that.bargain.stopTime / 1000;
that.getBargainHelpCount();
})
.catch(res => {
@ -573,32 +573,32 @@ page {
background-color: #eb3729;
}
.bargainBnt_hui {
font-size: 0.3*100rpx;
font-size: 0.3 * 100rpx;
font-weight: bold;
color: #fff;
width: 6*100rpx;
height: 0.8*100rpx;
border-radius: 0.4*100rpx;
width: 6 * 100rpx;
height: 0.8 * 100rpx;
border-radius: 0.4 * 100rpx;
background: #bbb;
text-align: center;
line-height: 0.8*100rpx;
margin-top: 0.32*100rpx;
line-height: 0.8 * 100rpx;
margin-top: 0.32 * 100rpx;
}
.bargain_view {
left:0;
right:0;
height: 0.48*100rpx;
left: 0;
right: 0;
height: 0.48 * 100rpx;
background: rgba(0, 0, 0, 0.5);
opacity: 1;
border-radius: 0 0 0.06*100rpx 0.06*100rpx;
border-radius: 0 0 0.06 * 100rpx 0.06 * 100rpx;
position: absolute;
bottom: 0;
font-size: 0.22*100rpx;
font-size: 0.22 * 100rpx;
color: #fff;
text-align: center;
line-height: 0.48*100rpx;
line-height: 0.48 * 100rpx;
}
.iconfonts {
font-size: 0.22*100rpx;
font-size: 0.22 * 100rpx;
}
</style>

View File

@ -1,8 +1,5 @@
<template>
<view class="group-list" ref="container">
<!-- <view class="header">
<image src="@/static/images/group.png" class="image" />
</view>-->
<view class="list" v-if="combinationList.length>0">
<view
class="item acea-row row-between-wrapper"

View File

@ -27,7 +27,7 @@
:hourText="' : '"
:minuteText="' : '"
:secondText="false"
:datatime="pinkT.stopTime"
:datatime="pinkT.stopTime/1000"
></count-down>
<text>结束</text>
</view>
@ -155,7 +155,8 @@ export default {
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
@ -239,8 +240,8 @@ export default {
</script>
<style lang="less">
.tips-warp{
text-align: center;
margin-top: 20rpx;
}
.tips-warp {
text-align: center;
margin-top: 20rpx;
}
</style>

View File

@ -245,11 +245,6 @@
that.$set(that, 'banner', res.data.banner);
that.$set(that, 'menus', res.data.menus);
that.$set(that, 'roll', res.data.roll);
that.$set(that, 'activity', res.data.activity);
if(res.data.activity){
var activityOne = res.data.activity.shift();
that.$set(that, 'activityOne', activityOne);
}
that.$set(that, 'info', res.data.info);
that.$set(that, 'firstList', res.data.firstList);
that.$set(that, 'bastList', res.data.bastList);
@ -269,6 +264,7 @@
}
},
goGoodSearch() {
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index');
this.$yrouter.push('/pages/shop/GoodSearch/index');
},
goWxappUrl(item) {

View File

@ -41,6 +41,12 @@
<view class="iconfont icon-jiantou"></view>
</view>
</view>
<div class="attribute acea-row row-between-wrapper">
<div>
运费:<span class="atterTxt">{{ tempName }}</span>
</div>
</div>
<view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">
<view>
<text>{{ attrTxt }}</text>
@ -268,6 +274,8 @@ export default {
systemStore: {},
qqmapsdk: null,
productConClass: "product-con",
tempName: '全国包邮'
};
},
computed: mapGetters(["isLogin", "location"]),
@ -356,6 +364,7 @@ export default {
that.reply = res.data.reply ? [res.data.reply] : [];
that.$set(that, "reply", that.reply);
that.$set(that, "priceName", res.data.priceName);
that.$set(that, "tempName", res.data.tempName);
that.posterData.image = that.storeInfo.image;
if (that.storeInfo.storeName.length > 30) {
that.posterData.title =

View File

@ -1,226 +1,199 @@
<template>
<view class="evaluate-con">
<view class="goodsStyle acea-row row-between" v-if="orderCon.productInfo">
<view class="pictrue">
<image :src="orderCon.productInfo.image" class="image" />
</view>
<view class="text acea-row row-between">
<view class="name line2">{{ orderCon.productInfo.storeName }}</view>
<view class="money">
<view>¥{{ orderCon.productInfo.price }}</view>
<view class="num">x{{ orderCon.cartNum }}</view>
</view>
</view>
</view>
<view class="score">
<view class="item acea-row row-middle" v-for="(item, scoreListIndexw) in scoreList" :key="scoreListIndexw">
<view>{{ item.name }}</view>
<view class="starsList">
<text @click="stars(starsIndexn, scoreListIndexw)" v-for="(itemn, starsIndexn) in item.stars" :key="starsIndexn"
class="iconfont" :class="
item.index >= starsIndexn
? 'icon-shitixing font-color-red'
: 'icon-kongxinxing'
"></text>
</view>
<text class="evaluate">
{{
item.index === -1 ? "" : item.index + 1 + "分"
}}
</text>
</view>
<view class="textarea">
<textarea placeholder="商品满足你的期待么?说说你的想法,分享给想买的他们吧~" v-model="expect"></textarea>
<view class="list acea-row row-middle">
<view class="pictrue" v-for="(item, uploadPicturesIndex) in uploadPictures" :key="uploadPicturesIndex">
<image :src="item" />
<text class="iconfont icon-guanbi1 font-color-red" @click="uploadPictures.splice(uploadPicturesIndex, 1)"></text>
</view>
<!-- <VueCoreImageUpload
class="btn btn-primary"
:crop="false"
compress="80"
@imageuploaded="imageuploaded"
:headers="headers"
:max-file-size="5242880"
:credentials="false"
inputAccept="image/*"
inputOfFile="file"
:url="url"
v-if="uploadPictures.length < 8"
<view class="evaluate-con">
<view class="goodsStyle acea-row row-between" v-if="orderCon.productInfo">
<view class="pictrue">
<image :src="orderCon.productInfo.image" class="image" />
</view>
<view class="text acea-row row-between">
<view class="name line2">{{ orderCon.productInfo.storeName }}</view>
<view class="money">
<view>{{ orderCon.productInfo.price }}</view>
<view class="num">x{{ orderCon.cartNum }}</view>
</view>
</view>
</view>
<view class="score">
<view
class="item acea-row row-middle"
v-for="(item, scoreListIndexw) in scoreList"
:key="scoreListIndexw"
>
<view>{{ item.name }}</view>
<view class="starsList">
<text
@click="stars(starsIndexn, scoreListIndexw)"
v-for="(itemn, starsIndexn) in item.stars"
:key="starsIndexn"
class="iconfont"
:class="item.index >= starsIndexn ? 'icon-shitixing font-color-red': 'icon-kongxinxing'"
></text>
</view>
<text class="evaluate">{{item.index === -1 ? "" : item.index + 1 + "分"}}</text>
</view>
<view class="textarea">
<textarea placeholder="商品满足你的期待么?说说你的想法,分享给想买的他们吧~" v-model="expect"></textarea>
<view class="list acea-row row-middle">
<view
class="pictrue"
v-for="(item, uploadPicturesIndex) in uploadPictures"
:key="uploadPicturesIndex"
>
<view
class="pictrue uploadBnt acea-row row-center-wrapper row-column"
>
<text class="iconfont icon-icon25201"></text>
<view>上传图片</view>
</view>
</VueCoreImageUpload>-->
</view>
</view>
<view class="evaluateBnt bg-color-red" @click="submit">立即评价</view>
</view>
</view>
<image :src="item" />
<text
class="iconfont icon-guanbi1 font-color-red"
@click="uploadPictures.splice(uploadPicturesIndex, 1)"
></text>
</view>
<view class="pictrue uploadBnt acea-row row-center-wrapper row-column" @tap="chooseImage">
<text class="iconfont icon-icon25201"></text>
<view>上传图片</view>
</view>
</view>
</view>
<view class="evaluateBnt bg-color-red" @click="submit">立即评价</view>
</view>
</view>
</template>
<style scoped lang="less">
.evaluate-con .score .textarea .list .pictrue.uploadBnt {
border: 1px solid #ddd;
}
.evaluate-con .score .textarea .list .pictrue.uploadBnt {
border: 1px solid #ddd;
}
</style>
<script>
import {
postOrderProduct,
postOrderComment
} from "@/api/store";
import {
trim
} from "@/utils";
import {
VUE_APP_API_URL
} from "@/config";
import {
required
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import { postOrderProduct, postOrderComment } from "@/api/store";
import { trim, chooseImage } from "@/utils";
import { VUE_APP_API_URL } from "@/config";
import { required } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
const NAME = "GoodsEvaluate";
const NAME = "GoodsEvaluate";
export default {
name: NAME,
components: {
// VueCoreImageUpload
},
props: {},
data: function() {
return {
orderCon: {
cartProduct: {
productInfo: {}
}
},
scoreList: [{
name: "商品质量",
stars: ["", "", "", "", ""],
index: -1
},
{
name: "服务态度",
stars: ["", "", "", "", ""],
index: -1
}
],
url: `${VUE_APP_API_URL}/api/qiNiuContent`,
headers: {
Authorization: "Bearer " + this.$store.state.token
},
uploadPictures: [],
expect: "",
unique: ""
};
},
mounted: function() {
this.unique = this.$yroute.query.id;
this.getOrderProduct();
},
watch: {
$yroute(n) {
if (n.name === NAME && this.unique !== n.params.id) {
this.unique = n.params.id;
this.$set(this.scoreList[0], "index", -1);
this.$set(this.scoreList[1], "index", -1);
this.expect = "";
this.uploadPictures = [];
this.getOrderProduct();
}
}
},
methods: {
getOrderProduct: function() {
let that = this,
unique = that.unique;
postOrderProduct(unique).then(res => {
that.orderCon = res.data;
});
},
stars: function(indexn, indexw) {
this.scoreList[indexw].index = indexn;
},
imageuploaded(res) {
if (res.errno !== 0) {
uni.showToast({
title: res.msg || "上传图片失败",
icon: 'none',
duration: 2000
});
return
}
this.uploadPictures.push(res.data[0]);
},
async submit() {
const expect = trim(this.expect),
product_score =
this.scoreList[0].index + 1 === 0 ? "" : this.scoreList[0].index + 1,
service_score =
this.scoreList[1].index + 1 === 0 ? "" : this.scoreList[1].index + 1;
try {
await this.$validator({
product_score: [
required("请选择商品质量分数", {
type: "number"
})
],
service_score: [
required("请选择服务态度分数", {
type: "number"
})
]
}).validate({
product_score,
service_score
});
} catch (e) {
return validatorDefaultCatch(e);
}
postOrderComment({
productScore: product_score,
serviceScore: service_score,
unique: this.unique,
pics: this.uploadPictures.join(","),
comment: expect
})
.then(() => {
uni.showToast({
title: "评价成功",
icon: "success",
duration: 2000
});
// ? 回跳到上一页
this.$yrouter.back()
// ? 默认跳转到详情页
// this.$yrouter.push({
// path: "/pages/order/OrderDetails/index",
// query: {
// id: this.orderCon.orderId
// }
// });
// ? 可选重定向到详情页,这时左上角会有一个返回首页的图标
// this.$yrouter.reLaunch({
// path: "/pages/home/index",
// });
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none',
duration: 2000
});
});
}
}
};
export default {
name: NAME,
components: {
// VueCoreImageUpload
},
props: {},
data: function() {
return {
orderCon: {
cartProduct: {
productInfo: {}
}
},
scoreList: [
{
name: "商品质量",
stars: ["", "", "", "", ""],
index: -1
},
{
name: "服务态度",
stars: ["", "", "", "", ""],
index: -1
}
],
uploadPictures: [],
expect: "",
unique: ""
};
},
mounted: function() {
this.unique = this.$yroute.query.id;
this.getOrderProduct();
},
watch: {
$yroute(n) {
if (n.name === NAME && this.unique !== n.params.id) {
this.unique = n.params.id;
this.$set(this.scoreList[0], "index", -1);
this.$set(this.scoreList[1], "index", -1);
this.expect = "";
this.uploadPictures = [];
this.getOrderProduct();
}
}
},
methods: {
getOrderProduct: function() {
let that = this,
unique = that.unique;
postOrderProduct(unique).then(res => {
that.orderCon = res.data;
});
},
stars: function(indexn, indexw) {
this.scoreList[indexw].index = indexn;
},
chooseImage() {
chooseImage(img => {
this.uploadPictures.push(img);
});
},
async submit() {
const expect = trim(this.expect),
product_score =
this.scoreList[0].index + 1 === 0 ? "" : this.scoreList[0].index + 1,
service_score =
this.scoreList[1].index + 1 === 0 ? "" : this.scoreList[1].index + 1;
try {
await this.$validator({
product_score: [
required("请选择商品质量分数", {
type: "number"
})
],
service_score: [
required("请选择服务态度分数", {
type: "number"
})
]
}).validate({
product_score,
service_score
});
} catch (e) {
return validatorDefaultCatch(e);
}
postOrderComment({
productScore: product_score,
serviceScore: service_score,
unique: this.unique,
pics: this.uploadPictures.join(","),
comment: expect
})
.then(() => {
uni.showToast({
title: "评价成功",
icon: "success",
duration: 2000
});
// ? 回跳到上一页
this.$yrouter.back();
// ? 默认跳转到详情页
// this.$yrouter.push({
// path: "/pages/order/OrderDetails/index",
// query: {
// id: this.orderCon.orderId
// }
// });
// ? 可选重定向到详情页,这时左上角会有一个返回首页的图标
// this.$yrouter.reLaunch({
// path: "/pages/home/index",
// });
})
.catch(err => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
}
}
};
</script>

View File

@ -1,57 +1,24 @@
<template>
<view class="personal-data">
<view class="wrapper">
<view class="title">管理我的账号</view>
<view class="wrapList">
<view
class="item acea-row row-between-wrapper"
:class="item.uid === userInfo.uid ? 'on' : ''"
v-for="(item, switchUserInfoIndex) in switchUserInfo"
:key="switchUserInfoIndex"
>
<view class="item acea-row row-between-wrapper on">
<view class="picTxt acea-row row-between-wrapper">
<view class="pictrue">
<!-- <VueCoreImageUpload
class="btn btn-primary"
:crop="false"
compress="80"
@imageuploaded="imageuploaded"
:headers="headers"
:max-file-size="5242880"
:credentials="false"
inputAccept="image/*"
inputOfFile="file"
:url="url"
ref="upImg"
v-if="item.uid === userInfo.uid"
>
<view class="pictrue">
<image :src="item.avatar" />
</view>
</VueCoreImageUpload>-->
<!-- <view class="pictrue" v-else>
<image :src="item.avatar" />
</view>-->
<image
src="@/static/images/alter.png"
class="alter"
v-if="item.uid === userInfo.uid"
/>
<view class="pictrue" @tap="chooseImage">
<div class="pictrue">
<img :src="avatar" />
</div>
<image src="@/static/images/alter.png" class="alter" />
</view>
<view class="text">
<view class="name line1">{{ item.nickname }}</view>
<view class="phone">绑定手机号{{ item.phone }}</view>
<view class="name line1">{{ userInfo.nickname }}</view>
<view class="phone">
绑定手机号
<text v-if="userInfo.phone">{{ userInfo.phone }}</text>
<text v-else>未绑定</text>
</view>
</view>
</view>
<view
class="currentBnt acea-row row-center-wrapper font-color-red"
v-if="item.uid === userInfo.uid"
>当前账号</view>
<view
class="bnt font-color-red acea-row row-center-wrapper"
v-else
@click="switchAccounts(index)"
>使用账号</view>
</view>
</view>
</view>
@ -82,23 +49,26 @@
<text>点击修改密码</text>
<text class="iconfont icon-suozi"></text>
</view>
</view> -->
</view>-->
</view>
<!--<view class="modifyBnt bg-color-red" @click="submit">保存修改</view>-->
<!-- <view
<view class="modifyBnt bg-color-red" @click="submit">保存修改</view>
<view
class="logOut cart-color acea-row row-center-wrapper"
@click="logout"
v-if="!isWeixin"
>
退出登录
</view>-->
v-if="$deviceType=='app'"
>退出登录</view>
</view>
</template>
<script>
import { mapGetters } from "vuex";
import { trim, isWeixin } from "@/utils";
import { trim, isWeixin, chooseImage } from "@/utils";
import { VUE_APP_API_URL } from "@/config";
import { postUserEdit, getLogout, switchH5Login, getUser } from "@/api/user";
import {
postUserEdit,
getLogout,
switchH5Login,
getUserInfo
} from "@/api/user";
import cookie from "@/utils/store/cookie";
import store from "@//store";
import dayjs from "dayjs";
@ -110,10 +80,6 @@ export default {
},
data: function() {
return {
url: `${VUE_APP_API_URL}/upload/image`,
headers: {
Authorization: "Bearer " + this.$store.state.token
},
avatar: "",
isWeixin: false,
currentAccounts: 0,
@ -156,7 +122,8 @@ export default {
.catch(err => {
uni.hideLoading();
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
@ -170,7 +137,7 @@ export default {
},
getUserInfo: function() {
let that = this;
getUser().then(res => {
getUserInfo().then(res => {
// let switchUserInfo = res.data.switchUserInfo;
// for (let i = 0; i < switchUserInfo.length; i++) {
// if (switchUserInfo[i].uid == that.userInfo.uid) that.userIndex = i;
@ -184,24 +151,18 @@ export default {
// that.$set(this, "switchUserInfo", switchUserInfo);
});
},
imageuploaded(res) {
if (res.status !== 200) {
uni.showToast({
title: res.msg || res.response.data.msg,
icon: "none",
duration: 2000
});
return;
}
if (this.switchUserInfo[this.userIndex] === undefined) return;
this.$set(this.switchUserInfo[this.userIndex], "avatar", res.data.url);
chooseImage() {
chooseImage(img => {
console.log(img)
this.avatar = img;
});
},
submit: function() {
let userInfo = this.switchUserInfo[this.userIndex];
let userInfo = this.userInfo;
postUserEdit({
nickname: trim(this.userInfo.nickname),
avatar: userInfo.avatar
avatar: this.avatar
}).then(
res => {
this.$store.dispatch("userInfo", true);
@ -214,7 +175,8 @@ export default {
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
@ -230,8 +192,10 @@ export default {
getLogout()
.then(res => {
this.$store.commit("logout");
clearAuthStatus();
location.href = location.origin;
this.$yrouter.replace({
path: "/pages/user/Login/index",
query: {}
});
})
.catch(err => {});
} else if (res.cancel) {

View File

@ -117,11 +117,7 @@
<view class="myService">
<view class="serviceList acea-row row-middle">
<template v-for="(item, MyMenusIndex) in MyMenus">
<view
class="item"
:key="MyMenusIndex"
@click="goPages(MyMenusIndex)"
>
<view class="item" :key="MyMenusIndex" @click="goPages(MyMenusIndex)">
<view class="pictrue">
<image :src="item.pic" />
</view>
@ -133,19 +129,9 @@
<view class="pictrue"></view>
<view class="cell">hexiao</view>
<text class="iconfont icon-jiantou"></text>
</view> -->
</view>-->
</view>
</view>
<!--<view -->
<!--class="item"-->
<!--@click="changeswitch(true)"-->
<!--v-if="userInfo.phone && isWeixin"-->
<!--&gt;-->
<!--<view class="pictrue"><image src="@/static/images/switch.png" /></view>-->
<!--<view>账号切换</!--<view>-->
<!--</!--<view>-->
<!-- </view>
</view>-->
</view>
<view class="by">
<view>
@ -163,7 +149,7 @@
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
import { getUser, getMenuUser, bindingPhone } from "@/api/user";
import { getUserInfo, getMenuUser, bindingPhone } from "@/api/user";
import { isWeixin, VUE_APP_RESOURCES_URL } from "@/utils";
import SwitchWindow from "@/components/SwitchWindow";
import Authorization from "@/pages/authorization/index";
@ -283,7 +269,7 @@ export default {
},
User: function() {
let that = this;
getUser().then(res => {
getUserInfo().then(res => {
that.user = res.data;
that.orderStatusNum = res.data.orderStatusNum;
});

View File

@ -12,29 +12,13 @@
<view class="item acea-row row-between-wrapper">
<view class="name">所在地区</view>
<view class="picker acea-row row-between-wrapper select-value form-control">
<view class="address" @tap="openAddres">
<!-- <picker
@columnchange="addRessColumnchange"
@change="changeAddress"
range-key="name"
mode="multiSelector"
:range="district"
>
<text class="uni-input" v-if="model2">{{model2}}</text>
<text class="uni-input" v-else>请选择地区</text>
</picker>-->
<text class="uni-input">{{model2||'请选择'}}</text>
<simple-address
ref="simpleAddress"
:pickerValueDefault="cityPickerValueDefault"
@onConfirm="onConfirm"
themeColor="#007AFF"
></simple-address>
<!-- <view slot="right" @click.stop="show2 = true">{{ model2 || "请选择收货地址" }}</view> -->
<!-- <vant-popup :show="show2" position="bottom" @close="closeaArea">
<vant-area :area-list="district" columns-num="3" :columns-placeholder="['请选择', '请选择', '请选择']" title="请选择"
@confirm="result2" />
</vant-popup>-->
<view class="address">
<CitySelect
ref="cityselect"
:defaultValue="addressText"
@callback="result"
:items="district"
></CitySelect>
</view>
<view class="iconfont icon-dizhi font-color-red"></view>
</view>
@ -57,92 +41,63 @@
</view>
</view>
<view></view>
<view class="keepBnt bg-color-red" @click="submit">立即保存</view>
<view class="keepBnt bg-color-red" @tap="submit">立即保存</view>
<view class="wechatAddress" v-if="isWechat && !id" @click="getAddress">导入微信地址</view>
</view>
</template>
<script type="text/babel">
// import { CitySelect } from "vue-ydui/dist/lib.rem/cityselect";
// import District from "@/utils/area";
import simpleAddress from "@/components/simple-address/simple-address.nvue";
import { getAddress, postAddress, district } from "@/api/user";
import CitySelect from "@/components/CitySelect";
import { getAddress, postAddress, getCity } from "@/api/user";
import attrs, { required, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
// import { openAddress } from "@/libs/wechat";
import { isWeixin } from "@/utils";
export default {
name: "AddAddress",
components: {
// CitySelect
simpleAddress
CitySelect
},
data() {
return {
show2: false,
model2: "",
districts: [],
district: [],
id: 0,
userAddress: { isDefault: 0 },
address: {},
isWechat: isWeixin(),
selectAddressValue: null,
cityPickerValueDefault: [0, 0, 1],
pickerText: ""
addressText: ""
};
},
mounted: function() {
let id = this.$yroute.query.id;
this.id = id;
// document.title = !id ? "添加地址" : "修改地址";
this.getUserAddress();
district().then(res => {
// city_list 市
// county_list 区
// province_list 省
this.districts = res.data;
});
this.getCityList();
},
watch: {
addressText(nextModel2) {
console.log(nextModel2, 8585858585);
}
},
methods: {
openAddres() {
// 根据 label 获取
if (this.address.province) {
// 这个插件有个问题,直辖市的 city 必须得是 市辖区
try {
let str = "市";
let city = this.address.city;
if (this.address.province.indexOf(str) != -1) {
city = "市辖区";
}
var index = this.$refs.simpleAddress.queryIndex(
[this.address.province, city, this.address.district],
"label"
);
this.cityPickerValueDefault = index.index;
} catch (error) {}
}
this.$refs.simpleAddress.open();
// var index = this.$refs.simpleAddress.queryIndex(
// [13, 1302, 130203],
// "value"
// );
// this.cityPickerValueDefault = index.index;
// this.$refs.simpleAddress.open();
},
onConfirm(e) {
this.pickerText = JSON.stringify(e);
this.model2 = e.label;
this.address.province = e.labelArr[0] || "";
this.address.city = e.labelArr[1] || "";
this.address.district = e.labelArr[2] || "";
getCityList: function() {
let that = this;
getCity()
.then(res => {
that.district = res.data;
that.ready = true;
})
.catch(err => {
that.$dialog.error(err.msg);
});
},
getUserAddress: function() {
if (!this.id) return false;
let that = this;
getAddress(that.id).then(res => {
that.userAddress = res.data;
that.model2 =
that.addressText =
res.data.province + " " + res.data.city + " " + res.data.district;
that.address.province = res.data.province;
that.address.city = res.data.city;
@ -151,9 +106,12 @@ export default {
},
getAddress() {},
async submit() {
console.log(this);
console.log(this.address);
console.log(this.addressText);
let name = this.userAddress.realName,
phone = this.userAddress.phone,
model2 = this.model2,
addressText = this.addressText,
detail = this.userAddress.detail,
isDefault = this.userAddress.isDefault;
try {
@ -166,9 +124,9 @@ export default {
required(required.message("联系电话")),
chs_phone(chs_phone.message())
],
model2: [required("请选择地址")],
addressText: [required("请选择地址")],
detail: [required(required.message("具体地址"))]
}).validate({ name, phone, model2, detail });
}).validate({ name, phone, addressText, detail });
} catch (e) {
return validatorDefaultCatch(e);
}
@ -204,7 +162,7 @@ export default {
});
} catch (err) {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
@ -213,17 +171,17 @@ export default {
ChangeIsDefault: function() {
this.userAddress.isDefault = !this.userAddress.isDefault;
},
closeaArea() {
this.show2 = false;
},
result2(ret) {
let values = ret.mp.detail.values;
this.closeaArea();
this.address.province = values[0].name || "";
this.address.city = values[1].name || "";
this.address.district = values[2].name || "";
this.model2 =
this.address.province + this.address.city + this.address.district;
result(values) {
console.log(this);
console.log(values);
this.address = {
province: values.province.name || "",
city: values.city.name || "",
district: values.district.name || ""
};
this.addressText = `${this.address.province}${this.address.city}${this.address.district}`;
// this.addressText =
// this.address.province + this.address.city + this.address.district;
}
}
};