You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.1 KiB
102 lines
2.1 KiB
import request from '@/components/hzjc/utils/request.js'
|
|
|
|
let coupon = {}
|
|
|
|
/**
|
|
* 获取优惠券
|
|
* @param {object} that
|
|
* @param {int} isFirstPage 是否第一页 0--不是 1--是
|
|
* @param {int} type 优惠券类型 1--免费领取 7--积分兑换
|
|
* @date 2022-10-15
|
|
*/
|
|
coupon.listCoupon = function(that, isFirstPage, type) {
|
|
return new Promise((resolve, reject) => {
|
|
request.getList('discount/api/Coupon/listCoupon', {
|
|
type: type
|
|
}, {
|
|
that: that,
|
|
first_page: isFirstPage
|
|
}).then(res => {
|
|
resolve(res)
|
|
}).catch(res => {
|
|
reject(res)
|
|
})
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 领取优惠券/积分兑换优惠券
|
|
* @param {int} couponId 优惠券ID
|
|
* @date 2022-10-17
|
|
*/
|
|
coupon.insertMyCoupon = function(couponId) {
|
|
return new Promise((resolve, reject) => {
|
|
request.getData('discount/api/MyCoupon/insertMyCoupon', {
|
|
coupon_id: couponId
|
|
}, {
|
|
loading: true
|
|
}).then(res => {
|
|
resolve(res)
|
|
}).catch(res => {
|
|
reject(res)
|
|
})
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取我的优惠券
|
|
* @param {object} that
|
|
* @param {int} isFirstPage 是否第一页 0--不是 1--是
|
|
* @param {int} status 优惠券状态 1--未使用 2--已使用 3--已过期
|
|
* @date 2022-10-15
|
|
*/
|
|
coupon.listMyCoupon = function(that, isFirstPage, tabIndex) {
|
|
return new Promise((resolve, reject) => {
|
|
request.getList('discount/api/MyCoupon/listMyCoupon', {
|
|
status: tabIndex
|
|
}, {
|
|
that: that,
|
|
first_page: isFirstPage
|
|
}).then(res => {
|
|
resolve(res)
|
|
}).catch(res => {
|
|
reject(res)
|
|
})
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取可选择优惠券
|
|
* @param {int} price 商品总价钱
|
|
* @date 2022-10-17
|
|
*/
|
|
coupon.listChooseCoupon = function(price) {
|
|
return new Promise((resolve, reject) => {
|
|
request.getData('discount/api/MyCoupon/listChooseCoupon', {
|
|
price: price
|
|
}).then(res => {
|
|
resolve(res)
|
|
}).catch(res => {
|
|
reject(res)
|
|
})
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获得首次注册优惠券并展示
|
|
* @date 2022-10-18
|
|
*/
|
|
coupon.insertFirstRegisterMyCoupon = function() {
|
|
return new Promise((resolve, reject) => {
|
|
request.getData('discount/api/MyCoupon/insertFirstRegisterMyCoupon', {}, {
|
|
showErrMsg: false
|
|
}).then(res => {
|
|
resolve(res)
|
|
}).catch(res => {
|
|
reject(res)
|
|
})
|
|
})
|
|
}
|
|
|
|
export default coupon
|