bug
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user