|
|
@@ -8,6 +8,7 @@
|
|
|
<el-link :underline="true" @click="AmountShowFn(scope.row,'1')" style="font-size:12px;display:inline-block;">{{ scope.row.totalIncome }}</el-link>
|
|
|
</template>
|
|
|
<template #slot-apply="{scope}">
|
|
|
+ <el-button type="text" @click="editShop(scope.row)">修改信息</el-button>
|
|
|
<el-button type="text" @click="addStaff(scope.row)">添加员工</el-button>
|
|
|
<el-button type="text" @click="clearStock(scope.row)">清库存</el-button>
|
|
|
</template>
|
|
|
@@ -22,15 +23,19 @@
|
|
|
</template>
|
|
|
|
|
|
<template #table-column-hasRenew="{scope}">
|
|
|
- <span v-if="scope.row.hasRenew == 0" style="color:#CCCCCC;">-</span>
|
|
|
- <span v-else style="color:blue;">
|
|
|
- 已续
|
|
|
- </span>
|
|
|
+ <span v-if="scope.row.hasRenew == 0" style="color:#999999;">未续费</span>
|
|
|
+ <span v-else style="color:blue;">已续费</span>
|
|
|
</template>
|
|
|
|
|
|
<template #table-column-deadline="{scope}">
|
|
|
<span>
|
|
|
- {{ scope.row.deadline?scope.row.deadline.substr(0,11):'' }}
|
|
|
+ {{ scope.row.deadline ? scope.row.deadline.substr(0,16) : '-' }}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #table-column-beforeDeadline="{scope}">
|
|
|
+ <span>
|
|
|
+ {{ scope.row.beforeDeadline ? scope.row.beforeDeadline.substr(0,16) : '-' }}
|
|
|
</span>
|
|
|
</template>
|
|
|
|
|
|
@@ -44,6 +49,18 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
|
|
|
+ <template #slot-batch-btn>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ style="margin-left: 10px;"
|
|
|
+ :disabled="selectedShops.length === 0"
|
|
|
+ @click="batchEditShop"
|
|
|
+ >
|
|
|
+ 批量修改信息 ({{ selectedShops.length }})
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
</x-crud>
|
|
|
|
|
|
<balance-detail v-if='showBalanceDetail' @closeFn='showBalanceDetail = false' ref="balanceDetail" :orderOperate="optionData" />
|
|
|
@@ -82,11 +99,130 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 修改门店信息弹窗 -->
|
|
|
+ <el-dialog :visible.sync="editShopPop" :close-on-click-modal="false" width="550px" title="修改门店信息">
|
|
|
+ <el-form :model="editShopForm" :rules="editShopRule" ref="editShopRef" label-width="110px" class="demo-form">
|
|
|
+ <el-form-item label="门店">
|
|
|
+ <span style="font-weight: bold; color: #333;">{{ editShopForm.merchantName }} - {{ editShopForm.shopName }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商户号" prop="lklSjNo">
|
|
|
+ <el-input placeholder="请输入拉卡拉商户号" size="small" v-model="editShopForm.lklSjNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="B2B终端号" prop="lklB2BTermNo">
|
|
|
+ <el-input placeholder="请输入B2B终端号" size="small" v-model="editShopForm.lklB2BTermNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="扫码终端号" prop="lklScanTermNo">
|
|
|
+ <el-input placeholder="请输入扫码终端号" size="small" v-model="editShopForm.lklScanTermNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="到期时间" prop="deadline">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="editShopForm.deadline"
|
|
|
+ type="datetime"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ placeholder="选择到期时间"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%;"
|
|
|
+ ></el-date-picker>
|
|
|
+ <div style="margin-top: 6px; display: flex; align-items: center; gap: 8px;">
|
|
|
+ <span style="font-size: 12px; color: #888;">快捷选择:</span>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickDeadline('edit', 'halfYear')">半年</el-button>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickDeadline('edit', 'oneYear')">明年</el-button>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickDeadline('edit', 'twoYears')">后年</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上次到期时间" prop="beforeDeadline">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="editShopForm.beforeDeadline"
|
|
|
+ type="datetime"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ placeholder="选择上次到期时间"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%;"
|
|
|
+ ></el-date-picker>
|
|
|
+ <div style="margin-top: 6px; display: flex; align-items: center; gap: 8px;">
|
|
|
+ <span style="font-size: 12px; color: #888;">快捷选择:</span>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickBeforeDeadline('edit')">此刻</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="续费状态" prop="hasRenew">
|
|
|
+ <el-radio-group v-model="editShopForm.hasRenew">
|
|
|
+ <el-radio :label="0">未续费</el-radio>
|
|
|
+ <el-radio :label="1">已续费</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="resetEditShopForm">取 消</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="putEditShopForm">确 认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 批量修改门店信息弹窗 -->
|
|
|
+ <el-dialog :visible.sync="batchEditShopPop" :close-on-click-modal="false" width="580px" title="批量修改门店信息">
|
|
|
+ <div style="margin-bottom: 15px; padding: 10px 12px; background: #e6f7ff; border: 1px solid #91d5ff; border-radius: 4px; font-size: 13px; color: #1890ff;">
|
|
|
+ <div>已选择 <b>{{ selectedShops.length }}</b> 家门店:<span style="color: #333; word-break: break-all;">{{ selectedShopsNames }}</span></div>
|
|
|
+ <div style="margin-top: 4px; color: #ff4d4f; font-size: 12px;">说明:不填或选择“不修改”的字段将保持各个门店原本的数值。</div>
|
|
|
+ </div>
|
|
|
+ <el-form :model="batchEditShopForm" ref="batchEditShopRef" label-width="110px" class="demo-form">
|
|
|
+ <el-form-item label="商户号">
|
|
|
+ <el-input placeholder="留空则不修改" size="small" v-model="batchEditShopForm.lklSjNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="B2B终端号">
|
|
|
+ <el-input placeholder="留空则不修改" size="small" v-model="batchEditShopForm.lklB2BTermNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="扫码终端号">
|
|
|
+ <el-input placeholder="留空则不修改" size="small" v-model="batchEditShopForm.lklScanTermNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="到期时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="batchEditShopForm.deadline"
|
|
|
+ type="datetime"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ placeholder="不选则不修改"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%;"
|
|
|
+ ></el-date-picker>
|
|
|
+ <div style="margin-top: 6px; display: flex; align-items: center; gap: 8px;">
|
|
|
+ <span style="font-size: 12px; color: #888;">快捷选择:</span>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickDeadline('batch', 'halfYear')">半年</el-button>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickDeadline('batch', 'oneYear')">明年</el-button>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickDeadline('batch', 'twoYears')">后年</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上次到期时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="batchEditShopForm.beforeDeadline"
|
|
|
+ type="datetime"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ placeholder="不选则不修改"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%;"
|
|
|
+ ></el-date-picker>
|
|
|
+ <div style="margin-top: 6px; display: flex; align-items: center; gap: 8px;">
|
|
|
+ <span style="font-size: 12px; color: #888;">快捷选择:</span>
|
|
|
+ <el-button size="mini" type="primary" plain @click="setQuickBeforeDeadline('batch')">此刻</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="续费状态">
|
|
|
+ <el-radio-group v-model="batchEditShopForm.hasRenew">
|
|
|
+ <el-radio :label="-1">不修改</el-radio>
|
|
|
+ <el-radio :label="0">未续费</el-radio>
|
|
|
+ <el-radio :label="1">已续费</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="resetBatchEditShopForm">取 消</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="putBatchEditShopForm">确 认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import balanceDetail from './components/balance-detail';
|
|
|
import amountDetail from './components/amount-detail';
|
|
|
+import dayjs from 'dayjs';
|
|
|
export default {
|
|
|
components:{balanceDetail,amountDetail},
|
|
|
data() {
|
|
|
@@ -115,9 +251,38 @@ export default {
|
|
|
},
|
|
|
clearStockRule:{
|
|
|
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
|
|
|
+ },
|
|
|
+ editShopPop: false,
|
|
|
+ editShopForm: {
|
|
|
+ id: '',
|
|
|
+ merchantName: '',
|
|
|
+ shopName: '',
|
|
|
+ lklSjNo: '',
|
|
|
+ lklB2BTermNo: '',
|
|
|
+ lklScanTermNo: '',
|
|
|
+ deadline: '',
|
|
|
+ beforeDeadline: '',
|
|
|
+ hasRenew: 0
|
|
|
+ },
|
|
|
+ editShopRule: {},
|
|
|
+ editShopOriginalDeadline: '',
|
|
|
+ selectedShops: [],
|
|
|
+ batchEditShopPop: false,
|
|
|
+ batchEditShopForm: {
|
|
|
+ lklSjNo: '',
|
|
|
+ lklB2BTermNo: '',
|
|
|
+ lklScanTermNo: '',
|
|
|
+ deadline: '',
|
|
|
+ beforeDeadline: '',
|
|
|
+ hasRenew: -1
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ selectedShopsNames() {
|
|
|
+ return this.selectedShops.map(e => e.shopName || e.merchantName || ('ID:' + e.id)).join('、');
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -127,6 +292,116 @@ export default {
|
|
|
this.app.refresh()
|
|
|
})
|
|
|
},
|
|
|
+ editShop(shop) {
|
|
|
+ this.editShopOriginalDeadline = shop.deadline || '';
|
|
|
+ this.editShopForm = {
|
|
|
+ id: shop.id,
|
|
|
+ merchantName: shop.merchantName || '',
|
|
|
+ shopName: shop.shopName || '',
|
|
|
+ lklSjNo: shop.lklSjNo || '',
|
|
|
+ lklB2BTermNo: shop.lklB2BTermNo || '',
|
|
|
+ lklScanTermNo: shop.lklScanTermNo || '',
|
|
|
+ deadline: shop.deadline || '',
|
|
|
+ beforeDeadline: shop.beforeDeadline || '',
|
|
|
+ hasRenew: shop.hasRenew != null ? Number(shop.hasRenew) : 0
|
|
|
+ };
|
|
|
+ this.editShopPop = true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 到期时间快捷选择 (半年、明年、后年)
|
|
|
+ * @param {string} type 'edit' | 'batch'
|
|
|
+ * @param {string} durationKey 'halfYear' | 'oneYear' | 'twoYears'
|
|
|
+ */
|
|
|
+ setQuickDeadline(type, durationKey) {
|
|
|
+ let base = dayjs();
|
|
|
+ if (type === 'edit') {
|
|
|
+ const orig = this.editShopOriginalDeadline;
|
|
|
+ if (orig && dayjs(orig).isValid() && dayjs(orig).isAfter(dayjs())) {
|
|
|
+ base = dayjs(orig);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let resultDate = base;
|
|
|
+ if (durationKey === 'halfYear') {
|
|
|
+ resultDate = base.add(6, 'month');
|
|
|
+ } else if (durationKey === 'oneYear') {
|
|
|
+ resultDate = base.add(1, 'year');
|
|
|
+ } else if (durationKey === 'twoYears') {
|
|
|
+ resultDate = base.add(2, 'year');
|
|
|
+ }
|
|
|
+
|
|
|
+ const formatted = resultDate.format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ if (type === 'edit') {
|
|
|
+ this.editShopForm.deadline = formatted;
|
|
|
+ } else if (type === 'batch') {
|
|
|
+ this.batchEditShopForm.deadline = formatted;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 上次到期时间快捷选择 (此刻)
|
|
|
+ * @param {string} type 'edit' | 'batch'
|
|
|
+ */
|
|
|
+ setQuickBeforeDeadline(type) {
|
|
|
+ const nowFormatted = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ if (type === 'edit') {
|
|
|
+ this.editShopForm.beforeDeadline = nowFormatted;
|
|
|
+ } else if (type === 'batch') {
|
|
|
+ this.batchEditShopForm.beforeDeadline = nowFormatted;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ resetEditShopForm() {
|
|
|
+ if (this.$refs['editShopRef']) {
|
|
|
+ this.$refs['editShopRef'].resetFields();
|
|
|
+ }
|
|
|
+ this.editShopPop = false;
|
|
|
+ },
|
|
|
+ putEditShopForm() {
|
|
|
+ this.$refs['editShopRef'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.$service.shop.update(this.editShopForm).then(() => {
|
|
|
+ this.$message.success('修改成功');
|
|
|
+ this.editShopPop = false;
|
|
|
+ this.app.refresh();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ batchEditShop() {
|
|
|
+ if (this.selectedShops.length === 0) {
|
|
|
+ this.$message.warning('请先勾选要批量修改的门店');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.batchEditShopForm = {
|
|
|
+ lklSjNo: '',
|
|
|
+ lklB2BTermNo: '',
|
|
|
+ lklScanTermNo: '',
|
|
|
+ deadline: '',
|
|
|
+ beforeDeadline: '',
|
|
|
+ hasRenew: -1
|
|
|
+ };
|
|
|
+ this.batchEditShopPop = true;
|
|
|
+ },
|
|
|
+ resetBatchEditShopForm() {
|
|
|
+ this.batchEditShopPop = false;
|
|
|
+ },
|
|
|
+ putBatchEditShopForm() {
|
|
|
+ const form = this.batchEditShopForm;
|
|
|
+ if (!form.lklSjNo && !form.lklB2BTermNo && !form.lklScanTermNo && !form.deadline && !form.beforeDeadline && form.hasRenew === -1) {
|
|
|
+ this.$message.warning('请至少选择或填写一项要修改的内容');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const ids = this.selectedShops.map(e => e.id);
|
|
|
+ const postData = {
|
|
|
+ ids: ids,
|
|
|
+ isBatch: 1,
|
|
|
+ ...form
|
|
|
+ };
|
|
|
+ this.$service.shop.update(postData).then(() => {
|
|
|
+ this.$message.success(`成功批量修改 ${ids.length} 家门店的信息`);
|
|
|
+ this.batchEditShopPop = false;
|
|
|
+ this.app.refresh();
|
|
|
+ });
|
|
|
+ },
|
|
|
clearStock(shop){
|
|
|
this.clearStockPop = true
|
|
|
this.clearStockForm.shopId = shop.id
|
|
|
@@ -158,6 +433,11 @@ export default {
|
|
|
ctx.service(this.$service.shop)
|
|
|
.set('table', {
|
|
|
columns: [
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ width: '50'
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'id',
|
|
|
label: 'ID',
|
|
|
@@ -213,14 +493,20 @@ export default {
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- prop: 'needRenew',
|
|
|
- label: '提醒',
|
|
|
- width: '90',
|
|
|
+ prop: 'deadline',
|
|
|
+ label: '到期时间',
|
|
|
+ width: '120',
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- prop: 'deadline',
|
|
|
- label: '过期时间',
|
|
|
+ prop: 'beforeDeadline',
|
|
|
+ label: '上次到期',
|
|
|
+ width: '120',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'needRenew',
|
|
|
+ label: '提醒',
|
|
|
width: '90',
|
|
|
align: 'center'
|
|
|
},
|
|
|
@@ -249,12 +535,17 @@ export default {
|
|
|
op: {
|
|
|
visible: true,
|
|
|
props: {
|
|
|
- width: 190,
|
|
|
+ width: 240,
|
|
|
align: 'center',
|
|
|
fixed: 'right',
|
|
|
label: '操作'
|
|
|
},
|
|
|
layout: ['slot-apply']
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ 'selection-change': selection => {
|
|
|
+ this.selectedShops = selection;
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.set('dict', {
|
|
|
@@ -264,14 +555,14 @@ export default {
|
|
|
})
|
|
|
.set('search', {
|
|
|
key: {
|
|
|
- placeholder: '请填写名称,支持拼音字母',
|
|
|
+ placeholder: '请填写名称/手机号,支持拼音字母',
|
|
|
},
|
|
|
})
|
|
|
.set('pagination', {
|
|
|
size: 50
|
|
|
})
|
|
|
.set('layout', [
|
|
|
- ['slot-tabs'],['search-key'],
|
|
|
+ ['slot-tabs'],['search-key', 'slot-batch-btn'],
|
|
|
['flex1', 'refresh-btn'],
|
|
|
['data-table'],
|
|
|
['flex1', 'pagination']
|