|
@@ -0,0 +1,165 @@
|
|
|
+<template>
|
|
|
+ <a-card size="small" :bordered="false" class="approveStore-wrap">
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="经销商名称">
|
|
|
+ <storeList ref="storeList" @change="custChange"></storeList>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="商城状态">
|
|
|
+ <v-select
|
|
|
+ v-model="queryParam.openFlag"
|
|
|
+ ref="openFlag"
|
|
|
+ id="approveStore-openFlag"
|
|
|
+ code="OPEN_FLAG"
|
|
|
+ placeholder="请选择商城状态"
|
|
|
+ allowClear></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <div>
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="approveStore-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="approveStore-reset">重置</a-button>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable fixPagination"
|
|
|
+ ref="table"
|
|
|
+ :style="{ height: tableHeight+84.5+'px' }"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ y: tableHeight }"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>
|
|
|
+ <!-- 商城状态-->
|
|
|
+ <template slot="statusVal" slot-scope="text, record">
|
|
|
+ <a-switch checked-children="开启" un-checked-children="关闭" v-model="record.statusFlag" @change="e=>handleStatus(e,record)"/>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-spin>
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// 组件
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import storeList from '@/views/common/storeList.vue'
|
|
|
+// 接口
|
|
|
+import { findMallParamList, updateMallParam } from '@/api/dealerBizParam'
|
|
|
+export default {
|
|
|
+ components: { STable, VSelect, storeList },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ tableHeight: 0, // 表格高度
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ // 查询条件
|
|
|
+ queryParam: {
|
|
|
+ dealerName: undefined, // 经销商名称
|
|
|
+ delearSn: undefined,
|
|
|
+ openFlag: undefined// 商城状态
|
|
|
+ },
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
|
|
|
+ { title: '经销商名称', dataIndex: 'dealerName', width: '40%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '最后操作时间', dataIndex: 'updateDate', width: '35%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '商城状态', dataIndex: 'paramValue', width: '20%', align: 'center', scopedSlots: { customRender: 'statusVal' } }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ return findMallParamList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ let data
|
|
|
+ if (res.status == 200) {
|
|
|
+ data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
+ data.list[i].statusFlag = data.list[i].paramValue == '1'
|
|
|
+ }
|
|
|
+ this.disabled = false
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ custChange (val) {
|
|
|
+ this.queryParam.delearSn = val.key
|
|
|
+ this.queryParam.dealerName = val.label.match(/[\u4e00-\u9fff]+/g).join('')
|
|
|
+ },
|
|
|
+ // 修改商城状态
|
|
|
+ handleStatus (val, row) {
|
|
|
+ const _this = this
|
|
|
+ _this.spinning = true
|
|
|
+ updateMallParam({
|
|
|
+ tenantId: row.tenantId,
|
|
|
+ paramValue: row.paramValue == '0' ? '1' : '0'
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ _this.spinning = false
|
|
|
+ } else {
|
|
|
+ _this.spinning = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam.dealerName = undefined
|
|
|
+ this.queryParam.delearSn = undefined
|
|
|
+ this.queryParam.openFlag = undefined
|
|
|
+ this.$refs.storeList.resetForm()
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ setTableH () {
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 420
|
|
|
+ },
|
|
|
+ pageInit () {
|
|
|
+ const _this = this
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
+ _this.setTableH()
|
|
|
+ _this.resetSearchForm()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
+ this.pageInit()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
+ this.setTableH()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
+ this.pageInit()
|
|
|
+ }
|
|
|
+ // 仅刷新列表,不重置页面
|
|
|
+ if (this.$store.state.app.updateList) {
|
|
|
+ this.setTableH()
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|