Commit 41316fd6 by zhangquan

优惠券开发

1 parent 45e2ae63
import { http, other_http } from '@/main' import { other_http } from '@/main'
const url = 'rop-scrm-coupon/router' const url = 'rop-scrm-coupon/router'
const defaultPath = 'scrm.api.coupon.'
/**商品分页查询*/ /**商品分页查询*/
const getCouponsList = params => { const getCouponsList = params => {
params.method = 'scrm.api.coupon.equity.list.merchant' params.method = `${defaultPath}equity.list.merchant`
return other_http({ return other_http({
url, url,
data: params data: params
...@@ -11,7 +12,7 @@ const getCouponsList = params => { ...@@ -11,7 +12,7 @@ const getCouponsList = params => {
} }
const createCoupons = params => { const createCoupons = params => {
params.method = 'scrm.api.coupon.equity.batch.create' params.method = `${defaultPath}equity.batch.create`
return other_http({ return other_http({
url, url,
data: params data: params
...@@ -19,7 +20,7 @@ const createCoupons = params => { ...@@ -19,7 +20,7 @@ const createCoupons = params => {
} }
const getExportApi = params => { const getExportApi = params => {
params.method = `scrm.api.coupon.equity.list.merchant.export` params.method = `${defaultPath}equity.list.merchant.export`
return other_http({ return other_http({
url, url,
data: params, data: params,
...@@ -29,7 +30,7 @@ const getExportApi = params => { ...@@ -29,7 +30,7 @@ const getExportApi = params => {
//领取记录列表 //领取记录列表
const getListReceiveRecordApi = params => { const getListReceiveRecordApi = params => {
params.method = `scrm.api.coupon.listReceiveRecordByCouponId` params.method = `${defaultPath}listReceiveRecordByCouponId`
return other_http({ return other_http({
url, url,
method: 'GET', method: 'GET',
...@@ -38,9 +39,47 @@ const getListReceiveRecordApi = params => { ...@@ -38,9 +39,47 @@ const getListReceiveRecordApi = params => {
}) })
} }
//查看优惠券
const getCouponDetailApi = params => {
params.method = `${defaultPath}detail`
return other_http({
url,
method: 'GET',
data: params,
sign: true
})
}
//删除
const deleteCouponApi = params => {
params.method = `${defaultPath}delete`
return other_http({
url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 优惠券-作废
const couponUserCancelApi = params => {
params.method = `${defaultPath}user.cancel`
return other_http({
url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { export default {
getCouponsList, getCouponsList,
createCoupons, createCoupons,
getExportApi, getExportApi,
getListReceiveRecordApi getListReceiveRecordApi,
getCouponDetailApi,
deleteCouponApi,
couponUserCancelApi
} }
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
</template> </template>
<script> <script>
import utils from '../../utils/util'
export default { export default {
name: 'index', name: 'index',
data() { data() {
...@@ -76,6 +75,20 @@ export default { ...@@ -76,6 +75,20 @@ export default {
}, },
{ {
type: 'GLButton', type: 'GLButton',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
condition: row => {
return row.status == '1' || row.status == '3'
},
listeners: {
click: this.del
}
},
{
type: 'GLButton',
name: row => { name: row => {
return '领取详情' return '领取详情'
}, },
...@@ -217,6 +230,35 @@ export default { ...@@ -217,6 +230,35 @@ export default {
item.optionList = [...res.data] item.optionList = [...res.data]
}) })
}, },
//删除
del(row) {
var params = {}
params.couponId = row.id
this.secondConfirm('删除', '确定删除此优惠券?', 'goodsConponApi', 'deleteCouponApi', params)
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
handleRest() { handleRest() {
this.searchForm = { this.searchForm = {
brandName: '', brandName: '',
...@@ -230,7 +272,7 @@ export default { ...@@ -230,7 +272,7 @@ export default {
handleExport() { handleExport() {
var params = { ...this.searchForm } var params = { ...this.searchForm }
this.$apis.goodsConponApi.getExportApi(params).then(res => { this.$apis.goodsConponApi.getExportApi(params).then(res => {
let tempaa = utils.getExplorer() let tempaa = this.getExplorer()
if (tempaa == 'QQ') { if (tempaa == 'QQ') {
window.open(res) window.open(res)
} else { } else {
...@@ -242,7 +284,7 @@ export default { ...@@ -242,7 +284,7 @@ export default {
}) })
}, },
goDetailPage(row) { goDetailPage(row) {
this.$router.push('/goodsConpon/receivedDetail', { id: row.scope.id }) this.$router.push({ path: '/goodsConpon/receivedDetail', query: { id: row.scope.id } })
}, },
changeStatus() {}, changeStatus() {},
addConpon() { addConpon() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!