积分超市

This commit is contained in:
liuye
2022-02-17 10:31:45 +08:00
parent 0be49b0432
commit 1325b90054
7 changed files with 277 additions and 303 deletions

View File

@@ -192,7 +192,7 @@ export default {
// uni.setNavigationBarTitle({
// title: options.title,
// });
// this.getInfo();
this.getInfo();
},
methods: {
tabClick(index) {

View File

@@ -1,39 +1,24 @@
<template>
<div class="page">
<div class="supermarket">
<div
class="fixed-top title"
@click="$linkTo(`./system?areaName=${areaName}`)"
v-if="propAreaId == '341021104000'"
>
{{ areaName }}信用好超市管理制度点击查看 >>
<div class="AppSupermarket">
<AiTopFixed>
<div class="header-top">
<div>区域选择</div>
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-right" color="#666" size="24" style="margin-left:4px;" />
</AiAreaPicker>
</div>
<div
class="goods-list"
v-if="numList.length"
:style="
propAreaId == '341021104000'
? 'padding-top: 80rpx;'
: 'padding-top: 0;'
"
>
</AiTopFixed>
<div class="goods-list" v-if="numList.length">
<div class="left">
<div
:class="numIndex == index ? 'item active' : 'item'"
v-for="(item, index) in numList"
:key="index"
@click="numClick(index)"
>
<i v-show="item.total > 0">{{ item.total }}</i>
<div :class="numIndex == index ? 'item active' : 'item'" v-for="(item, index) in numList" :key="index" @click="numClick(index)">
<span v-show="item.total > 0">{{ item.total }}</span>
{{ item.type }}分区
</div>
</div>
<div class="right">
<div
class="item"
v-for="(item, index) in goodsList[numIndex]"
:key="index"
>
<div class="item" v-for="(item, index) in goodsList[numIndex]" :key="index">
<img :src="item.photo[0].url" alt="" />
<div class="item-info">
<p class="item-name">{{ item.merchandiseName }}</p>
@@ -44,16 +29,9 @@
<div class="item-bottom">
<div></div>
<div class="item-bottom__right">
<image
v-show="item.num > 0"
@click="cut(numIndex, index)"
src="/static/img/cut.png"
/>
<image v-show="item.num > 0" @click="cut(numIndex, index)" src="./components/img/cut.png"/>
<input v-show="item.num > 0" v-model="item.num" />
<image
src="/static/img/add.png"
@click="add(numIndex, index)"
/>
<image src="./components/img/add.png" @click="add(numIndex, index)" />
</div>
</div>
</div>
@@ -62,13 +40,6 @@
</div>
<AiEmpty v-else />
<div class="goods-footer" v-if="numList.length">
<div class="goods-footer__top">
<h2>
{{ userInfo.familyName || user.nickName
}}{{ userInfo.familyName ? "家" : "" }}
</h2>
<span>剩余积分:{{ userInfo.familyIntegral || 0 }}</span>
</div>
<div class="goods-footer__bottom">
<div class="goods-footer__bottom__left">
<h3>{{ total }}件商品</h3>
@@ -88,7 +59,6 @@
</div>
</div>
</div>
</div>
</template>
<script>
import { mapState } from "vuex";
@@ -102,14 +72,14 @@ export default {
numIndex: 0,
goodsList: [],
areaId: "",
userInfo: {},
areaName: "",
userInfo: {},
propAreaId: "",
};
},
computed: {
...mapState(["global", "user", "token"]),
...mapState(["user"]),
total() {
let total = 0;
@@ -141,65 +111,17 @@ export default {
},
onLoad() {
this.propAreaId = this.$areaId;
uni.$on("update", () => {
this.getInfo();
});
if (uni.getStorageSync("areaId")) {
this.areaId = uni.getStorageSync("areaId");
}
this.getUserInfo();
this.getInfo();
// this.getList()
this.areaName = this.user.areaName || ''
},
onShow() {
this.getUserInfo();
document.title = '信用好超市'
},
methods: {
getInfo() {
this.$http
.post(`/admin/area/queryAreaByAreaid?id=${this.areaId}`, null, {})
.then((res) => {
if (res.code === 0) {
if (res.data) {
this.areaName = res.data.name;
this.getList();
}
}
});
},
getUserInfo() {
this.$http
.post(
`/app/appresident/queryFamilyById?id=${this.user.residentId}`,
null,
{}
)
.then((res) => {
if (res.code === 0) {
this.userInfo = res.data;
}
});
},
toOrder() {
if (this.user.status == 0) {
if (!this.user.phone) {
return this.$linkTo("/pages/phone/bingPhoneNumber?from=auth");
} else {
return this.$linkTo("/pages/auth/authenticationInfo");
}
}
if (!this.total) {
return this.$toast("请选择商品");
return this.$u.toast("请选择商品");
}
if (this.money > this.userInfo.familyIntegral) {
return this.$toast("积分不足");
}
let goods = [];
this.goodsList.forEach((arr) => {
@@ -210,25 +132,18 @@ export default {
});
});
this.$linkTo(
`/subPages/creditPoints/submitOrder?familyId=${
this.userInfo.familyId
}&userName=${this.userInfo.familyName}&memberId=${
this.userInfo.memberId
}&goods=${JSON.stringify(goods)}&total=${this.total}&money=${
this.money
}&familyIntegral=${this.userInfo.familyIntegral}`
);
uni.navigateTo({ url: `./SubmitOrder?goods=${JSON.stringify(goods)}&total=${this.total}&money=${this.money}&areaId=${this.areaId}` })
},
areaSelect(e) {
if(/[^0]0{0,2}$/.test(e)) {
this.areaId = e
this.getList()
}else {
this.$u.toast('请选择到村级')
}
},
getList() {
this.$http
.post(
`/app/appvillagerintegralmerchandise/listByIntegral?areaId=${this.areaId}`,
null,
{}
)
.then((res) => {
this.$http.post(`/app/appvillagerintegralmerchandise/listByIntegral?areaId=${this.areaId}`).then((res) => {
if (res.code === 0) {
if (res.data) {
this.numList = Object.keys(res.data).map((item) => {
@@ -289,7 +204,18 @@ export default {
};
</script>
<style scoped lang="scss">
.item-bottom {
uni-page-body{
height: 100%;
background-color: #fff;
}
.header-top {
display: flex;
background: #fff;
justify-content: space-between;
align-items: center;
padding-top: 16px;
}
.item-bottom {
display: flex;
align-items: center;
justify-content: space-between;
@@ -317,13 +243,13 @@ export default {
color: #666;
text-align: center;
}
}
}
.goods-footer {
.goods-footer {
position: fixed;
left: 0;
bottom: 0;
z-index: 111;
z-index: 1;
width: 100%;
background: #fff;
@@ -390,12 +316,9 @@ export default {
justify-content: space-between;
height: 104rpx;
}
}
}
.page {
width: 100%;
background-color: #fff;
.supermarket {
.AppSupermarket {
height: 100%;
overflow-y: hidden;
.title {
@@ -434,16 +357,18 @@ export default {
font-size: 28rpx;
border-left: 6rpx solid #faf9fb;
i {
span {
position: absolute;
right: 8rpx;
top: 8rpx;
height: 28rpx;
line-height: 28rpx;
padding: 0 12rpx;
// width: 28px;;
height: 28px;
line-height: 28px;
padding: 0 8px;
text-align: center;
color: #fff;
font-size: 20rpx;
border-radius: 13rpx;
font-size: 10px;
border-radius: 14px;
background: #fb4e44;
}
}
@@ -505,5 +430,8 @@ export default {
}
}
}
}
i{
font-style: normal;
}
</style>

View File

@@ -1,15 +1,15 @@
<template>
<div class="Search">
<AiTopFixed>
<u-search placeholder="请输入标题" :show-action="false" search-icon-color="#ccc" v-model="search.title" @search="search.current = 1, getList()"/>
<u-search placeholder="请输入标题" :show-action="false" search-icon-color="#ccc" v-model="phone" @search="getList()"/>
</AiTopFixed>
<p class="text">请通过搜索<span>手机号或身份证号</span>后选择结算对象</p>
<div class="family-list">
<div class="item">
<div class="name">卓作旺家</div>
<div class="num">剩余积分:480</div>
<div class="family-list" v-if="familyInfo.familyId">
<div class="item" @click="goBack">
<div class="name">{{familyInfo.familyName}}</div>
<div class="num">剩余积分:{{familyInfo.familyIntegral}}</div>
</div>
</div>
<p class="text" v-else>请通过搜索<span>手机号或身份证号</span>后选择结算对象</p>
</div>
</template>
@@ -18,16 +18,30 @@ export default {
name: 'Search',
data() {
return {
search: {
title: '',
current: 1
}
phone: '',
familyInfo: {},
areaId: ''
};
},
onLoad(options) {
this.areaId = options.areaId
},
onShow() {
document.title = '搜索'
},
methods: {
getList() {
this.$http.post(`/app/appresident/queryFamilyByPhone?phone=${this.phone}&areaId=${this.areaId}`).then(res => {
if (res.code === 0 && res.data) {
this.familyInfo = res.data
}
}).catch((err) => {
this.$confirm(err, '温馨提示').then()
})
},
goBack() {
uni.$emit('selectFamily', this.familyInfo)
uni.navigateBack()
}
},
};

View File

@@ -1,10 +1,14 @@
<template>
<div class="order">
<div class="order-info">
<h2>{{ userName }}</h2>
<span>剩余积分:{{ familyIntegral }}</span>
<div><span class="tips">*</span>结算对象</div>
<div class="family-name" @click="toSearch">
<span v-if="familyInfo.familyId" class="name">{{familyInfo.familyName}} 剩余积分:{{familyInfo.familyIntegral}}</span>
<span v-else class="name">请选择</span>
<u-icon name="arrow-right" color="#666" size="24" style="margin-left:4px;" />
</div>
<image class="line" src="/static/img/line.png" />
</div>
<image class="line" src="./components/img/line.png" />
<div class="order-list">
<div class="order-item" v-for="(item, index) in goods" :key="index">
<image :src="item.photo[0].url" />
@@ -33,7 +37,7 @@
<em>积分</em>
</div>
</div>
<div class="goods-footer__bottom--btn" @click="submit" hover-class="text-hover">确认提交</div>
<div class="goods-footer__bottom--btn" @click="submit" hover-class="text-hover">确认领取</div>
</div>
</div>
</div>
@@ -46,29 +50,36 @@
total: 0,
money: 0,
goods: [],
memberId: '',
userName: '',
familyId: '',
familyIntegral: 0
areaId: '',
familyInfo: {}
}
},
onLoad (query) {
this.userName = query.userName
this.total = query.total
this.familyIntegral = query.familyIntegral
this.money = query.money
this.memberId = query.memberId
this.familyId = query.familyId
this.goods = JSON.parse(query.goods)
onLoad (options) {
this.total = options.total
this.money = options.money
this.goods = JSON.parse(options.goods)
this.areaId = options.areaId
uni.$on('selectFamily', res => {
console.log(res)
this.familyInfo = res
})
},
onShow() {
document.title = '结算'
},
methods: {
submit () {
this.$loading()
toSearch() {
uni.navigateTo({url: `./Search?areaId=${this.areaId}`})
},
submit() {
if(!this.familyInfo.familyId) {
return this.$u.toast('请选择结算对象')
}
this.$http.post(`/app/appvillagerintegralshoporder/createOrderForWx`, {
memberId: this.memberId,
familyId: this.familyId,
memberId: this.familyInfo.memberId,
familyId: this.familyInfo.familyId,
orderIntegral: this.money,
shopId: this.goods[0].shopId,
merchandiseList: this.goods.map(item => {
@@ -79,10 +90,9 @@
})
}).then(res => {
if (res.code === 0) {
uni.$emit('update')
this.$linkTo('/subPages/creditPoints/result?type=0')
} else {
this.$linkTo('/subPages/creditPoints/result?type=1')
}
})
}
@@ -142,12 +152,30 @@
.order-info {
display: flex;
align-items: center;
justify-content: space-between;
height: 128rpx;
padding: 0 30rpx;
color: #333333;
font-size: 32rpx;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 44px;
padding: 40px 30px 20px 30px;
.tips{
display: inline-block;
width: 16px;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #FF4466;
margin-right: 4px;
}
.family-name{
color: #666;
width: calc(100% - 170px);
.name{
display: inline-block;
width: calc(100% - 40px);
word-break: break-all;
text-align: right;
}
}
}
.goods-footer {
@@ -179,6 +207,7 @@
h3 {
color: #F94246;
font-size: 32rpx;
font-weight: normal;
}
.goods-footer__bottom--middle {
@@ -241,4 +270,7 @@
}
}
}
i{
font-style: normal;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B