Commit 16046c50 by 李伟康

提交需求

1 parent daa38f04
...@@ -1956,7 +1956,7 @@ ...@@ -1956,7 +1956,7 @@
} }
}, },
"vue-loader-v16": { "vue-loader-v16": {
"version": "npm:vue-loader@16.8.3", "version": "npm:vue-loader-v16@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true, "dev": true,
...@@ -8887,6 +8887,11 @@ ...@@ -8887,6 +8887,11 @@
"integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true "dev": true
}, },
"number-precision": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz",
"integrity": "sha512-05OLPgbgmnixJw+VvEh18yNPUo3iyp4BEWJcrLu4X9W05KmMifN7Mu5exYvQXqxxeNWhvIF+j3Rij+HmddM/hQ=="
},
"oauth-sign": { "oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmmirror.com/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmmirror.com/oauth-sign/-/oauth-sign-0.9.0.tgz",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"glsx-common": "^2.1.0", "glsx-common": "^2.1.0",
"glsx-components": "^1.5.7", "glsx-components": "^1.5.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"number-precision": "^1.6.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuex": "^3.1.2" "vuex": "^3.1.2"
......
...@@ -124,7 +124,44 @@ const getSaleOrderDetail = params => { ...@@ -124,7 +124,44 @@ const getSaleOrderDetail = params => {
sign: true sign: true
}) })
} }
/**
* 获取油劵列表
*/
const getOilCouponList = params => {
params.method = 'scrm.api.shopmall.goods.oil.coupon.list'
return http({
url,
data: params
})
}
/**
* 更新油劵信息(图片/销售价/上下架开关)
*/
const updateOilCoupon = params => {
params.method = 'scrm.api.shopmall.goods.oil.coupon.update'
return http({
url,
data: params
})
}
/**
* 油券订单列表
*/
const getOilCouponOrderList = params => {
params.method = 'scrm.api.shopmall.goods.oil.coupon.order.list'
return http({
url,
data: params
})
}
/**导出油券订单 */
const exportOilCouponOrderList = params => {
params.method = 'scrm.api.shopmall.goods.oil.coupon.order.list.export'
return http({
url,
data: params
})
}
export default { export default {
getCategoryListApi, getCategoryListApi,
getGoodsListApi, getGoodsListApi,
...@@ -138,5 +175,9 @@ export default { ...@@ -138,5 +175,9 @@ export default {
getOrderList, getOrderList,
getOrderDetail, getOrderDetail,
getSaleOrderList, getSaleOrderList,
getSaleOrderDetail getSaleOrderDetail,
getOilCouponList,
updateOilCoupon,
getOilCouponOrderList,
exportOilCouponOrderList
} }
...@@ -34,6 +34,29 @@ function exportFn (url) { ...@@ -34,6 +34,29 @@ function exportFn (url) {
iframe.src = url iframe.src = url
document.body.appendChild(iframe) document.body.appendChild(iframe)
} }
function uploadImg (e, _this, maxSize = 2) {
return new Promise((resolve, reject) => {
const file = e.srcElement.files[0]
if (!file) return reject()
const size = file.size / 1024 / 1024
if (maxSize && size > maxSize) {
_this.$message.error(`图片体积需小于${maxSize}M`)
return reject()
}
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = async event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
const res = await _this.$apis.beforeSale.uploadImgApi({ file: fileUrl })
if (res) resolve({ url: res, name: file.name })
else reject('上传失败')
}
})
}
export { export {
exportFn exportFn,
uploadImg
} }
\ No newline at end of file \ No newline at end of file
...@@ -8,58 +8,71 @@ ...@@ -8,58 +8,71 @@
:formData="searchFormData" :formData="searchFormData"
@handleOk="handleSearch" @handleOk="handleSearch"
@handleRest="handleReset" @handleRest="handleReset"
@submit.native.prevent
></GLCombiForm> ></GLCombiForm>
</div> </div>
<div class="tabelList"> <div class="tabelList">
<GLTable <GLTable
ref="listRef" ref="listRef"
:getListApi="getListApi" :tableData="tableData"
:searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams" :tableParams="tableParams"
:pageConf="pageConf" :pageConf="pageConf"
:tableTotal="tableTotal"
@refreshTable="getOilCouponList"
v-loading="loading"
> >
<template <template
slot="IMG" slot="IMG"
slot-scope="scope" slot-scope="scope"
> >
<template> <el-popover
placement="top"
trigger="hover"
>
<img <img
class="img-plus"
:src="scope.scope.aliasUrl"
/>
<div
slot="reference"
class="img" class="img"
:src="scope.scope.goodsImage"
> >
</template> <img :src="scope.scope.aliasUrl">
<div class="mask">
<img
src="@/assets/images/icon-edit.png"
class="icon"
>
<input
type="file"
:ref="`file-${scope.scope.id}`"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="uploadImg($event, scope.scope)"
/>
</div>
</div>
</el-popover>
</template> </template>
<template <template
slot="INPUT" slot="INPUT"
slot-scope="scope" slot-scope="scope"
> >
<el-form
@submit.native.prevent
:model="scope.scope"
:ref="`inputRef-${scope.scope.id}`"
:key="scope.scope.id"
>
<el-form-item
class="form-input"
prop="brandId"
:rules="rules(scope.scope)"
>
<el-input <el-input
v-model.trim="scope.scope.brandId" v-model="scope.scope.salesPrice"
size="small" size="small"
@blur="handleInput(scope.scope)" @blur="handleBlur(scope.scope)"
></el-input> ></el-input>
</el-form-item>
</el-form>
</template> </template>
<template <template
slot="SWITCH" slot="SWITCH"
slot-scope="scope" slot-scope="scope"
> >
<el-switch <el-switch
v-model="scope.scope.usedAmount" v-model="scope.scope.status"
@change="change($event,scope.scope)" @change="change($event,scope.scope)"
:active-value="1"
:inactive-value="0"
></el-switch> ></el-switch>
</template> </template>
</GLTable> </GLTable>
...@@ -68,35 +81,30 @@ ...@@ -68,35 +81,30 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import url from '@/assets/images/empty.png' import NP from 'number-precision'
import * as dayjs from 'dayjs' import { uploadImg } from '@/common/constant'
export default { export default {
name: 'list', name: 'list',
data () { data () {
return { return {
url, loading: false,
whiteListKey: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: { searchForm: {
activityName: '', aliasName: '',
}, },
searchFormData: [ searchFormData: [
{ {
label: '商品信息', label: '商品信息',
name: 'activityName', name: 'aliasName',
type: 'input', type: 'input',
maxlength: 40 maxlength: 40
} }
], ],
getListApi: this.$apis.goodsCouponApi.getCouponsList,
tableParams: { tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [ tableColumns: [
{ {
label: '商品编码', label: '商品编码',
prop: 'activityName', prop: 'alias',
minWidth: 100 minWidth: 100
}, },
{ {
...@@ -106,7 +114,7 @@ export default { ...@@ -106,7 +114,7 @@ export default {
}, },
{ {
label: '商品信息', label: '商品信息',
prop: 'brandId', prop: 'aliasName',
minWidth: 100 minWidth: 100
}, },
{ {
...@@ -116,24 +124,24 @@ export default { ...@@ -116,24 +124,24 @@ export default {
}, },
{ {
label: '面额/元', label: '面额/元',
prop: 'amount', prop: 'faceValue',
minWidth: 150 minWidth: 150
}, },
{ {
label: '成本/元', label: '成本/元',
prop: 'denomination', prop: 'sellPrice',
minWidth: 100 minWidth: 100
}, },
{ {
label: '库存', label: '库存',
prop: 'usableAmount', prop: 'stock',
minWidth: 100 minWidth: 100
}, },
{ {
label: '销售量', label: '销售量',
prop: 'activityStatusStr', prop: 'salesVolume',
minWidth: 100 minWidth: 100
}, },
{ {
...@@ -143,53 +151,97 @@ export default { ...@@ -143,53 +151,97 @@ export default {
}, },
] ]
}, },
tableData: [],
tableTotal: 0
} }
}, },
mounted () { mounted () {
this.getOilCouponList()
}, },
methods: { methods: {
rules (row) { async getOilCouponList () {
return [{ try {
required: true, trigger: 'blur', this.loading = true
validator: (rule, value, callback) => { const {
if (!value) callback(new Error('请填写销售价')) pageNum,
else { pageSize,
if (value < row.denomination) { } = this.$refs.listRef.page,
callback(new Error('销售价需大于等于成本价')) { searchForm } = this,
} { list, total } = await this.$apis.platformGoods.getOilCouponList({
else callback() pageNum,
} pageSize,
...searchForm
}) || {}
list && list.map(e => {
e.salesPrice = e.salesPrice ? NP.divide(e.salesPrice, 100).toFixed(2) : ''
})
this.tableData = list || []
this.tableTotal = total || 0
this.loading = false
} catch (error) {
this.loading = false
if (error) this.$message.error(error)
} }
}]
}, },
handleSearch () { handleSearch () {
this.$refs.listRef.refreshTable() this.getOilCouponList()
}, },
handleReset () { handleReset () {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch() this.handleSearch()
}, },
change (e, row) { async change (e, row) {
if (e) this.$refs[`inputRef-${row.id}`].validate(valid => { if (e && !row.salesPrice) {
if (valid) { row.status = 0
console.log(valid) return this.$message.error('请填写销售价')
} else {
row.usedAmount = false
if (!row.brandId) this.$message.error('请填写销售价')
} }
this.update({
type: 2,
id: row.id,
status: e
}) })
}, },
handleInput (row) { handleBlur (row) {
let val = row.brandId?.trim().replace(/^0+/, '') let val = row.salesPrice?.trim().replace(/^0+/, '')
if (val) { if (val) {
if (val.startsWith('.')) row.brandId = '0' + val if (!/^\d+(\.\d+)?$/.test(val)) val = ''
val = `${Math.abs(val)}`
if (val.startsWith('.')) row.salesPrice = '0' + val
if (val < Number(row.sellPrice)) val = `${row.sellPrice}`
if (val > 1000) val = '999.99' if (val > 1000) val = '999.99'
const [integerPart, decimalPart] = val.split('.') const [integerPart, decimalPart] = val.split('.')
if (decimalPart && decimalPart.length > 2) row.brandId = `${integerPart || '0'}.${decimalPart.slice(0, 2)}` if (decimalPart && decimalPart.length > 2) row.salesPrice = `${integerPart || '0'}.${decimalPart.slice(0, 2)}`
else row.brandId = val else row.salesPrice = val
} } else row.salesPrice = ''
if (row.salesPrice) this.update({
type: 1,
id: row.id,
salesPrice: NP.times(row.salesPrice, 100)
})
},
async uploadImg (e, target) {
const { url } = await uploadImg(e, this)
this.$refs[`file-${target.id}`].value = ''
if (url) this.update({
type: 0,
id: target.id,
aliasUrl: url
})
}, },
async update (params) {
try {
this.loading = true
const res = await this.$apis.platformGoods.updateOilCoupon(params)
if (res) {
this.loading = false
this.$message.success('更新成功')
this.handleSearch()
} else throw '更新失败'
} catch (error) {
this.loading = false
if (error) this.$message.error(error)
}
}
} }
} }
</script> </script>
...@@ -205,6 +257,39 @@ export default { ...@@ -205,6 +257,39 @@ export default {
.img { .img {
width: 36px; width: 36px;
height: 36px; height: 36px;
position: relative;
.mask {
display: none;
background-color: rgba($color: #000000, $alpha: 0.5);
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2;
align-items: center;
justify-content: center;
cursor: pointer;
.icon {
width: 16px;
height: 16px;
}
input {
opacity: 0;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
}
img {
width: 100%;
height: 100%;
}
&:hover .mask {
display: flex;
}
} }
.form-input { .form-input {
padding-top: 14px; padding-top: 14px;
...@@ -213,4 +298,8 @@ export default { ...@@ -213,4 +298,8 @@ export default {
padding-top: 2px; padding-top: 2px;
} }
} }
.img-plus {
width: 200px;
height: 200px;
}
</style> </style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<GLCombiForm <GLCombiForm
ref="showSearch" ref="showSearch"
:rowNumber="1" :rowNumber="2"
:formObj="searchForm" :formObj="searchForm"
:formData="searchFormData" :formData="searchFormData"
@handleOk="handleSearch" @handleOk="handleSearch"
...@@ -21,16 +21,15 @@ ...@@ -21,16 +21,15 @@
:tableParams="tableParams" :tableParams="tableParams"
:pageConf="pageConf" :pageConf="pageConf"
> >
<span <template
slot="auth-button" slot="statusStr"
slot-scope="scope" slot-scope="scope"
> >
<GLTableButton <div class="status-box">
:buttonList="tableButtonList" <span :class="['status',`status-${scope.scope.status}`]"></span>
:buttonItem="scope.scope" {{scope.scope.statusStr}}
:buttonNum="3" </div>
></GLTableButton> </template>
</span>
</GLTable> </GLTable>
</div> </div>
</div> </div>
...@@ -48,15 +47,18 @@ export default { ...@@ -48,15 +47,18 @@ export default {
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: { searchForm: {
merchantName: '', merchantName: '',
merchantId: '', phone: '',
staffName: '' orderCode: '',
oilCouponName: '',
status: '',
time: []
}, },
searchFormData: [ searchFormData: [
{ {
label: '用户手机号', label: '用户手机号',
name: 'activityName', name: 'phone',
type: 'input', type: 'input',
maxlength: 100 maxlength: 13
}, },
{ {
label: '出单门店', label: '出单门店',
...@@ -66,13 +68,13 @@ export default { ...@@ -66,13 +68,13 @@ export default {
}, },
{ {
label: '订单编号', label: '订单编号',
name: 'wechatName', name: 'orderCode',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
{ {
label: '下单时间', label: '下单时间',
name: 'showTime', name: 'time',
type: 'datePicker', type: 'datePicker',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
isClear: true, isClear: true,
...@@ -88,91 +90,91 @@ export default { ...@@ -88,91 +90,91 @@ export default {
}, },
{ {
label: '商品信息', label: '商品信息',
name: 'userPhone', name: 'oilCouponName',
type: 'input', type: 'input',
maxlength: 11 maxlength: 11
}, },
{ {
label: '订单状态', label: '订单状态',
name: 'statuses', name: 'status',
type: 'select', type: 'select',
maxlength: 100, maxlength: 100,
optionList: [ optionList: [
{ text: '全部', id: '-1,0,1' }, { text: '全部', id: '' },
{ text: '待付款', id: '0' }, { text: '待付款', id: '5' },
{ text: '已取消', id: '1' }, { text: '已取消', id: '6' },
{ text: '发放中', id: '-1' }, { text: '发放中', id: '1' },
{ text: '发放成功', id: '-2' }, { text: '发放成功', id: '2' },
{ text: '发放失败', id: '-3' }, { text: '发放失败', id: '4' },
], ],
optionId: 'id', optionId: 'id',
optionLabel: 'text' optionLabel: 'text'
}, },
], ],
getListApi: this.$apis.goodsCouponApi.getCouponsList, getListApi: this.$apis.platformGoods.getOilCouponOrderList,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: false, tableOption: false,
tableColumns: [ tableColumns: [
{ {
label: '商品编码', label: '商品编码',
prop: 'userPhone', prop: 'oilCouponAlias',
minWidth: 100 minWidth: 200
}, },
{ {
label: '商品信息', label: '商品信息',
prop: 'wechatName', prop: 'oilCouponName',
minWidth: 100 minWidth: 200
}, },
{ {
label: '销售价/元', label: '销售价/元',
prop: 'activityName', minWidth: 100,
minWidth: 100 formatter: cellValue => {
return (cellValue.salesPrice / 100).toFixed(2)
}
}, },
{ {
label: '订单金额/元', label: '订单金额/元',
minWidth: 100, minWidth: 130,
prop: 'activityName', formatter: cellValue => {
return (cellValue.orderPrice / 100).toFixed(2)
}
}, },
{ {
label: '所用积分', label: '所用积分',
minWidth: 100, minWidth: 100,
prop: 'activityName', prop: 'redeemPoints',
}, },
{ {
label: '出单门店', label: '出单门店',
minWidth: 150, prop: 'merchantName',
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}` minWidth: 200,
}, },
{ {
label: '用户手机号', label: '用户手机号',
prop: 'activityType', prop: 'phone',
minWidth: 150, minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
}, },
{ {
label: '充值手机号', label: '充值手机号',
prop: 'link', prop: 'rechargePhone',
minWidth: 150 minWidth: 150
}, },
{ {
label: '订单状态', label: '订单状态',
prop: 'showTime', minWidth: 150,
minWidth: 150 addHtml: 'statusStr'
}, },
{ {
label: '订单编号', label: '订单编号',
prop: 'showTime', prop: 'orderCode',
minWidth: 150 minWidth: 200
}, },
{ {
label: '下单时间', label: '下单时间',
prop: 'lotteryDrawTime', prop: 'receiveTime',
minWidth: 150 minWidth: 200
}, },
] ]
}, },
...@@ -192,31 +194,20 @@ export default { ...@@ -192,31 +194,20 @@ export default {
this.handleSearch() this.handleSearch()
}, },
handleExport () { handleExport () {
console.log(exportFn)
const params = this.getParams() const params = this.getParams()
this.$apis.redenvelope.exportRedEnvelopeRecord(params).then(res => { this.$apis.platformGoods.exportOilCouponOrderList({...params,...this.$refs.listRef.page}).then(res => {
exportFn(res) exportFn(res)
}) })
}, },
getParams () { getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm)) let params = JSON.parse(JSON.stringify(this.searchForm))
this.updateParams(params, 'showTime', 'showTime', 'startShowTime', 'endShowTime'); if (params.time.length) {
this.updateParams(params, 'lotteryDrawTime', 'lotteryDrawTime', 'startLotteryDrawTime', 'endLotteryDrawTime'); params.startReceiveTimeStr = `${dayjs(params.time[0]).format('YYYY-MM-DD')} 00:00:00`
return params params.endReceiveTimeStr = `${dayjs(params.time[1]).format('YYYY-MM-DD')} 23:59:59`
}, delete params.time
updateParams (params, paramKey, formKey, beginKey, endKey) {
if (params[paramKey]) {
params[beginKey] = this.searchForm[formKey][0];
params[endKey] = this.searchForm[formKey][1];
delete params[paramKey];
} else {
delete params[beginKey];
delete params[endKey];
} }
// delete params[paramKey];
return params return params
} },
} }
} }
</script> </script>
...@@ -239,4 +230,21 @@ export default { ...@@ -239,4 +230,21 @@ export default {
} }
} }
} }
.status-box {
display: flex;
align-items: center;
.status {
width: 6px;
height: 6px;
border-radius: 4px;
background: #fdb757;
margin-right: 8px;
}
.status-2 {
background: #2cca74;
}
.status-4 {
background: #999999;
}
}
</style> </style>
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
<GLTabs <GLTabs
v-model="currentComponent" v-model="currentComponent"
:tabPaneList="tabPaneList" :tabPaneList="tabPaneList"
@tab-click="handleClick"
></GLTabs> ></GLTabs>
</div> </div>
<div class="component"> <div class="component">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!