门店
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
<template>
|
||||
<div class="myStoreList">
|
||||
<div class="item" @click="toStoreForm">
|
||||
<div class="item" @click="toStoreForm(item.id)" v-for="(item, index) in list" :key="index">
|
||||
<div class="top-flex">
|
||||
<div class="name">小荣超市11111</div>
|
||||
<img src="https://cdn.cunwuyun.cn/dvcp/credit/head.png" alt="">
|
||||
<div class="name">{{ item.shopName }}</div>
|
||||
<img :src="item.fileUrl" alt="">
|
||||
</div>
|
||||
<div class="address">麒麟区南宁街道潇湘社区</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="top-flex">
|
||||
<div class="name">小荣超市11111</div>
|
||||
<img src="https://cdn.cunwuyun.cn/dvcp/credit/head.png" alt="">
|
||||
</div>
|
||||
<div class="address">麒麟区南宁街道潇湘社区</div>
|
||||
<div class="address">{{ item.address }}</div>
|
||||
</div>
|
||||
<AiEmpty v-if="!list.length" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -24,14 +18,39 @@ export default {
|
||||
appName: '我的门店',
|
||||
data() {
|
||||
return {
|
||||
|
||||
list: [],
|
||||
current: 1,
|
||||
pages: 2
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getShopList()
|
||||
},
|
||||
methods: {
|
||||
toStoreForm() {
|
||||
uni.navigateTo({url: './storeForm'})
|
||||
getShopList() {
|
||||
if(this.current > this.pages) return
|
||||
this.$loading()
|
||||
this.$instance.post(`/app/appshoparchives/list`, null, {
|
||||
params: {
|
||||
current: this.current,
|
||||
size: 15,
|
||||
}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.list = this.current == 1 ? list : [this.list, list].flat()
|
||||
this.pages = res.data.total
|
||||
}
|
||||
}).finally(() => uni.hideLoading())
|
||||
},
|
||||
toStoreForm(id) {
|
||||
uni.navigateTo({url: `./storeForm?shopId=${id}`})
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.current ++
|
||||
this.getShopList()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
<div class="item">
|
||||
<div class="top-flex">
|
||||
<div class="name">门店照</div>
|
||||
<div class="right">
|
||||
<img src="https://cdn.cunwuyun.cn/dvcp/credit/head.png" alt="">
|
||||
<div class="right" @click="uploadImg">
|
||||
<img :src="detailInfo.fileUrl" alt="">
|
||||
<u-icon name="arrow-right" color="#999" size="22"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line-flex">
|
||||
<div class="label">门店名称</div>
|
||||
<div class="value">
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="form.name"
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="detailInfo.shopName"
|
||||
placeholder-style="color:#999;font-size: 14px;" height="36"></u-input>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="line-flex">
|
||||
<div class="label">经营类型</div>
|
||||
<div class="value">
|
||||
111<u-icon name="arrow-right" color="#999" size="22"></u-icon>
|
||||
{{ $dict.getLabel('operatorType', detailInfo.operatorType) }}<u-icon name="arrow-right" color="#999" size="22"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,29 +29,44 @@
|
||||
<div class="line-flex solid">
|
||||
<div class="label">经营者姓名</div>
|
||||
<div class="value">
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="form.name"
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="detailInfo.name"
|
||||
placeholder-style="color:#999;font-size: 14px;" height="36"></u-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line-flex solid">
|
||||
<div class="line-flex">
|
||||
<div class="label">联系电话</div>
|
||||
<div class="value">
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="form.name"
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="detailInfo.phone"
|
||||
placeholder-style="color:#999;font-size: 14px;" height="36"></u-input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="line-flex solid">
|
||||
<div class="label">地址</div>
|
||||
<div class="label">门店住址</div>
|
||||
<div class="value">
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="form.name"
|
||||
<AiAreaPicker class="ai-area" v-model="detailInfo.areaId" :areaId="$areaId" :fullName.sync="detailInfo.areaName">
|
||||
<div class="ai-area__wrapper">
|
||||
<span :style="detailInfo.areaName ? '' : 'color: #999'">{{ detailInfo.areaName || '请选择'}}</span>
|
||||
<u-icon name="arrow-right" color="#999" size="22"></u-icon>
|
||||
</div>
|
||||
</AiAreaPicker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line-flex">
|
||||
<div class="label">详细地址</div>
|
||||
<div class="value">
|
||||
<u-input trim placeholder="请输入" input-align="right" v-model="detailInfo.address"
|
||||
placeholder-style="color:#999;font-size: 14px;" height="36"></u-input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="footer" @click="submit">
|
||||
<div class="btn">提交</div>
|
||||
</div>
|
||||
<u-select v-model="showOperatorType" :list="$dict.getDict('operatorType')" value-name="dictValue"
|
||||
label-name="dictName" @confirm="confirmOperatorType"></u-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -64,45 +79,53 @@ export default {
|
||||
return {
|
||||
form: {
|
||||
name : ''
|
||||
}
|
||||
},
|
||||
|
||||
shopId: '',
|
||||
detailInfo: {},
|
||||
showOperatorType: false
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.shopId = e.shopId
|
||||
this.$dict.load(['operatorType']).then(() => {
|
||||
// this.getDetail()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
upload() {
|
||||
if (!this.token) {
|
||||
this.$refs.login.show()
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this.imgList = []
|
||||
this.hideStatus = false
|
||||
uni.chooseImage({
|
||||
count: this.limit,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
getDetail() {
|
||||
this.$instance.post(`/app/appshoparchives/queryDetailById?id=${this.shopId}`).then(res => {
|
||||
if (res?.data) {
|
||||
this.detailInfo = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
confirmOperatorType(e) {
|
||||
this.detailInfo.operatorType = e[0].value
|
||||
},
|
||||
submit() {
|
||||
this.$instance.post(`/app/appshoparchives/addOrUpdate?id=${this.shopId}`).then(res => {
|
||||
if (res?.data) {
|
||||
this.detailInfo = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
uploadImg() {
|
||||
console.log(123)
|
||||
uni.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
success: (res) => {
|
||||
if (res.tempFilePaths.length > 9) {
|
||||
this.$toast(`图片不能超过9张`)
|
||||
|
||||
if (res.tempFilePaths.length > 1) {
|
||||
this.$toast(`门店头像不能超过1张`)
|
||||
return false
|
||||
}
|
||||
|
||||
this.$loading('上传中')
|
||||
res.tempFilePaths.forEach((item, index) => {
|
||||
if (index === res.tempFilePaths.length - 1) {
|
||||
this.hideStatus = true
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.uploadFile(item, res.tempFilePaths.length)
|
||||
})
|
||||
})
|
||||
this.uploadFile(res.tempFilePaths[0])
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
uploadFile(img, total) {
|
||||
uploadFile(img) {
|
||||
uni.uploadFile({
|
||||
url: this.$instance.defaults.baseURL + '/admin/file/add',
|
||||
filePath: img,
|
||||
@@ -112,33 +135,8 @@ export default {
|
||||
Authorization: uni.getStorageSync('token'),
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data)
|
||||
|
||||
if (data.code === 0) {
|
||||
this.imgList.push(data.data[0].split(';')[0])
|
||||
} else {
|
||||
this.$toast(data.msg)
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
this.$nextTick(() => {
|
||||
if (this.imgList.length === total && this.hideStatus) {
|
||||
this.$instance.post(`/app/appvillagepicturealbum/addPictures`, {
|
||||
areaName: uni.getStorageSync('areaName'),
|
||||
areaId: uni.getStorageSync('areaId'),
|
||||
type: this.type,
|
||||
urlList: this.imgList
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.getList(this.type)
|
||||
this.getTotalInfo(this.type)
|
||||
uni.$emit('update')
|
||||
}
|
||||
this.$hideLoading()
|
||||
this.hideStatus = false
|
||||
})
|
||||
}
|
||||
})
|
||||
this.detailInfo.fileUrl = JSON.parse(res.data).data[0].split(';')[0]
|
||||
this.$hideLoading()
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -225,5 +223,11 @@ export default {
|
||||
u-icon {
|
||||
margin-left: 16px;
|
||||
}
|
||||
.ai-area__wrapper {
|
||||
span {
|
||||
display: inline-block;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user