积分商城

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

View File

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

View File

@@ -34,7 +34,6 @@ export default {
shopGoodsId: '',
goodsInfo: {},
total: 0,
userId: ''
}
},
computed: {
@@ -42,7 +41,6 @@ export default {
},
onLoad(option) {
this.shopGoodsId = option.shopGoodsId
this.userId = option.userId
this.total = option.total
this.$dict.load(['integralSGType']).then(() => {
this.getDetail()
@@ -61,7 +59,7 @@ export default {
},
toOrder() {
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`})
}
},
},