积分商城

This commit is contained in:
liuye
2023-05-22 13:55:36 +08:00
parent 9b328a2794
commit f450ca1e08
4 changed files with 21 additions and 32 deletions

View File

@@ -76,7 +76,7 @@
</template> </template>
<script> <script>
import {mapState} from "vuex"; import {mapState, mapActions} from "vuex";
export default { export default {
name: 'AppSuperMarket', name: 'AppSuperMarket',
@@ -109,27 +109,20 @@ export default {
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
}, },
onLoad(option) { onLoad() {
this.openId = option.openId this.$dict.load(['integralSGType'])
this.userId = option.userId
this.integralUserId = option.integralUserId
this.getTotal()
this.$dict.load(['integralSGType']).then(() => {
this.getList()
})
}, },
onShow() { onShow() {
document.title = '积分商城' document.title = '积分商城'
this.getTotal() this.$nextTick(() => {
}, this.getAccount().then(() => {
methods: { this.total = this.user.girdIntegral || 0
getTotal() { this.getListInit()
this.$http.post(`/app/appintegraluser/integralUserInfoFD?integralUserId=${this.integralUserId}`).then(res => { })
if (res?.data) {
this.total = res.data.integral || 0
}
}) })
}, },
methods: {
...mapActions(['getAccount']),
getListInit() { getListInit() {
this.goodsList = [] this.goodsList = []
this.leftList = [] this.leftList = []
@@ -138,15 +131,15 @@ export default {
this.getList() this.getList()
}, },
getList() { getList() {
this.$http.post(`/app/appintegralsupermarketshop/goodsListWXCP`, null, { this.$http.post(`/app/appintegralsupermarketshop/goodsListGird`, null, {
params: { params: {
goodsType: this.currentTabs, //商品类型0全部、1免费兑、2京东低价商品默认0 goodsType: this.currentTabs, //商品类型0全部、1免费兑、2京东低价商品默认0
orderType: this.currentType == 0 ? 1 : 0, //排序类型0积分升序、1上架时间倒序默认0 orderType: this.currentType == 0 ? 1 : 0, //排序类型0积分升序、1上架时间倒序默认0
filterIntegral: this.currentType == 2 ? true : false, //过滤我可兑换的默认false filterIntegral: this.currentType == 2 ? true : false, //过滤我可兑换的默认false
integralRange: this.currentType == 1 ? this.currentPoint : '', //积分区间类型0全部、150分以下、2:100分以下、3200分以下、45000分以下默认0 integralRange: this.currentType == 1 ? this.currentPoint : '', //积分区间类型0全部、150分以下、2:100分以下、3200分以下、45000分以下默认0
current: this.current, current: this.current,
userId: this.userId, // userId: this.userId,
openId: this.openId // openId: this.openId
} }
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
@@ -174,14 +167,14 @@ export default {
this.getListInit() this.getListInit()
}, },
toProductDetail(item) { toProductDetail(item) {
uni.navigateTo({url: `./productDetails?shopGoodsId=${item.shopGoodsId}&total=${this.total}&userId=${this.userId}`}) uni.navigateTo({url: `./productDetails?shopGoodsId=${item.shopGoodsId}&total=${this.total}`})
}, },
toMyOrder() { toMyOrder() {
uni.navigateTo({url: `./myOrderList?userId=${this.userId}`}) uni.navigateTo({url: `./myOrderList`})
}, },
toOrder(item) { toOrder(item) {
if(this.total >= item.integralPrice && item.stock > 0) { if(this.total >= item.integralPrice && item.stock > 0) {
uni.navigateTo({url: `./placeOrder?shopGoodsId=${item.shopGoodsId}&total=${this.total}&backLevel=3&userId=${this.userId}`}) uni.navigateTo({url: `./placeOrder?shopGoodsId=${item.shopGoodsId}&total=${this.total}&backLevel=2`})
} }
}, },
}, },

View File

@@ -57,14 +57,12 @@ export default {
}, },
list: [], list: [],
current: 1, current: 1,
userId: ''
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
}, },
onLoad(option) { onLoad(option) {
this.userId = option.userId
this.$dict.load(['integralSGOStatus', 'integralSGType']).then(() => { this.$dict.load(['integralSGOStatus', 'integralSGType']).then(() => {
this.getList() this.getList()
}) })
@@ -83,7 +81,7 @@ export default {
params: { params: {
current: this.current, current: this.current,
status: this.currentTabs == 0 ? '' : this.currentTabs - 1, status: this.currentTabs == 0 ? '' : this.currentTabs - 1,
createUserId: this.userId createUserId: this.user.girdMemberId
} }
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
@@ -110,7 +108,7 @@ export default {
}); });
}, },
cancelOrder(item) { cancelOrder(item) {
this.$http.post(`/app/appintegralsupermarketorder/cancelForXCX?id=${item.id}`).then(res => { this.$http.post(`/app/appintegralsupermarketorder/cancelForGird?id=${item.id}`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.getListInit() this.getListInit()
} }

View File

@@ -96,12 +96,12 @@ export default {
this.show = false this.show = false
}, },
confirmOrder() { confirmOrder() {
this.$http.post(`/app/appintegralsupermarketorder/addWXCP`, { this.$http.post(`/app/appintegralsupermarketorder/addGird`, {
shopId: this.goodsInfo.shopId, shopId: this.goodsInfo.shopId,
goodsId: this.goodsInfo.id, goodsId: this.goodsInfo.id,
remarks: this.value, remarks: this.value,
quantity: this.goodsNum, quantity: this.goodsNum,
createUserId: this.userId createUserId: this.user.girdMemberId
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.toSuccess() this.toSuccess()

View File

@@ -34,7 +34,6 @@ export default {
shopGoodsId: '', shopGoodsId: '',
goodsInfo: {}, goodsInfo: {},
total: 0, total: 0,
userId: ''
} }
}, },
computed: { computed: {
@@ -42,7 +41,6 @@ export default {
}, },
onLoad(option) { onLoad(option) {
this.shopGoodsId = option.shopGoodsId this.shopGoodsId = option.shopGoodsId
this.userId = option.userId
this.total = option.total this.total = option.total
this.$dict.load(['integralSGType']).then(() => { this.$dict.load(['integralSGType']).then(() => {
this.getDetail() this.getDetail()
@@ -61,7 +59,7 @@ export default {
}, },
toOrder() { toOrder() {
if(this.total >= this.goodsInfo.integralPrice && this.goodsInfo.stock > 0 && this.goodsInfo.status == 1) { if(this.total >= this.goodsInfo.integralPrice && this.goodsInfo.stock > 0 && this.goodsInfo.status == 1) {
uni.navigateTo({url: `./placeOrder?shopGoodsId=${this.goodsInfo.shopGoodsId}&total=${this.total}&backLevel=4&userId=${this.userId}`}) uni.navigateTo({url: `./placeOrder?shopGoodsId=${this.goodsInfo.shopGoodsId}&total=${this.total}&backLevel=4`})
} }
}, },
}, },