394 lines
10 KiB
Vue
394 lines
10 KiB
Vue
<template>
|
|
<view class="shop-1-container">
|
|
<!-- <u-loading-page
|
|
:loading="showLodingPage"
|
|
font-size="18"
|
|
icon-size="30"
|
|
loading-text="加载中,请稍等..."
|
|
></u-loading-page> -->
|
|
<u-navbar
|
|
:autoBack="true"
|
|
:safeAreaInsetTop="true"
|
|
title="填写店铺信息第1步 / 共3步"
|
|
>
|
|
<template slot="right">
|
|
<view class="btn-login-out" @click="loginOut">退出登录</view>
|
|
</template>
|
|
</u-navbar>
|
|
<u-form :model="form" class="form" ref="uForm" label-width="70">
|
|
<u-form-item label="联系人" prop="contact_name" required>
|
|
<u-input
|
|
class="form-input"
|
|
v-model="form.contact_name"
|
|
placeholder="请输入联系人"
|
|
/>
|
|
</u-form-item>
|
|
<u-form-item
|
|
label="经营品类"
|
|
prop="biz_category"
|
|
required
|
|
@click="skipuBsType"
|
|
>
|
|
<u-input
|
|
style="pointer-events: none"
|
|
class="form-input"
|
|
v-model="form.biz_category"
|
|
placeholder="请选择经营品类"
|
|
readonly
|
|
/>
|
|
<u-icon
|
|
style="display: inline-block; margin-left: 8rpx"
|
|
name="arrow-right"
|
|
size="12"
|
|
color="#aaaaaa"
|
|
></u-icon>
|
|
</u-form-item>
|
|
<u-form-item label="门店名称" prop="store_name" required>
|
|
<u-input
|
|
class="form-input"
|
|
v-model="form.store_name"
|
|
placeholder="请输入门店名称"
|
|
/>
|
|
</u-form-item>
|
|
<u-form-item
|
|
label="地图地址"
|
|
prop="mapAddress"
|
|
required
|
|
@click="shkipuSelectAddress"
|
|
>
|
|
<u-input
|
|
style="pointer-events: none"
|
|
class="form-input"
|
|
v-model="form.mapAddress"
|
|
placeholder="请在地图上选择门店地址"
|
|
readonly
|
|
/>
|
|
<u-icon
|
|
style="display: inline-block; margin-left: 8rpx"
|
|
name="arrow-right"
|
|
size="12"
|
|
color="aaaaaa"
|
|
></u-icon>
|
|
</u-form-item>
|
|
<u-form-item label="详细地址" prop="store_address" required>
|
|
<u-input
|
|
class="form-input"
|
|
v-model="form.store_address"
|
|
@input="handleStoreAddressInput"
|
|
placeholder="详细地址:如:人民大道205号2楼213"
|
|
/>
|
|
</u-form-item>
|
|
<u-form-item label="门脸图" prop="storefrontImg">
|
|
<u-upload
|
|
:class="fileList.length == 0 ? 'shop1-upload' : 'shop1-upload-item'"
|
|
@afterRead="afterRead1"
|
|
@delete="deletePic1"
|
|
accept="image"
|
|
:fileList="fileList"
|
|
:max-count="1"
|
|
:width="'100%'"
|
|
:height="154"
|
|
:upload-text="'点击上传'"
|
|
>
|
|
</u-upload>
|
|
</u-form-item>
|
|
<u-form-item label="环境图" prop="surroundingsImg">
|
|
<u-upload
|
|
:class="fileList2.length == 0 ? 'shop2-upload' : 'shop2-upload-item'"
|
|
@afterRead="afterRead2"
|
|
@delete="deletePic2"
|
|
accept="image"
|
|
:fileList="fileList2"
|
|
:max-count="1"
|
|
:width="'100%'"
|
|
:height="154"
|
|
:upload-text="'点击上传'"
|
|
>
|
|
</u-upload>
|
|
</u-form-item>
|
|
</u-form>
|
|
<view class="btn-content">
|
|
<u-button class="btn-next" @click="handleNext">下一步</u-button>
|
|
</view>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import { UploadFilePromise } from "../../api/upload";
|
|
export default {
|
|
data() {
|
|
return {
|
|
showLodingPage: true,
|
|
manageTypeItem: {},
|
|
form: {
|
|
biz_category: "",
|
|
shopAddress: "",
|
|
mapAddress: "",
|
|
store_address: "",
|
|
storefrontImg: "",
|
|
surroundingsImg: "",
|
|
},
|
|
fileList: [],
|
|
fileList2: [],
|
|
rules: {
|
|
contact_name: [
|
|
{
|
|
required: true,
|
|
message: "请输入联系人",
|
|
// 可以单个或者同时写两个触发验证方式
|
|
trigger: ["change", "blur"],
|
|
},
|
|
],
|
|
type: [
|
|
{
|
|
required: true,
|
|
message: "请选择经营类型",
|
|
trigger: ["change", "blur"],
|
|
},
|
|
],
|
|
store_name: [
|
|
{
|
|
required: true,
|
|
message: "请输入门店名称",
|
|
trigger: ["change", "blur"],
|
|
},
|
|
],
|
|
mapAddress: [
|
|
{
|
|
required: true,
|
|
message: "请在地图上选择门店地址",
|
|
trigger: ["change", "blur"],
|
|
},
|
|
],
|
|
store_address: [
|
|
{
|
|
required: true,
|
|
message: "请输入详细地址",
|
|
trigger: ["change", "blur"],
|
|
},
|
|
],
|
|
},
|
|
};
|
|
},
|
|
onShow() {
|
|
let typeItem = uni.getStorageSync("typeItem");
|
|
|
|
if (typeItem) {
|
|
this.manageTypeItem = typeItem;
|
|
this.form.biz_category = typeItem.bizSecondCategory.name;
|
|
}
|
|
|
|
let locationItem = uni.getStorageSync("locationItem");
|
|
|
|
if (locationItem) {
|
|
this.form.mapAddress =
|
|
locationItem.administrativeRegion.label[0] +
|
|
locationItem.administrativeRegion.label[1] +
|
|
locationItem.administrativeRegion.label[2];
|
|
|
|
this.form.store_address = locationItem.selectAddress.name;
|
|
}
|
|
},
|
|
onReady() {
|
|
this.$refs["uForm"].setRules(this.rules);
|
|
},
|
|
methods: {
|
|
async afterRead1(e) {
|
|
const item = e.file;
|
|
const imgUrl = item.url;
|
|
const group = {
|
|
url: imgUrl,
|
|
};
|
|
|
|
this.fileList.push(group);
|
|
|
|
let res = await UploadFilePromise(imgUrl);
|
|
if (res && res.status == 200) {
|
|
this.form.storefrontImg = res.data.url;
|
|
}
|
|
},
|
|
async afterRead2(e) {
|
|
const item = e.file;
|
|
const imgUrl = item.url;
|
|
const group = {
|
|
url: imgUrl,
|
|
};
|
|
this.fileList2.push(group);
|
|
|
|
let res = await UploadFilePromise(imgUrl);
|
|
if (res && res.status == 200) {
|
|
this.form.surroundingsImg = res.data.url;
|
|
}
|
|
},
|
|
deletePic1() {
|
|
this.fileList.splice(0, 1);
|
|
},
|
|
deletePic2() {
|
|
this.fileList2.splice(0, 1);
|
|
},
|
|
formItemClass() {
|
|
return this.form.shopAddress > 0 ? "" : "shop1-from-item";
|
|
},
|
|
skipuBsType() {
|
|
uni.navigateTo({
|
|
url: "/pages/audit/businessType",
|
|
});
|
|
},
|
|
shkipuSelectAddress() {
|
|
uni.navigateTo({
|
|
url: "/pages/audit/mapAddress",
|
|
});
|
|
},
|
|
handleStoreAddressInput(e) {
|
|
setTimeout(() => {
|
|
let locationItem = uni.getStorageSync("locationItem");
|
|
locationItem.selectAddress.name = e;
|
|
uni.setStorageSync("locationItem", locationItem);
|
|
}, 600);
|
|
},
|
|
handleNext() {
|
|
this.$refs.uForm.validate().then((valid) => {
|
|
if (valid) {
|
|
if (!this.form.storefrontImg) {
|
|
this.$refs.uToast.show({
|
|
message: "请上传门脸图",
|
|
type: "error",
|
|
duration: 1000,
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!this.form.surroundingsImg) {
|
|
this.$refs.uToast.show({
|
|
message: "请上传环境图",
|
|
type: "error",
|
|
duration: 1000,
|
|
});
|
|
return;
|
|
}
|
|
|
|
var params = {};
|
|
|
|
let userInfo = uni.getStorageSync("userInfo");
|
|
let locationItem = uni.getStorageSync("locationItem");
|
|
|
|
// userInfo.user_mobile = userInfo.user_mobile.slice(2);
|
|
|
|
let isContain = userInfo.user_mobile.indexOf("86");
|
|
|
|
if (isContain != -1 && userInfo.user_mobile.length > 11) {
|
|
params.mobile = userInfo.user_mobile.slice(2);
|
|
} else {
|
|
params.mobile = userInfo.user_mobile;
|
|
}
|
|
|
|
let auditItem = {
|
|
login_mobile: userInfo.user_mobile,
|
|
store_name: this.form.store_name,
|
|
contact_name: this.form.contact_name,
|
|
biz_category: this.manageTypeItem.bizCategory.id,
|
|
biz_second_category: this.manageTypeItem.bizSecondCategory.id,
|
|
store_longitude: locationItem.selectAddress.location.lng,
|
|
store_latitude: locationItem.selectAddress.location.lat,
|
|
province_id: locationItem.administrativeRegion.value[0],
|
|
city_id: locationItem.administrativeRegion.value[1],
|
|
county_id: locationItem.administrativeRegion.value[2],
|
|
store_address:
|
|
locationItem.administrativeRegion.label[0] +
|
|
locationItem.administrativeRegion.label[1] +
|
|
locationItem.administrativeRegion.label[2] +
|
|
this.form.store_address,
|
|
front_facade_image: this.form.storefrontImg,
|
|
environment_image: this.form.surroundingsImg,
|
|
};
|
|
|
|
console.log(auditItem);
|
|
|
|
uni.setStorageSync("auditItem", auditItem);
|
|
|
|
uni.navigateTo({
|
|
url: "/pages/audit/shop2",
|
|
});
|
|
}
|
|
});
|
|
},
|
|
loginOut() {
|
|
this.$store.dispatch("user/LoginOut");
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.shop-1-container {
|
|
// background: #f2f2f2;
|
|
// height: 100vh;
|
|
|
|
.u-navbar {
|
|
height: 88rpx;
|
|
}
|
|
|
|
.form {
|
|
padding: 0 36rpx;
|
|
background: #fff;
|
|
border-top: 1px solid #f2f2f2;
|
|
.u-form-item__body__right {
|
|
}
|
|
|
|
/deep/.shop1-from-item {
|
|
.u-form-item__body__right {
|
|
.uni-input-wrapper {
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
/deep/.shop1-upload {
|
|
.u-upload__button {
|
|
// background: url("../../static/shenhe-bg1.png");
|
|
background-image: url("../../static/shenhe-bg1.png");
|
|
background-size: 100% 100%;
|
|
}
|
|
}
|
|
|
|
/deep/.shop1-upload-item {
|
|
.u-upload__wrap {
|
|
flex-direction: column !important;
|
|
flex-wrap: nowrap !important;
|
|
}
|
|
}
|
|
|
|
/deep/.shop2-upload-item {
|
|
.u-upload__wrap {
|
|
flex-direction: column !important;
|
|
flex-wrap: nowrap !important;
|
|
}
|
|
}
|
|
|
|
/deep/.shop2-upload {
|
|
.u-upload__button {
|
|
// background: url("../../static/shenhe-bg1.png");
|
|
background-image: url("../../static/shenhe-bg2.png");
|
|
background-size: 100% 100%;
|
|
}
|
|
}
|
|
}
|
|
|
|
.btn-content {
|
|
bottom: 40rpx;
|
|
width: 94%;
|
|
padding: 48rpx 24rpx;
|
|
}
|
|
|
|
.btn-next {
|
|
border-radius: 24rpx;
|
|
background: #4b71ff;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-login-out {
|
|
font-size: 28rpx;
|
|
color: #4b71ff;
|
|
}
|
|
}
|
|
</style> |