This commit is contained in:
yanran200730
2022-11-08 18:10:21 +08:00
parent ecd44a3c78
commit 77755d0298
10 changed files with 548 additions and 210 deletions

View File

@@ -26,7 +26,7 @@ export default {
<style lang="scss" scoped>
.emptyWrap {
width: 100vw;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;

View File

@@ -18,6 +18,6 @@
"desc": "你的位置信息将用于当前事件发生地点"
}
},
"requiredPrivateInfos" : ["getLocation"]
"requiredPrivateInfos" : ["getLocation", "chooseLocation"]
}
}

View File

@@ -283,7 +283,7 @@ import { mapActions, mapState } from 'vuex'
}
})
},
@click="preview(item.accessUrl)"
toAddress () {
wx.openLocation({
latitude: this.info.lat,

View File

@@ -0,0 +1,321 @@
<template>
<div class="AddMerchants">
<image class="banner" mode="aspectFill" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/rz.jpg" />
<div class="form">
<div class="form-item">
<h2>商家名称</h2>
<div class="right">
<input placeholder="请输入商家名称" v-model="merchantName" :disabled="isAdd" />
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
</div>
</div>
<div class="form-item">
<h2>地理位置</h2>
<div class="right" @click="chooseLocation" hover-class="text-hover">
<span :style="{color: address ? '#333' : '#999'}">{{ address ? address : '请选择地理位置' }}</span>
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
</div>
</div>
</div>
<div class="upload">
<h2>门店照片</h2>
<div class="upload-wrapper">
<div class="add" @click="upLoad" v-if="!photoUrl">
<div></div>
<span>添加照片</span>
</div>
<div class="imgs" v-else>
<image :src="photoUrl" mode="aspectFill" @click="prev" />
<image class="remove" @click.stop="photoUrl = ''" v-if="!isAdd" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/close_release.png" />
</div>
</div>
</div>
<div class="btn-wrapper">
<div class="btn" hover-class="text-hover" :style="{background: isAdd ? 'rgba(45, 125, 255, 0.5)' : '#2D7DFF'}" @click="save">{{ isAdd ? '审核中' : '提交申请' }}</div>
</div>
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
name: 'AddMerchants',
appName: '商家入驻',
data () {
return {
address: '',
lat: '',
lng: '',
merchantName: '',
photoUrl: '',
isAdd: false
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad () {
if (!this.token) {
this.autoLogin()
} else {
this.getUserInfo().then(() => {
if (this.user.merchantInfo) {
if (this.user.merchantInfo.status === '0') {
this.isAdd = true
}
this.address = this.user.merchantInfo.address
this.lat = this.user.merchantInfo.lat
this.lng = this.user.merchantInfo.lng
this.merchantName = this.user.merchantInfo.merchantName
this.photoUrl = this.user.merchantInfo.photoUrl
}
})
}
},
methods: {
...mapActions(['autoLogin', 'getUserInfo']),
chooseLocation () {
if (this.isAdd) {
return false
}
uni.chooseLocation({
success: res => {
this.address = res.name
this.lat = res.latitude
this.lng = res.longitude
},
fail: err => {
console.log(err)
}
})
},
upLoad () {
if (this.isAdd) {
return false
}
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
this.$loading('上传中')
uni.uploadFile({
url: this.$instance.defaults.baseURL + (process.env.NODE_ENV == 'production' ? 'api' : '') + '/file/add',
filePath: res.tempFilePaths[0],
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token'),
},
success: (res) => {
const data = JSON.parse(res.data)
console.log(data)
if (data.code === 0) {
this.photoUrl = data.data[0].split(';')[0]
} else {
this.$toast(data.msg)
}
},
complete: () => {
uni.hideLoading()
}
})
},
})
},
prev () {
wx.previewImage({
current: this.photoUrl,
urls: [this.photoUrl]
})
},
save () {
if (!this.merchantName) {
return this.$toast('请输入商家名称')
}
if (!this.address) {
return this.$toast('请选择商家地址')
}
if (!this.photoUrl) {
return this.$toast('请上传门店照片')
}
if (this.isAdd) {
return false
}
this.$loading()
this.$instance.post('/api/appmerchantinfo/addOrUpdate', {
merchantName: this.merchantName,
address: this.address,
photoUrl: this.photoUrl,
lat: this.lat,
lng: this.lng,
openId: this.user.openId
}).then(res => {
uni.hideLoading()
if (res.code === 0) {
this.$dialog.alert({
title: '温馨提示',
content: '提交申请成功,请等待后台审核!'
}).then(() => {
wx.navigateBack()
})
}
})
},
}
}
</script>
<style lang="scss" scoped>
.AddMerchants {
padding: 32px 32px 130px;
.banner {
width: 100%;
height: 240px;
border-radius: 32px;
}
.form {
margin: 32px 0;
padding: 0 32px;
box-shadow: inset 0 0 0 0 #EEEEEE;
border-radius: 32px;
background: #fff;
.form-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 128px;
&:first-child {
border-bottom: 1px solid #EEEEEE;
}
h2 {
font-size: 30px;
color: #666666;
}
.right {
display: flex;
align-items: center;
span, input {
color: #333333;
font-size: 30px;
}
input {
text-align: right;
}
image {
width: 32px;
height: 32px;
}
}
}
}
.upload {
padding: 32px;
background: #FFFFFF;
border-radius: 32px;
box-shadow: inset 0 0 0 0 #EEEEEE;
h2 {
margin-bottom: 24px;
font-size: 30px;
color: #666666;
}
.imgs {
position: relative;
width: 216px;
height: 216px;
border-radius: 8px;
image {
width: 216px;
height: 216px;
border-radius: 8px;
}
.remove {
position: absolute;
top: 0%;
right: 0%;
width: 36px;
height: 36px;
transform: translate(50%, -50%);
}
}
.add {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
width: 216px;
height: 216px;
background: #EFF5FA;
border-radius: 8px;
span {
margin-top: 16px;
font-size: 26px;
color: #999999;
}
div {
position: relative;
width: 64px;
height: 64px;
border-radius: 50%;
background: #FFFFFF;
&:after {
position: absolute;
top: 50%;
left: 50%;
width: 4px;
height: 32px;
background: #333333;
border-radius: 4px;
transform: translate(-50%, -50%);
content: ' ';
}
&::before {
position: absolute;
top: 50%;
left: 50%;
width: 32px;
height: 4px;
background: #333333;
border-radius: 4px;
transform: translate(-50%, -50%);
content: ' ';
}
}
}
}
}
</style>

View File

@@ -27,7 +27,11 @@
<span>文明榜单</span>
</div>
</div>
<image class="banner" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/banner.png" />
<swiper class="banner" indicatorDots circular :autoplay="true" :interval="5000">
<swiper-item v-for="(item, index) in bannerList" :key="index">
<image :src="item.imgUrl" mode="aspectFill" />
</swiper-item>
</swiper>
<div class="section yh">
<h2>商家优惠</h2>
<div class="yh-list">
@@ -40,14 +44,14 @@
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
<div class="more" @click="$linkTo('./Store')" hover-class="text-hover">查看更多优惠</div>
<div class="more" v-if="list.length" @click="$linkTo('./Store')" hover-class="text-hover">查看更多优惠</div>
</div>
<div class="section rz">
<div class="section rz" v-if="!user.merchantInfo || user.merchantInfo.status !== '1'" >
<h2>商家入驻</h2>
<div class="rz-info">
<div class="rz-item">
<h3>商家权益</h3>
<span>成都市金牛区xxxx大厦成都</span>
<!-- <span>成都市金牛区xxxx大厦成都</span> -->
</div>
<div class="rz-item">
<h3>免费入驻</h3>
@@ -66,7 +70,7 @@
<span>商家诉求收集汇总反馈</span>
</div>
</div>
<div class="more" @click="$linkTo('./Ranking')" hover-class="text-hover">查看更多优惠</div>
<div class="more" @click="$linkTo('./AddMerchants')" hover-class="text-hover">我是商家我要入驻</div>
</div>
</div>
</div>
@@ -87,6 +91,7 @@
isMore: false,
isFixed: false,
statusBarHeight: 20,
bannerList: []
}
},
@@ -102,11 +107,23 @@
}
this.getList()
this.getBannerList()
},
methods: {
...mapActions(['autoLogin', 'getUserInfo']),
getBannerList () {
this.$instance.post(`/api/appbanner/getList`, null, {
withoutToken: true
}).then(res => {
if (res.code === 0) {
this.bannerList = res.data
}
}).catch(() => {
})
},
getList () {
this.$instance.post(`/api/appmerchantinfo/discountList`, null, {
withoutToken: true,
@@ -317,8 +334,15 @@
display: block;
width: 686px;
height: 352px;
margin: 0 auto 32rpx;
margin: 0 auto 32px;
border-radius: 8px;
overflow: hidden;
image {
width: 686px;
height: 352px;
border-radius: 8px;
}
}
.nav {

View File

@@ -18,9 +18,9 @@
</div>
<div class="ranking-wrapper">
<div class="tab">
<span @click="currIndex = 0" :class="[currIndex === 0 ? 'active' : '']">个人榜单</span>
<span @click="currIndex = 1" :class="[currIndex === 1 ? 'active' : '']">社区榜单</span>
<span @click="currIndex = 2" :class="[currIndex === 2 ? 'active' : '']">小区榜单</span>
<span @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">个人榜单</span>
<span @click="changeTab(1)" :class="[currIndex === 1 ? 'active' : '']">社区榜单</span>
<span @click="changeTab(2)" :class="[currIndex === 2 ? 'active' : '']">小区榜单</span>
</div>
<div class="ranking-list">
<div class="title">
@@ -29,14 +29,15 @@
<span>积分</span>
</div>
<div class="list-wrapper">
<div class="item" v-for="(item, index) in 10" :key="index">
<div class="item" v-for="(item, index) in list" :key="index">
<span>{{ index + 1 }}</span>
<div class="userinfo">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png" />
<h3>卓嘉娣</h3>
<image :src="item.avatar_url || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'" />
<h3>{{ item.name }}</h3>
</div>
<i>1,325</i>
<i>{{ item.integral || 0 }}</i>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
</div>
</div>
@@ -44,168 +45,69 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Ranking',
appName: '文明榜单',
customNavigation: true,
import { mapState } from 'vuex'
export default {
name: 'Ranking',
appName: '文明榜单',
customNavigation: true,
data () {
return {
isFixed: false,
statusBarHeight: 20,
list: [],
currIndex: 0,
hideStatus: false,
pageShow: false,
current: 1,
isMore: false
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad () {
this.getList()
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
preview (url) {
let imgs = this.list.map(v => v.accessUrl)
uni.previewImage({
urls: imgs,
current: url
})
},
mapStatus (status) {
data () {
return {
'0': '待审核',
'1': '审核通过',
'2': '审核拒绝'
}[status]
isFixed: false,
statusBarHeight: 20,
list: [],
currIndex: 0,
hideStatus: false,
pageShow: false
}
},
upload (type) {
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 9) {
this.$toast(`图片不能超过9张`)
computed: {
...mapState(['user', 'token'])
},
return false
onLoad () {
this.getList()
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
changeTab (index) {
this.currIndex = index
this.$nextTick(() => {
this.getList()
})
},
getList () {
this.$loading()
this.$instance.post(`/api/appwechatintegraldetail/rankingLis`, null, {
params: {
current: 1,
size: 20,
type: this.currIndex
}
this.$loading('上传中')
res.tempFilePaths.forEach((item, index) => {
if (index === res.tempFilePaths.length - 1) {
this.hideStatus = true
}
this.$nextTick(() => {
this.uploadFile(item, res.tempFilePaths.length, type)
})
})
},
})
},
uploadFile (img, total, type) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + (process.env.NODE_ENV == 'production' ? 'api' : '') + '/file/add',
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
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)
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
this.list = res.data
}
},
complete: () => {
this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/api/appwechatescalation/addOrUpdate`, {
type: type,
openId: this.user.openId,
accessUrl: this.imgList[0]
}).then(res => {
if (res.code == 0) {
this.$toast('上传成功!请等待后台人员审核')
this.isMore = false
this.current = 1
this.getList()
}
this.$hideLoading()
this.hideStatus = false
})
}
})
}
})
},
getList () {
if (this.isMore) return
this.$instance.post(`/api/appwechatescalation/list`, null, {
params: {
current: this.current,
size: 10,
listType: 1
}
}).then(res => {
if (res.code === 0) {
}).catch(() => {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
})
}
},
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
}
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
},
onReachBottom () {
this.getList()
}
}
</script>
<style lang="scss" socped>
@@ -243,6 +145,7 @@ export default {
&:nth-of-type(3) {
width: 100px;
text-align: center;
}
}
}
@@ -300,6 +203,7 @@ export default {
font-size: 32px;
color: #FFB94C;
font-weight: 600;
text-align: center;
}
}
}

View File

@@ -1,8 +1,8 @@
<template>
<div class="AddDiscounts">
<div class="form">
<input placeholder="输入优惠内容标题" placeholder-style="color: #AAAAAA; font-size: 15px;" />
<textarea placeholder="输入优惠内容详情" placeholder-class="input-placeholder" placeholder-style="color: #AAAAAA; font-size: 15px;" />
<input placeholder="输入优惠内容标题" v-model="title" placeholder-style="color: #999; font-size: 15px;" />
<textarea placeholder="输入优惠内容详情" v-model="content" placeholder-class="input-placeholder" placeholder-style="color: #999; font-size: 15px;" />
</div>
<div class="btn-wrapper">
<div class="btn" hover-class="text-hover" @click="save">发布</div>
@@ -11,22 +11,49 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
appName: '发布优惠',
name: 'AddDiscounts',
data () {
return {
title: '',
content: ''
}
},
onLoad () {
computed: {
...mapState(['user'])
},
methods: {
save () {
if (!this.title) {
return this.$toast('输入优惠内容标题')
}
if (!this.content) {
return this.$toast('输入优惠内容详情')
}
this.$loading()
this.$instance.post('/api/appmerchantinfo/addOrUpdateDiscount', {
title: this.title,
content: this.content,
openId: this.user.openId,
mid: this.user.merchantInfo.id
}).then(res => {
if (res.code === 0) {
this.$toast('保存成功')
uni.$emit('updateList')
setTimeout(() => {
wx.navigateBack()
}, 600)
}
})
},
}
}
</script>

View File

@@ -28,7 +28,7 @@
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/banshijindu@2x.png" />
<span>个人中心</span>
</div>
<div class="group-item" hover-class="bg-hover" @click="linkTo('./Merchants')">
<div class="group-item" hover-class="bg-hover" @click="linkTo('./Merchants')" v-if="user.merchantInfo && user.merchantInfo.status === '1'">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/chaoshidingdan@2x.png" />
<span>商户中心</span>
</div>

View File

@@ -1,28 +1,31 @@
<template>
<div class="merchants">
<div class="top">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png" />
<image :src="user.merchantInfo.photoUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'" />
<div class="right">
<h2>商户名称名称名称</h2>
<p>成都市金牛区xxxx大厦成都成都成都成都市金牛区xxxx大厦成都成都成都成</p>
<h2>{{ user.merchantInfo.merchantName }}</h2>
<p>{{ user.merchantInfo.address }}</p>
</div>
</div>
<div class="merchants-wrapper">
<h2>我发布的优惠</h2>
<div class="merchants-list">
<div class="item">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="item-top">
<h2>Lv.1会员进店享受9折优惠</h2>
<p>百年征程波澜壮阔百年初心历久弥坚7月1日上午庆祝中国共产党成立100周年大会在北京天安门广场隆重举行各界代表7万余人以盛百年征程波澜壮阔百年初心历久弥坚7月1日上午庆祝中国共产党成立100周年大会在北京天安门广场隆重举行各界代表7万余人以盛</p>
<h2>{{ item.title }}</h2>
<p>{{ item.content }}</p>
<div class="item-tags">
<span>审核通过</span>
<span v-if="item.status === '1'">审核通过</span>
<span v-if="item.status === '0'">待审核</span>
<span v-if="item.status === '2'">审核拒绝</span>
</div>
</div>
<div class="item-bottom">
<div hover-class="bg-hover">修改</div>
<div hover-class="bg-hover" @click="$linkTo('./AddDiscounts?id=' + item.id)" v-if="item.status === '0'">修改</div>
<div hover-class="bg-hover">删除</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
</div>
<div class="btn-wrapper">
@@ -32,22 +35,73 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
appName: '商户中心',
name: 'Merchants',
data () {
return {
list: [],
current: 1,
isMore: false
}
},
onLoad () {
computed: {
...mapState(['user'])
},
onLoad () {
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.isMore = false
this.getList()
})
},
methods: {
getList () {
if (this.isMore) return
this.$instance.post(`/api/appmerchantinfo/discountList`, null, {
params: {
current: this.current,
size: 10,
openId: this.user.openId
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
this.pageShow = true
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onReachBottom () {
this.getList()
}
}
</script>

View File

@@ -6,33 +6,39 @@
<h2>头像</h2>
<div class="form-item__right">
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="userInfo.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'"></image>
<image class="avatar" :src="user.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'"></image>
</button>
</div>
</div>
<div class="form-item">
<h2>昵称</h2>
<div class="form-item__right">
<input placeholder="请输入昵称" type="nickname" v-model="userInfo.nickName" />
<input placeholder="请输入昵称" type="nickname" v-model="user.nickName" />
</div>
</div>
<div class="form-item">
<h2>手机号</h2>
<div class="form-item__right">
<input placeholder="请输入手机号" type="number" maxlength="11" v-model="userInfo.phone" />
<input placeholder="请输入手机号" type="number" maxlength="11" v-model="user.phone" />
</div>
</div>
<div class="form-item">
<h2>所在社区</h2>
<div class="form-item__right">
<input placeholder="请输入所在社区" v-model="userInfo.nickName" />
</div>
<picker :range="sqList" range-key="dictName" @change="e => (user.sssq = sqList[e.detail.value].dictName)">
<div class="form-item__right">
<span :style="{color: user.sssq ? '#333' : '#999'}">{{ user.sssq ? user.sssq : '请输入所在社区' }}</span>
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
</div>
</picker>
</div>
<div class="form-item">
<h2>所在小区</h2>
<div class="form-item__right">
<input placeholder="请输入所在小区" v-model="userInfo.phone" />
</div>
<picker :range="xqList" range-key="dictName" @change="e => (user.szxq = xqList[e.detail.value].dictName)">
<div class="form-item__right">
<span :style="{color: user.szxq ? '#333' : '#999'}">{{ user.szxq ? user.szxq : '请输入所在小区' }}</span>
<image class="right" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ContentRightArrow@2x.png" />
</div>
</picker>
</div>
</div>
</div>
@@ -49,6 +55,8 @@
name: 'UserInfo',
data () {
return {
sqList: [],
xqList: [],
userInfo: {}
}
},
@@ -61,37 +69,37 @@
this.userInfo = {
...this.user
}
this.$dict.load(['tfx_sssq', 'tfx_szxq']).then(() => {
this.sqList = this.$dict.getDict('tfx_sssq')
this.xqList = this.$dict.getDict('tfx_szxq')
})
},
methods: {
getUserInfo () {
this.$http.post(`/app/getUserInfo`).then(res => {
if (res.code === 200) {
this.isLogin = true
this.userInfo = res.data
uni.setStorageSync('userInfo', res.data)
uni.setStorageSync('token', res.data.id)
}
})
},
save () {
if (!this.userInfo.avatarUrl) {
if (!this.user.avatarUrl) {
return this.$toast('请上传头像')
}
if (!this.userInfo.nickName) {
if (!this.user.nickName) {
return this.$toast('请输入昵称')
}
if (!this.userInfo.phone) {
if (!this.user.phone) {
return this.$toast('请输入手机号')
}
if (!this.user.sssq) {
return this.$toast('请选择所在社区')
}
if (!this.user.szxq) {
return this.$toast('请选择所在小区')
}
this.$loading()
this.$instance.post('/api/appwechatuser/update-nickName', null, {
params: {
...this.userInfo
...this.user
}
}).then(res => {
if (res.code === 0) {
@@ -238,9 +246,9 @@
}
.right {
width: 13rpx;
height: 21rpx;
margin-left: 10rpx;
width: 32px;
height: 32px;
margin-left: 10px;
}
}
}