Commit daa38f04 by 李伟康

提交

1 parent f53d7fbe
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)
}
export {
exportFn
}
\ 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"
></GLCombiForm>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<template
slot="IMG"
slot-scope="scope"
>
<template>
<img
class="img"
:src="scope.scope.goodsImage"
>
</template>
</template>
<template
slot="INPUT"
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
v-model.trim="scope.scope.brandId"
size="small"
@blur="handleInput(scope.scope)"
></el-input>
</el-form-item>
</el-form>
</template>
<template
slot="SWITCH"
slot-scope="scope"
>
<el-switch
v-model="scope.scope.usedAmount"
@change="change($event,scope.scope)"
></el-switch>
</template>
</GLTable>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/images/empty.png'
import * as dayjs from 'dayjs'
export default {
name: 'list',
data () {
return {
url,
whiteListKey: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
activityName: '',
},
searchFormData: [
{
label: '商品信息',
name: 'activityName',
type: 'input',
maxlength: 40
}
],
getListApi: this.$apis.goodsCouponApi.getCouponsList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '商品编码',
prop: 'activityName',
minWidth: 100
},
{
label: '商品图片',
addHtml: 'IMG',
minWidth: 100
},
{
label: '商品信息',
prop: 'brandId',
minWidth: 100
},
{
label: '销售价/元',
addHtml: 'INPUT',
minWidth: 150
},
{
label: '面额/元',
prop: 'amount',
minWidth: 150
},
{
label: '成本/元',
prop: 'denomination',
minWidth: 100
},
{
label: '库存',
prop: 'usableAmount',
minWidth: 100
},
{
label: '销售量',
prop: 'activityStatusStr',
minWidth: 100
},
{
label: '上架开关',
addHtml: 'SWITCH',
minWidth: 100
},
]
},
}
},
mounted () {
},
methods: {
rules (row) {
return [{
required: true, trigger: 'blur',
validator: (rule, value, callback) => {
if (!value) callback(new Error('请填写销售价'))
else {
if (value < row.denomination) {
callback(new Error('销售价需大于等于成本价'))
}
else callback()
}
}
}]
},
handleSearch () {
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
change (e, row) {
if (e) this.$refs[`inputRef-${row.id}`].validate(valid => {
if (valid) {
console.log(valid)
} else {
row.usedAmount = false
if (!row.brandId) this.$message.error('请填写销售价')
}
})
},
handleInput (row) {
let val = row.brandId?.trim().replace(/^0+/, '')
if (val) {
if (val.startsWith('.')) row.brandId = '0' + val
if (val > 1000) val = '999.99'
const [integerPart, decimalPart] = val.split('.')
if (decimalPart && decimalPart.length > 2) row.brandId = `${integerPart || '0'}.${decimalPart.slice(0, 2)}`
else row.brandId = val
}
},
}
}
</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;
}
.form-input {
padding-top: 14px;
margin-bottom: 14px;
/deep/.el-form-item__error {
padding-top: 2px;
}
}
</style>
<template>
<div class="container">
<GLCombiForm
ref="showSearch"
:rowNumber="1"
: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"
>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</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: '',
merchantId: '',
staffName: ''
},
searchFormData: [
{
label: '用户手机号',
name: 'activityName',
type: 'input',
maxlength: 100
},
{
label: '出单门店',
name: 'merchantName',
type: 'input',
maxlength: 100
},
{
label: '订单编号',
name: 'wechatName',
type: 'input',
maxlength: 100
},
{
label: '下单时间',
name: 'showTime',
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: 'userPhone',
type: 'input',
maxlength: 11
},
{
label: '订单状态',
name: 'statuses',
type: 'select',
maxlength: 100,
optionList: [
{ text: '全部', id: '-1,0,1' },
{ text: '待付款', id: '0' },
{ text: '已取消', id: '1' },
{ text: '发放中', id: '-1' },
{ text: '发放成功', id: '-2' },
{ text: '发放失败', id: '-3' },
],
optionId: 'id',
optionLabel: 'text'
},
],
getListApi: this.$apis.goodsCouponApi.getCouponsList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '商品编码',
prop: 'userPhone',
minWidth: 100
},
{
label: '商品信息',
prop: 'wechatName',
minWidth: 100
},
{
label: '销售价/元',
prop: 'activityName',
minWidth: 100
},
{
label: '订单金额/元',
minWidth: 100,
prop: 'activityName',
},
{
label: '所用积分',
minWidth: 100,
prop: 'activityName',
},
{
label: '出单门店',
minWidth: 150,
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}`
},
{
label: '用户手机号',
prop: 'activityType',
minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
},
{
label: '充值手机号',
prop: 'link',
minWidth: 150
},
{
label: '订单状态',
prop: 'showTime',
minWidth: 150
},
{
label: '订单编号',
prop: 'showTime',
minWidth: 150
},
{
label: '下单时间',
prop: 'lotteryDrawTime',
minWidth: 150
},
]
},
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 () {
console.log(exportFn)
const params = this.getParams()
this.$apis.redenvelope.exportRedEnvelopeRecord(params).then(res => {
exportFn(res)
})
},
getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm))
this.updateParams(params, 'showTime', 'showTime', 'startShowTime', 'endShowTime');
this.updateParams(params, 'lotteryDrawTime', 'lotteryDrawTime', 'startLotteryDrawTime', 'endLotteryDrawTime');
return params
},
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
}
}
}
</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;
}
}
}
</style>
<template>
<div class="layout">
<div class="tabs">
<GLTabs
v-model="currentComponent"
:tabPaneList="tabPaneList"
@tab-click="handleClick"
></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!