Commit e9908e309d613b639953c1fb0aaf67c228f0ac71

Authored by wuxw
1 parent f22ec63c

开发完成admin供应商功能

src/api/scm/supplierCouponApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取供应商列表
  4 +export function getSupplierList(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/supplier.listSupplier',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + if (res.code === 0) {
  13 + resolve(res)
  14 + } else {
  15 + reject(new Error(res.msg || 'Failed to get supplier list'))
  16 + }
  17 + }).catch(error => {
  18 + reject(error)
  19 + })
  20 + })
  21 +}
  22 +
  23 +// 获取优惠券列表
  24 +export function getSupplierCouponList(params) {
  25 + return new Promise((resolve, reject) => {
  26 + request({
  27 + url: '/supplierCoupon.listSupplierCoupon',
  28 + method: 'get',
  29 + params
  30 + }).then(response => {
  31 + const res = response.data
  32 + if (res.code === 0) {
  33 + resolve(res)
  34 + } else {
  35 + reject(new Error(res.msg || 'Failed to get coupon list'))
  36 + }
  37 + }).catch(error => {
  38 + reject(error)
  39 + })
  40 + })
  41 +}
  42 +
  43 +// 添加优惠券
  44 +export function addSupplierCoupon(data) {
  45 + return new Promise((resolve, reject) => {
  46 + request({
  47 + url: '/supplierCoupon.saveSupplierCoupon',
  48 + method: 'post',
  49 + data
  50 + }).then(response => {
  51 + const res = response.data
  52 + if (res.code === 0) {
  53 + resolve(res)
  54 + } else {
  55 + reject(new Error(res.msg || 'Failed to add coupon'))
  56 + }
  57 + }).catch(error => {
  58 + reject(error)
  59 + })
  60 + })
  61 +}
  62 +
  63 +// 更新优惠券
  64 +export function updateSupplierCoupon(data) {
  65 + return new Promise((resolve, reject) => {
  66 + request({
  67 + url: '/supplierCoupon.updateSupplierCoupon',
  68 + method: 'post',
  69 + data
  70 + }).then(response => {
  71 + const res = response.data
  72 + if (res.code === 0) {
  73 + resolve(res)
  74 + } else {
  75 + reject(new Error(res.msg || 'Failed to update coupon'))
  76 + }
  77 + }).catch(error => {
  78 + reject(error)
  79 + })
  80 + })
  81 +}
  82 +
  83 +// 删除优惠券
  84 +export function deleteSupplierCoupon(data) {
  85 + return new Promise((resolve, reject) => {
  86 + request({
  87 + url: '/supplierCoupon.deleteSupplierCoupon',
  88 + method: 'post',
  89 + data
  90 + }).then(response => {
  91 + const res = response.data
  92 + if (res.code === 0) {
  93 + resolve(res)
  94 + } else {
  95 + reject(new Error(res.msg || 'Failed to delete coupon'))
  96 + }
  97 + }).catch(error => {
  98 + reject(error)
  99 + })
  100 + })
  101 +}
0 102 \ No newline at end of file
... ...
src/api/scm/supplierCouponBuyApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +/**
  4 + * 获取优惠券购买记录列表
  5 + * @param {Object} params 查询参数
  6 + * @returns {Promise} 包含优惠券购买记录列表的Promise
  7 + */
  8 +export function getSupplierCouponBuyList(params) {
  9 + return new Promise((resolve, reject) => {
  10 + request({
  11 + url: '/supplierCoupon.listSupplierCouponBuy',
  12 + method: 'get',
  13 + params
  14 + }).then(response => {
  15 + const res = response.data
  16 + if (res.code === 0) {
  17 + resolve({
  18 + data: res.data,
  19 + total: res.total,
  20 + records: res.records
  21 + })
  22 + } else {
  23 + reject(new Error(res.msg || 'Failed to get coupon purchase records'))
  24 + }
  25 + }).catch(error => {
  26 + reject(error)
  27 + })
  28 + })
  29 +}
0 30 \ No newline at end of file
... ...
src/components/scm/addSupplierCoupon.vue 0 → 100644
  1 +<template>
  2 + <el-dialog
  3 + :title="$t('supplierCoupon.addTitle')"
  4 + :visible.sync="visible"
  5 + width="50%"
  6 + >
  7 + <el-form :model="form" :rules="rules" ref="form" label-width="120px">
  8 + <el-form-item :label="$t('supplierCoupon.name')" prop="name">
  9 + <el-input
  10 + v-model="form.name"
  11 + :placeholder="$t('supplierCoupon.required')"
  12 + ></el-input>
  13 + </el-form-item>
  14 +
  15 + <el-form-item :label="$t('supplierCoupon.thirdPartyId')" prop="businessKey">
  16 + <el-input
  17 + v-model="form.businessKey"
  18 + :placeholder="$t('supplierCoupon.required')"
  19 + ></el-input>
  20 + </el-form-item>
  21 +
  22 + <el-form-item :label="$t('supplierCoupon.price')" prop="valuePrice">
  23 + <el-input
  24 + v-model="form.valuePrice"
  25 + :placeholder="$t('supplierCoupon.required')"
  26 + ></el-input>
  27 + </el-form-item>
  28 +
  29 + <el-form-item :label="$t('supplierCoupon.remark')" prop="remark">
  30 + <el-input
  31 + type="textarea"
  32 + v-model="form.remark"
  33 + :placeholder="$t('supplierCoupon.required')"
  34 + rows="4"
  35 + ></el-input>
  36 + </el-form-item>
  37 + </el-form>
  38 +
  39 + <div slot="footer" class="dialog-footer">
  40 + <el-button @click="visible = false">
  41 + {{ $t('supplierCoupon.cancel') }}
  42 + </el-button>
  43 + <el-button type="primary" @click="submitForm">
  44 + {{ $t('supplierCoupon.confirm') }}
  45 + </el-button>
  46 + </div>
  47 + </el-dialog>
  48 +</template>
  49 +
  50 +<script>
  51 +import { addSupplierCoupon } from '@/api/scm/supplierCouponApi'
  52 +
  53 +export default {
  54 + name: 'AddSupplierCoupon',
  55 + data() {
  56 + return {
  57 + visible: false,
  58 + form: {
  59 + name: '',
  60 + supplierId: '',
  61 + businessKey: '',
  62 + valuePrice: '',
  63 + remark: ''
  64 + },
  65 + rules: {
  66 + name: [
  67 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  68 + { max: 64, message: this.$t('supplierCoupon.maxLength', { length: 64 }), trigger: 'blur' }
  69 + ],
  70 + businessKey: [
  71 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  72 + { max: 30, message: this.$t('supplierCoupon.maxLength', { length: 30 }), trigger: 'blur' }
  73 + ],
  74 + valuePrice: [
  75 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  76 + { max: 10, message: this.$t('supplierCoupon.maxLength', { length: 10 }), trigger: 'blur' }
  77 + ],
  78 + remark: [
  79 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  80 + { max: 1024, message: this.$t('supplierCoupon.maxLength', { length: 1024 }), trigger: 'blur' }
  81 + ]
  82 + }
  83 + }
  84 + },
  85 + methods: {
  86 + open(data) {
  87 + this.form = {
  88 + name: '',
  89 + supplierId: data.supplierId,
  90 + businessKey: '',
  91 + valuePrice: '',
  92 + remark: ''
  93 + }
  94 + this.visible = true
  95 + this.$nextTick(() => {
  96 + if (this.$refs.form) {
  97 + this.$refs.form.clearValidate()
  98 + }
  99 + })
  100 + },
  101 +
  102 + submitForm() {
  103 + this.$refs.form.validate(async (valid) => {
  104 + if (valid) {
  105 + try {
  106 + await addSupplierCoupon(this.form)
  107 + this.$message.success(this.$t('supplierCoupon.addSuccess'))
  108 + this.visible = false
  109 + this.$emit('success')
  110 + } catch (error) {
  111 + this.$message.error(error.message || this.$t('supplierCoupon.addFailed'))
  112 + }
  113 + }
  114 + })
  115 + }
  116 + }
  117 +}
  118 +</script>
0 119 \ No newline at end of file
... ...
src/components/scm/deleteSupplierCoupon.vue 0 → 100644
  1 +<template>
  2 + <el-dialog :title="$t('supplierCoupon.deleteTitle')" :visible.sync="visible" width="30%">
  3 + <p>{{ $t('supplierCoupon.deleteConfirm') }}</p>
  4 + <div slot="footer" class="dialog-footer">
  5 + <el-button @click="visible = false">
  6 + {{ $t('supplierCoupon.cancel') }}
  7 + </el-button>
  8 + <el-button type="primary" @click="confirmDelete">
  9 + {{ $t('supplierCoupon.confirm') }}
  10 + </el-button>
  11 + </div>
  12 + </el-dialog>
  13 +</template>
  14 +
  15 +<script>
  16 +import { deleteSupplierCoupon } from '@/api/scm/supplierCouponApi'
  17 +
  18 +export default {
  19 + name: 'DeleteSupplierCoupon',
  20 + data() {
  21 + return {
  22 + visible: false,
  23 + couponId: ''
  24 + }
  25 + },
  26 + methods: {
  27 + open(data) {
  28 + this.couponId = data.couponId
  29 + this.supplierId = data.supplierId
  30 + this.visible = true
  31 + },
  32 +
  33 + async confirmDelete() {
  34 + try {
  35 + await deleteSupplierCoupon({ couponId: this.couponId,supplierId:this.supplierId })
  36 + this.$message.success(this.$t('supplierCoupon.deleteSuccess'))
  37 + this.visible = false
  38 + this.$emit('success')
  39 + } catch (error) {
  40 + this.$message.error(error.message || this.$t('supplierCoupon.deleteFailed'))
  41 + }
  42 + }
  43 + }
  44 +}
  45 +</script>
0 46 \ No newline at end of file
... ...
src/components/scm/editSupplierCoupon.vue 0 → 100644
  1 +<template>
  2 + <el-dialog
  3 + :title="$t('supplierCoupon.editTitle')"
  4 + :visible.sync="visible"
  5 + width="50%"
  6 + >
  7 + <el-form :model="form" :rules="rules" ref="form" label-width="120px">
  8 + <el-form-item :label="$t('supplierCoupon.name')" prop="name">
  9 + <el-input
  10 + v-model="form.name"
  11 + :placeholder="$t('supplierCoupon.required')"
  12 + ></el-input>
  13 + </el-form-item>
  14 +
  15 + <el-form-item :label="$t('supplierCoupon.thirdPartyId')" prop="businessKey">
  16 + <el-input
  17 + v-model="form.businessKey"
  18 + :placeholder="$t('supplierCoupon.required')"
  19 + ></el-input>
  20 + </el-form-item>
  21 +
  22 + <el-form-item :label="$t('supplierCoupon.price')" prop="valuePrice">
  23 + <el-input
  24 + v-model="form.valuePrice"
  25 + :placeholder="$t('supplierCoupon.required')"
  26 + ></el-input>
  27 + </el-form-item>
  28 +
  29 + <el-form-item :label="$t('supplierCoupon.remark')" prop="remark">
  30 + <el-input
  31 + type="textarea"
  32 + v-model="form.remark"
  33 + :placeholder="$t('supplierCoupon.required')"
  34 + rows="4"
  35 + ></el-input>
  36 + </el-form-item>
  37 + </el-form>
  38 +
  39 + <div slot="footer" class="dialog-footer">
  40 + <el-button @click="visible = false">
  41 + {{ $t('supplierCoupon.cancel') }}
  42 + </el-button>
  43 + <el-button type="primary" @click="submitForm">
  44 + {{ $t('supplierCoupon.confirm') }}
  45 + </el-button>
  46 + </div>
  47 + </el-dialog>
  48 +</template>
  49 +
  50 +<script>
  51 +import { updateSupplierCoupon } from '@/api/scm/supplierCouponApi'
  52 +
  53 +export default {
  54 + name: 'EditSupplierCoupon',
  55 + data() {
  56 + return {
  57 + visible: false,
  58 + form: {
  59 + couponId: '',
  60 + name: '',
  61 + businessKey: '',
  62 + valuePrice: '',
  63 + remark: ''
  64 + },
  65 + rules: {
  66 + name: [
  67 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  68 + { max: 64, message: this.$t('supplierCoupon.maxLength', { length: 64 }), trigger: 'blur' }
  69 + ],
  70 + businessKey: [
  71 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  72 + { max: 30, message: this.$t('supplierCoupon.maxLength', { length: 30 }), trigger: 'blur' }
  73 + ],
  74 + valuePrice: [
  75 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  76 + { max: 10, message: this.$t('supplierCoupon.maxLength', { length: 10 }), trigger: 'blur' }
  77 + ],
  78 + remark: [
  79 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' },
  80 + { max: 1024, message: this.$t('supplierCoupon.maxLength', { length: 1024 }), trigger: 'blur' }
  81 + ],
  82 + couponId: [
  83 + { required: true, message: this.$t('supplierCoupon.required'), trigger: 'blur' }
  84 + ]
  85 + }
  86 + }
  87 + },
  88 + methods: {
  89 + open(data) {
  90 + this.form = { ...data }
  91 + this.visible = true
  92 + this.$nextTick(() => {
  93 + if (this.$refs.form) {
  94 + this.$refs.form.clearValidate()
  95 + }
  96 + })
  97 + },
  98 +
  99 + submitForm() {
  100 + this.$refs.form.validate(async (valid) => {
  101 + if (valid) {
  102 + try {
  103 + await updateSupplierCoupon(this.form)
  104 + this.$message.success(this.$t('supplierCoupon.updateSuccess'))
  105 + this.visible = false
  106 + this.$emit('success')
  107 + } catch (error) {
  108 + this.$message.error(error.message || this.$t('supplierCoupon.updateFailed'))
  109 + }
  110 + }
  111 + })
  112 + }
  113 + }
  114 +}
  115 +</script>
0 116 \ No newline at end of file
... ...
src/i18n/index.js
... ... @@ -110,6 +110,8 @@ import { messages as couponPoolManageMessages } from &#39;../views/account/couponPoo
110 110 import { messages as couponDetailManageMessages } from '../views/account/couponDetailManageLang'
111 111 import { messages as supplierTypeManageMessages } from '../views/scm/supplierTypeManageLang'
112 112 import { messages as supplierManageMessages } from '../views/scm/supplierManageLang'
  113 +import { messages as supplierCouponMessages } from '../views/scm/supplierCouponLang'
  114 +import { messages as supplierCouponBuyMessages } from '../views/scm/supplierCouponBuyLang'
113 115  
114 116 Vue.use(VueI18n)
115 117  
... ... @@ -224,6 +226,8 @@ const messages = {
224 226 ...couponDetailManageMessages.en,
225 227 ...supplierTypeManageMessages.en,
226 228 ...supplierManageMessages.en,
  229 + ...supplierCouponMessages.en,
  230 + ...supplierCouponBuyMessages.en,
227 231 },
228 232 zh: {
229 233 ...loginMessages.zh,
... ... @@ -334,6 +338,8 @@ const messages = {
334 338 ...couponDetailManageMessages.zh,
335 339 ...supplierTypeManageMessages.zh,
336 340 ...supplierManageMessages.zh,
  341 + ...supplierCouponMessages.zh,
  342 + ...supplierCouponBuyMessages.zh,
337 343 }
338 344 }
339 345  
... ...
src/router/index.js
... ... @@ -532,9 +532,19 @@ const routes = [
532 532 component: () => import('@/views/scm/supplierTypeManageList.vue')
533 533 },
534 534 {
535   - path:'/pages/scm/supplierManage',
536   - name:'/pages/scm/supplierManage',
  535 + path: '/pages/scm/supplierManage',
  536 + name: '/pages/scm/supplierManage',
537 537 component: () => import('@/views/scm/supplierManageList.vue')
  538 + },
  539 + {
  540 + path: '/pages/scm/supplierCoupon',
  541 + name: '/pages/scm/supplierCoupon',
  542 + component: () => import('@/views/scm/supplierCouponList.vue')
  543 + },
  544 + {
  545 + path:'/pages/scm/supplierCouponBuy',
  546 + name:'/pages/scm/supplierCouponBuy',
  547 + component: () => import('@/views/scm/supplierCouponBuyList.vue')
538 548 },
539 549 // 其他子路由可以在这里添加
540 550 ]
... ...
src/views/scm/supplierCouponBuyLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + supplierCouponBuy: {
  4 + searchTitle: 'Query Conditions',
  5 + listTitle: 'Coupon Purchase Records',
  6 + placeholder: {
  7 + buyId: 'Order Number',
  8 + couponId: 'Coupon ID',
  9 + name: 'Name',
  10 + supplierName: 'Supplier',
  11 + storeName: 'Store Name',
  12 + objName: 'Community Name',
  13 + createUserTel: 'Contact Info',
  14 + createUserName: 'Buyer'
  15 + },
  16 + table: {
  17 + buyId: 'ID',
  18 + couponName: 'Coupon',
  19 + name: 'Name',
  20 + supplierName: 'Supplier',
  21 + quantity: 'Quantity',
  22 + valuePrice: 'Price',
  23 + storeName: 'Store Name',
  24 + objName: 'Community Name',
  25 + createUserTel: 'Contact',
  26 + createUserName: 'Buyer',
  27 + remark: 'Remark'
  28 + },
  29 + fetchError: 'Failed to fetch coupon purchase records'
  30 + },
  31 + common: {
  32 + search: 'Search'
  33 + }
  34 + },
  35 + zh: {
  36 + supplierCouponBuy: {
  37 + searchTitle: '查询条件',
  38 + listTitle: '优惠券购买记录',
  39 + placeholder: {
  40 + buyId: '请填写订单号',
  41 + couponId: '请填写优惠券编号',
  42 + name: '请填写名称',
  43 + supplierName: '请填写供应商',
  44 + storeName: '请填写商户名称',
  45 + objName: '请填写小区名称',
  46 + createUserTel: '请填写联系方式',
  47 + createUserName: '请填写购买人'
  48 + },
  49 + table: {
  50 + buyId: '编号',
  51 + couponName: '优惠券',
  52 + name: '名称',
  53 + supplierName: '供应商',
  54 + quantity: '购买数量',
  55 + valuePrice: '售价',
  56 + storeName: '商户名称',
  57 + objName: '小区名称',
  58 + createUserTel: '联系方式',
  59 + createUserName: '购买人',
  60 + remark: '备注'
  61 + },
  62 + fetchError: '获取优惠券购买记录失败'
  63 + },
  64 + common: {
  65 + search: '查询'
  66 + }
  67 + }
  68 +}
0 69 \ No newline at end of file
... ...
src/views/scm/supplierCouponBuyList.vue 0 → 100644
  1 +<template>
  2 + <div class="supplier-coupon-buy-container">
  3 + <!-- 查询条件 -->
  4 + <el-card class="search-wrapper">
  5 + <div slot="header" class="clearfix flex justify-between">
  6 + <span>{{ $t('supplierCouponBuy.searchTitle') }}</span>
  7 + </div>
  8 + <el-row :gutter="20">
  9 + <el-col :span="6">
  10 + <el-input v-model="searchForm.buyId" :placeholder="$t('supplierCouponBuy.placeholder.buyId')" clearable />
  11 + </el-col>
  12 + <el-col :span="6">
  13 + <el-input v-model="searchForm.couponId" :placeholder="$t('supplierCouponBuy.placeholder.couponId')" clearable />
  14 + </el-col>
  15 + <el-col :span="6">
  16 + <el-input v-model="searchForm.name" :placeholder="$t('supplierCouponBuy.placeholder.name')" clearable />
  17 + </el-col>
  18 + <el-col :span="6">
  19 + <el-button type="primary" @click="handleSearch">
  20 + {{ $t('common.search') }}
  21 + </el-button>
  22 + </el-col>
  23 + </el-row>
  24 +
  25 + <el-row :gutter="20" style="margin-top: 15px">
  26 + <el-col :span="6">
  27 + <el-input v-model="searchForm.supplierName" :placeholder="$t('supplierCouponBuy.placeholder.supplierName')"
  28 + clearable />
  29 + </el-col>
  30 + <el-col :span="6">
  31 + <el-input v-model="searchForm.storeName" :placeholder="$t('supplierCouponBuy.placeholder.storeName')"
  32 + clearable />
  33 + </el-col>
  34 + <el-col :span="6">
  35 + <el-input v-model="searchForm.objName" :placeholder="$t('supplierCouponBuy.placeholder.objName')" clearable />
  36 + </el-col>
  37 + </el-row>
  38 +
  39 + <el-row :gutter="20" style="margin-top: 15px">
  40 + <el-col :span="6">
  41 + <el-input v-model="searchForm.createUserTel" :placeholder="$t('supplierCouponBuy.placeholder.createUserTel')"
  42 + clearable />
  43 + </el-col>
  44 + <el-col :span="6">
  45 + <el-input v-model="searchForm.createUserName" :placeholder="$t('supplierCouponBuy.placeholder.createUserName')"
  46 + clearable />
  47 + </el-col>
  48 + </el-row>
  49 + </el-card>
  50 +
  51 + <!-- 数据列表 -->
  52 + <el-card class="list-wrapper">
  53 + <div slot="header" class="clearfix flex justify-between">
  54 + <span>{{ $t('supplierCouponBuy.listTitle') }}</span>
  55 + </div>
  56 +
  57 + <el-table v-loading="loading" :data="tableData" border style="width: 100%">
  58 + <el-table-column prop="buyId" :label="$t('supplierCouponBuy.table.buyId')" align="center" />
  59 + <el-table-column prop="couponName" :label="$t('supplierCouponBuy.table.couponName')" align="center" />
  60 + <el-table-column prop="name" :label="$t('supplierCouponBuy.table.name')" align="center" />
  61 + <el-table-column prop="supplierName" :label="$t('supplierCouponBuy.table.supplierName')" align="center" />
  62 + <el-table-column prop="quantity" :label="$t('supplierCouponBuy.table.quantity')" align="center" />
  63 + <el-table-column prop="valuePrice" :label="$t('supplierCouponBuy.table.valuePrice')" align="center" />
  64 + <el-table-column prop="storeName" :label="$t('supplierCouponBuy.table.storeName')" align="center" />
  65 + <el-table-column prop="objName" :label="$t('supplierCouponBuy.table.objName')" align="center" />
  66 + <el-table-column prop="createUserTel" :label="$t('supplierCouponBuy.table.createUserTel')" align="center" />
  67 + <el-table-column prop="createUserName" :label="$t('supplierCouponBuy.table.createUserName')" align="center" />
  68 + <el-table-column prop="remark" :label="$t('supplierCouponBuy.table.remark')" align="center" />
  69 + </el-table>
  70 +
  71 + <!-- 分页 -->
  72 + <el-pagination :current-page="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
  73 + layout="total, sizes, prev, pager, next, jumper" :total="page.total" @size-change="handleSizeChange"
  74 + @current-change="handleCurrentChange" />
  75 + </el-card>
  76 + </div>
  77 +</template>
  78 +
  79 +<script>
  80 +import { getSupplierCouponBuyList } from '@/api/scm/supplierCouponBuyApi'
  81 +
  82 +export default {
  83 + name: 'SupplierCouponBuyList',
  84 + data() {
  85 + return {
  86 + loading: false,
  87 + searchForm: {
  88 + buyId: '',
  89 + couponId: '',
  90 + name: '',
  91 + supplierName: '',
  92 + storeName: '',
  93 + objName: '',
  94 + createUserTel: '',
  95 + createUserName: ''
  96 + },
  97 + tableData: [],
  98 + page: {
  99 + current: 1,
  100 + size: 10,
  101 + total: 0
  102 + }
  103 + }
  104 + },
  105 + created() {
  106 + this.getList()
  107 + },
  108 + methods: {
  109 + async getList() {
  110 + try {
  111 + this.loading = true
  112 + const params = {
  113 + ...this.searchForm,
  114 + page: this.page.current,
  115 + row: this.page.size
  116 + }
  117 + const { data, total } = await getSupplierCouponBuyList(params)
  118 + this.tableData = data
  119 + this.page.total = total
  120 + } catch (error) {
  121 + this.$message.error(this.$t('supplierCouponBuy.fetchError'))
  122 + } finally {
  123 + this.loading = false
  124 + }
  125 + },
  126 + handleSearch() {
  127 + this.page.current = 1
  128 + this.getList()
  129 + },
  130 + handleSizeChange(val) {
  131 + this.page.size = val
  132 + this.getList()
  133 + },
  134 + handleCurrentChange(val) {
  135 + this.page.current = val
  136 + this.getList()
  137 + }
  138 + }
  139 +}
  140 +</script>
  141 +
  142 +<style lang="scss" scoped>
  143 +.supplier-coupon-buy-container {
  144 + padding: 20px;
  145 +
  146 + .search-wrapper {
  147 + margin-bottom: 20px;
  148 +
  149 + .el-row {
  150 + margin-bottom: 15px;
  151 +
  152 + &:last-child {
  153 + margin-bottom: 0;
  154 + }
  155 + }
  156 + }
  157 +
  158 + .list-wrapper {
  159 + .el-pagination {
  160 + margin-top: 20px;
  161 + text-align: right;
  162 + }
  163 + }
  164 +}
  165 +</style>
0 166 \ No newline at end of file
... ...
src/views/scm/supplierCouponLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + supplierCoupon: {
  4 + title: 'Supplier Coupon Management',
  5 + searchConditions: 'Search Conditions',
  6 + couponInfo: 'Coupon Information',
  7 + name: 'Name',
  8 + businessId: 'Business ID',
  9 + supplier: 'Supplier',
  10 + thirdPartyId: 'Third-party ID',
  11 + price: 'Price',
  12 + remark: 'Remark',
  13 + operation: 'Operation',
  14 + add: 'Add',
  15 + edit: 'Edit',
  16 + delete: 'Delete',
  17 + confirm: 'Confirm',
  18 + cancel: 'Cancel',
  19 + deleteConfirm: 'Are you sure to delete this coupon?',
  20 + deleteTitle: 'Confirm Operation',
  21 + required: 'Required',
  22 + addTitle: 'Add Coupon',
  23 + editTitle: 'Edit Coupon',
  24 + search: 'Search',
  25 + noData: 'No data',
  26 + supplierRequired: 'Please select a supplier first'
  27 + }
  28 + },
  29 + zh: {
  30 + supplierCoupon: {
  31 + title: '供应商优惠券管理',
  32 + searchConditions: '查询条件',
  33 + couponInfo: '优惠券信息',
  34 + name: '名称',
  35 + businessId: '业务ID',
  36 + supplier: '供应商',
  37 + thirdPartyId: '三方ID',
  38 + price: '售价',
  39 + remark: '备注',
  40 + operation: '操作',
  41 + add: '添加',
  42 + edit: '修改',
  43 + delete: '删除',
  44 + confirm: '确认',
  45 + cancel: '取消',
  46 + deleteConfirm: '确定删除优惠券?',
  47 + deleteTitle: '请确认您的操作',
  48 + required: '必填',
  49 + addTitle: '添加优惠券',
  50 + editTitle: '修改优惠券',
  51 + search: '查询',
  52 + noData: '暂无数据',
  53 + supplierRequired: '请先选择供应商'
  54 + }
  55 + }
  56 +}
0 57 \ No newline at end of file
... ...
src/views/scm/supplierCouponList.vue 0 → 100644
  1 +<template>
  2 + <div class="supplier-coupon-container">
  3 +
  4 +
  5 + <el-row :gutter="20">
  6 + <el-col :span="4">
  7 + <el-card class="supplier-list">
  8 + <ul class="supplier-ul">
  9 + <li v-for="(supplier, index) in suppliers" :key="index"
  10 + :class="{ 'active': supplier.supplierId === curSupplier.supplierId }" @click="switchSupplier(supplier)">
  11 + {{ supplier.supplierName }}
  12 + </li>
  13 + </ul>
  14 + </el-card>
  15 + </el-col>
  16 +
  17 + <el-col :span="20">
  18 + <el-card>
  19 + <div slot="header" class="text-left">
  20 + <span>{{ $t('supplierCoupon.searchConditions') }}</span>
  21 + </div>
  22 +
  23 + <el-form :inline="true" :model="conditions" class="demo-form-inline text-left">
  24 + <el-form-item :label="$t('supplierCoupon.name')">
  25 + <el-input v-model="conditions.name" :placeholder="$t('supplierCoupon.name')"></el-input>
  26 + </el-form-item>
  27 +
  28 + <el-form-item :label="$t('supplierCoupon.businessId')">
  29 + <el-input v-model="conditions.businessKey" :placeholder="$t('supplierCoupon.businessId')"></el-input>
  30 + </el-form-item>
  31 +
  32 + <el-form-item>
  33 + <el-button type="primary" @click="querySupplierCoupon">
  34 + {{ $t('supplierCoupon.search') }}
  35 + </el-button>
  36 + </el-form-item>
  37 + </el-form>
  38 + </el-card>
  39 +
  40 + <el-card class="coupon-list">
  41 + <div slot="header" class="flex justify-between">
  42 + <span>{{ $t('supplierCoupon.couponInfo') }}</span>
  43 + <el-button type="primary" size="small" style="float: right;" @click="openAddDialog">
  44 + {{ $t('supplierCoupon.add') }}
  45 + </el-button>
  46 + </div>
  47 +
  48 + <el-table :data="supplierCoupons" style="width: 100%" v-loading="loading">
  49 + <el-table-column prop="couponId" :label="$t('supplierCoupon.name')" align="center" />
  50 + <el-table-column prop="name" :label="$t('supplierCoupon.name')" align="center" />
  51 + <el-table-column prop="supplierName" :label="$t('supplierCoupon.supplier')" align="center" />
  52 + <el-table-column prop="businessKey" :label="$t('supplierCoupon.thirdPartyId')" align="center" />
  53 + <el-table-column prop="valuePrice" :label="$t('supplierCoupon.price')" align="center" />
  54 + <el-table-column prop="remark" :label="$t('supplierCoupon.remark')" align="center" />
  55 + <el-table-column :label="$t('supplierCoupon.operation')" align="center">
  56 + <template slot-scope="scope">
  57 + <el-button size="mini" @click="openEditDialog(scope.row)">
  58 + {{ $t('supplierCoupon.edit') }}
  59 + </el-button>
  60 + <el-button size="mini" type="danger" @click="openDeleteDialog(scope.row)">
  61 + {{ $t('supplierCoupon.delete') }}
  62 + </el-button>
  63 + </template>
  64 + </el-table-column>
  65 + </el-table>
  66 +
  67 + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  68 + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
  69 + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total" style="margin-top: 20px;">
  70 + </el-pagination>
  71 + </el-card>
  72 + </el-col>
  73 + </el-row>
  74 +
  75 + <add-supplier-coupon ref="addDialog" @success="handleAddSuccess" />
  76 + <edit-supplier-coupon ref="editDialog" @success="handleEditSuccess" />
  77 + <delete-supplier-coupon ref="deleteDialog" @success="handleDeleteSuccess" />
  78 + </div>
  79 +</template>
  80 +
  81 +<script>
  82 +import { getSupplierList, getSupplierCouponList } from '@/api/scm/supplierCouponApi'
  83 +import AddSupplierCoupon from '@/components/scm/addSupplierCoupon'
  84 +import EditSupplierCoupon from '@/components/scm/editSupplierCoupon'
  85 +import DeleteSupplierCoupon from '@/components/scm/deleteSupplierCoupon'
  86 +
  87 +export default {
  88 + name: 'SupplierCouponList',
  89 + components: {
  90 + AddSupplierCoupon,
  91 + EditSupplierCoupon,
  92 + DeleteSupplierCoupon
  93 + },
  94 + data() {
  95 + return {
  96 + suppliers: [],
  97 + curSupplier: {},
  98 + supplierCoupons: [],
  99 + loading: false,
  100 + conditions: {
  101 + name: '',
  102 + businessKey: '',
  103 + supplierId: ''
  104 + },
  105 + pagination: {
  106 + current: 1,
  107 + size: 10,
  108 + total: 0
  109 + }
  110 + }
  111 + },
  112 + mounted() {
  113 + this.getSupplierList()
  114 + },
  115 + methods: {
  116 + async getSupplierList() {
  117 + try {
  118 + const res = await getSupplierList({
  119 + page: 1,
  120 + row: 100
  121 + })
  122 + this.suppliers = res.data
  123 + if (this.suppliers.length > 0) {
  124 + this.switchSupplier(this.suppliers[0])
  125 + }
  126 + } catch (error) {
  127 + this.$message.error(this.$t('supplierCoupon.fetchError'))
  128 + }
  129 + },
  130 +
  131 + async getSupplierCouponList() {
  132 + this.loading = true
  133 + try {
  134 + const params = {
  135 + ...this.conditions,
  136 + page: this.pagination.current,
  137 + row: this.pagination.size
  138 + }
  139 + const res = await getSupplierCouponList(params)
  140 + this.supplierCoupons = res.data
  141 + this.pagination.total = res.total
  142 + } catch (error) {
  143 + this.$message.error(this.$t('supplierCoupon.fetchError'))
  144 + } finally {
  145 + this.loading = false
  146 + }
  147 + },
  148 +
  149 + switchSupplier(supplier) {
  150 + this.curSupplier = supplier
  151 + this.conditions.supplierId = supplier.supplierId
  152 + this.pagination.current = 1
  153 + this.getSupplierCouponList()
  154 + },
  155 +
  156 + querySupplierCoupon() {
  157 + this.pagination.current = 1
  158 + this.getSupplierCouponList()
  159 + },
  160 +
  161 + handleSizeChange(size) {
  162 + this.pagination.size = size
  163 + this.getSupplierCouponList()
  164 + },
  165 +
  166 + handleCurrentChange(current) {
  167 + this.pagination.current = current
  168 + this.getSupplierCouponList()
  169 + },
  170 +
  171 + openAddDialog() {
  172 + if (!this.curSupplier.supplierId) {
  173 + this.$message.warning(this.$t('supplierCoupon.supplierRequired'))
  174 + return
  175 + }
  176 + this.$refs.addDialog.open({
  177 + supplierId: this.curSupplier.supplierId
  178 + })
  179 + },
  180 +
  181 + openEditDialog(row) {
  182 + this.$refs.editDialog.open(row)
  183 + },
  184 +
  185 + openDeleteDialog(row) {
  186 + this.$refs.deleteDialog.open(row)
  187 + },
  188 +
  189 + handleAddSuccess() {
  190 + this.getSupplierCouponList()
  191 + },
  192 +
  193 + handleEditSuccess() {
  194 + this.getSupplierCouponList()
  195 + },
  196 +
  197 + handleDeleteSuccess() {
  198 + this.getSupplierCouponList()
  199 + }
  200 + }
  201 +}
  202 +</script>
  203 +
  204 +<style scoped>
  205 +.supplier-coupon-container {
  206 + padding: 20px;
  207 +}
  208 +
  209 +.supplier-list {
  210 + height: calc(100vh - 200px);
  211 + overflow-y: auto;
  212 +}
  213 +
  214 +.supplier-ul {
  215 + list-style: none;
  216 + padding: 0;
  217 + margin: 0;
  218 +}
  219 +
  220 +.supplier-ul li {
  221 + padding: 10px;
  222 + cursor: pointer;
  223 + border-bottom: 1px solid #eee;
  224 +}
  225 +
  226 +.supplier-ul li:hover {
  227 + background-color: #f5f7fa;
  228 +}
  229 +
  230 +.supplier-ul li.active {
  231 + background-color: #409eff;
  232 + color: white;
  233 +}
  234 +
  235 +.coupon-list {
  236 + margin-top: 20px;
  237 +}
  238 +
  239 +.demo-form-inline {
  240 + margin-bottom: 0;
  241 +}
  242 +</style>
0 243 \ No newline at end of file
... ...