Commit 875e4704 by 前端

Merge branch 'v3.22.1' into 'master'

合并V3.22.1

See merge request !27
2 parents f53d7fbe bc65c660
...@@ -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
} }
function getExplorer () {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
}
function exportFn (url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
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 {
exportFn,
uploadImg
}
\ No newline at end of file \ No newline at end of file
...@@ -19,8 +19,19 @@ module.exports = { ...@@ -19,8 +19,19 @@ module.exports = {
}, },
request: { request: {
// baseURL: 'http://192.168.3.171:7300/mock/6136bea6ceeb5a5c2bec6950/', // baseURL: 'http://192.168.3.171:7300/mock/6136bea6ceeb5a5c2bec6950/',
// baseURL: 'http://scrm.test.glsx.com.cn/', baseURL: 'https://scrm.dev.glsx.com.cn/',
baseURL: 'http://192.168.2.60:7226/rop-scrm-equity/router', // baseURL: 'http://192.168.2.60:7226/rop-scrm-equity/router',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
other_request:{
// baseURL: 'http://192.168.3.171:7300/mock/6136bea6ceeb5a5c2bec6950/',
baseURL: 'https://scrm.dev.glsx.com.cn/',
// baseURL: 'http://192.168.2.60:7226/rop-scrm-equity/router',
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
......
<template>
<div class="container">
<div class="sticky">
<GLCombiForm
ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
@submit.native.prevent
></GLCombiForm>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:tableData="tableData"
:tableParams="tableParams"
:pageConf="pageConf"
:tableTotal="tableTotal"
@refreshTable="getOilCouponList"
v-loading="loading"
>
<template
slot="IMG"
slot-scope="scope"
>
<el-popover
placement="top"
trigger="hover"
>
<img
class="img-plus"
:src="scope.scope.aliasUrl"
/>
<div
slot="reference"
class="img"
>
<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
slot="INPUT"
slot-scope="scope"
>
<el-input
v-model="scope.scope.InputPrice"
size="small"
@blur="handleBlur(scope.scope)"
maxlength="6"
></el-input>
</template>
<template
slot="SWITCH"
slot-scope="scope"
>
<el-switch
v-model="scope.scope.status"
@change="change($event,scope.scope)"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</GLTable>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import NP from 'number-precision'
import { uploadImg } from '@/common/constant'
export default {
name: 'list',
data () {
return {
loading: false,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
aliasName: '',
},
searchFormData: [
{
label: '商品信息',
name: 'aliasName',
type: 'input',
maxlength: 40
}
],
tableParams: {
tableColumns: [
{
label: '商品编码',
prop: 'alias',
minWidth: 100
},
{
label: '商品图片',
addHtml: 'IMG',
minWidth: 100
},
{
label: '商品信息',
prop: 'aliasName',
minWidth: 100
},
{
label: '销售价/元',
addHtml: 'INPUT',
minWidth: 150
},
{
label: '面额/元',
prop: 'faceValue',
minWidth: 150
},
{
label: '成本/元',
prop: 'sellPrice',
minWidth: 100
},
{
label: '库存',
minWidth: 100,
formatter: cellValue => {
return cellValue.stock - cellValue.usedStock
}
},
{
label: '销售量',
prop: 'salesVolume',
minWidth: 100
},
{
label: '上架开关',
addHtml: 'SWITCH',
minWidth: 100
},
]
},
tableData: [],
tableTotal: 0
}
},
mounted () {
this.getOilCouponList()
},
methods: {
async getOilCouponList () {
try {
this.loading = true
const {
pageNum,
pageSize,
} = this.$refs.listRef.page,
{ searchForm } = this,
{ list, total } = await this.$apis.platformGoods.getOilCouponList({
pageNum,
pageSize,
...searchForm
}) || {}
list && list.map(e => {
let price = e.salesPrice ? NP.divide(e.salesPrice, 100).toFixed(2) : ''
e.InputPrice = price
e.salesPrice = price
})
this.tableData = list || []
this.tableTotal = total || 0
this.loading = false
} catch (error) {
this.loading = false
if (error) this.$message.error(error)
}
},
handleSearch () {
this.getOilCouponList()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.$refs.listRef.page = {
pageNum: 1,
pageSize: 10
}
this.handleSearch()
},
async change (e, row) {
if (e && !row.salesPrice) {
row.status = 0
return this.$message.error('请填写销售价')
}
this.update({
type: 2,
id: row.id,
status: e
}, e == 0 ? '下架' : '上架')
},
handleBlur (row) {
let { salesPrice, InputPrice, sellPrice } = row
if (!InputPrice) return
try {
if (InputPrice) {
if (InputPrice.startsWith('.')) InputPrice = '0' + InputPrice
if (Number(InputPrice) < Number(sellPrice)) throw '销售价需大于等于成本价'
if (InputPrice > 1000) InputPrice = 999.99
InputPrice = Number(InputPrice).toFixed(2)
} else throw '销售价需大于等于成本价'
if (!/^\d+(\.\d+)?$/.test(InputPrice)) throw '请输入数字'
if (InputPrice != Number(salesPrice)) this.update({
type: 1,
id: row.id,
salesPrice: NP.times(InputPrice, 100)
}, '更新销售价')
} catch (error) {
row.InputPrice = salesPrice ? salesPrice : ''
if (error) this.$message.error(error)
}
},
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, message) {
try {
this.loading = true
const res = await this.$apis.platformGoods.updateOilCoupon(params)
if (res) {
this.loading = false
this.$message.success(`${message}成功`)
this.handleSearch()
} else throw `${message}失败`
} catch (error) {
this.loading = false
if (error) this.$message.error(error)
}
}
}
}
</script>
<style scoped lang='scss'>
.container {
height: 100%;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
}
.img {
width: 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 {
padding-top: 14px;
margin-bottom: 14px;
/deep/.el-form-item__error {
padding-top: 2px;
}
}
.img-plus {
width: 200px;
height: 200px;
}
</style>
<template>
<div class="container">
<GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<el-button @click="handleExport">导出
</el-button>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<template
slot="statusStr"
slot-scope="scope"
>
<div class="status-box">
<span :class="['status',`status-${scope.scope.status}`]"></span>
{{scope.scope.statusStr}}
</div>
</template>
</GLTable>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/images/empty.png'
import * as dayjs from 'dayjs'
import { exportFn } from '@/common/constant'
export default {
name: 'RedEnvelopeConfig',
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
merchantName: '',
phone: '',
orderCode: '',
oilCouponName: '',
status: '',
time: []
},
searchFormData: [
{
label: '用户手机号',
name: 'phone',
type: 'input',
maxlength: 13
},
{
label: '出单门店',
name: 'merchantName',
type: 'input',
maxlength: 100
},
{
label: '订单编号',
name: 'orderCode',
type: 'input',
maxlength: 100
},
{
label: '下单时间',
name: 'time',
type: 'datePicker',
valueFormat: 'yyyy-MM-dd',
isClear: true,
customPickerOptions: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
if (date > yesterday) {
return true
}
return false
}
}
},
{
label: '商品信息',
name: 'oilCouponName',
type: 'input',
maxlength: 11
},
{
label: '订单状态',
name: 'status',
type: 'select',
maxlength: 100,
optionList: [
{ text: '全部', id: '' },
{ text: '待付款', id: '5' },
{ text: '已取消', id: '6' },
{ text: '发放中', id: '1' },
{ text: '发放成功', id: '2' },
{ text: '发放失败', id: '4' },
],
optionId: 'id',
optionLabel: 'text'
},
{
label: '订单类型',
name: 'receiveWay',
type: 'select',
maxlength: 100,
optionList: [
{ text: '全部', id: '' },
{ text: '积分导入', id: '1' },
{ text: '用户购买', id: '0' }
],
optionId: 'id',
optionLabel: 'text'
},
],
getListApi: this.$apis.platformGoods.getOilCouponOrderList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '商品编码',
prop: 'oilCouponAlias',
minWidth: 200
},
{
label: '商品信息',
prop: 'oilCouponName',
minWidth: 200
},
{
label: '销售价/元',
minWidth: 100,
formatter: cellValue => {
return cellValue.salesPrice ? (cellValue.salesPrice / 100).toFixed(2) : '--'
}
},
{
label: '订单金额/元',
minWidth: 130,
formatter: cellValue => {
return cellValue.orderPrice ? (cellValue.orderPrice / 100).toFixed(2) : '--'
}
},
{
label: '所用积分',
minWidth: 100,
prop: 'redeemPoints',
},
{
label: '出单门店',
prop: 'merchantName',
minWidth: 200,
},
{
label: '用户手机号',
prop: 'phone',
minWidth: 150,
},
{
label: '充值手机号',
prop: 'rechargePhone',
minWidth: 150
},
{
label: '订单状态',
minWidth: 150,
addHtml: 'statusStr'
},
{
label: '订单类型',
minWidth: 150,
formatter: cellValue => {
return {
0: '用户购买',
1: '积分导入'
}[cellValue.receiveWay]
}
},
{
label: '订单编号',
prop: 'orderCode',
minWidth: 200
},
{
label: '下单时间',
prop: 'receiveTime',
minWidth: 200
},
]
},
showImportRecord: false,
tableSearchForm: {}
}
},
mounted () {
},
methods: {
handleSearch () {
this.tableSearchForm = this.getParams()
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
handleExport () {
const params = this.getParams()
this.$apis.platformGoods.exportOilCouponOrderList({ ...params, ...this.$refs.listRef.page }).then(res => {
exportFn(res)
})
},
getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm))
if (params.time.length) {
params.startReceiveTimeStr = `${dayjs(params.time[0]).format('YYYY-MM-DD')} 00:00:00`
params.endReceiveTimeStr = `${dayjs(params.time[1]).format('YYYY-MM-DD')} 23:59:59`
delete params.time
}
return params
},
}
}
</script>
<style scoped lang='scss'>
.container {
height: 100%;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
.sticky-btns {
margin-bottom: 10px;
display: flex;
.el-button {
margin-left: auto;
padding: 8px 15px;
min-width: 60px;
}
}
}
.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>
<template>
<div class="layout">
<div class="tabs">
<GLTabs
v-model="currentComponent"
:tabPaneList="tabPaneList"
></GLTabs>
</div>
<div class="component">
<component :is="currentComponent"></component>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import list from './components/list/index.vue'
import order from './components/order/index.vue'
export default {
name: '',
components: {
list,
order
},
data () {
return {
currentComponent: 'list',
tabPaneList: [
{
label: '油券列表',
name: 'list'
},
{
label: '油券订单',
name: 'order'
}
]
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.tabs {
margin-bottom: 16px;
}
</style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!