Jelajahi Sumber

公司新商户配置

wangxy 14 jam lalu
induk
melakukan
c151684b5b

+ 16 - 0
src/api/his/company.js

@@ -144,3 +144,19 @@ export function changeWatchPasswordEnabled(data) {
     data: data
   })
 }
+
+/** 公司红包新/老商户 */
+export function changeRedPacketMerchant(data) {
+  return request({
+    url: '/his/company/changeRedPacketMerchant',
+    method: 'post',
+    data: data
+  })
+}
+
+export function listRedPacketMerchantOptions() {
+  return request({
+    url: '/his/company/redPacketMerchantOptions',
+    method: 'get'
+  })
+}

+ 92 - 1
src/views/his/company/index.vue

@@ -123,6 +123,14 @@
 
       <el-table-column label="余额" align="center" prop="money"/>
       <el-table-column label="红包余额" align="center" prop="redPackageMoney"/>
+      <el-table-column label="红包商户" align="center" min-width="180">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.redPacketConfigId" :type="merchantTagType(scope.row.redPacketConfigId)">
+            {{ formatMerchantLabel(scope.row.redPacketConfigId) }}
+          </el-tag>
+          <el-tag v-else type="info">全局当前商户</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="企业类型" align="center" prop="companyType">
         <template slot-scope="scope">
           <dict-tag :options="companyTypeOptions" :value="scope.row.companyType"/>
@@ -251,6 +259,13 @@
             @click="handleRevenue(scope.row)"
             v-hasPermi="['company:company:revenue']"
           >分账配置</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="changeMerchant(scope.row)"
+            v-hasPermi="['his:company:edit']"
+          >红包商户配置</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -853,6 +868,28 @@
       </div>
     </el-dialog>
 
+    <el-dialog :title="merchantDialog.title" :visible.sync="merchantDialog.open" width="500px" append-to-body>
+      <el-form ref="merchantForm" :model="merchantForm" label-width="110px">
+        <el-form-item label="公司">
+          <el-input v-model="merchantForm.companyName" disabled/>
+        </el-form-item>
+        <el-form-item label="红包商户">
+          <el-select v-model="merchantForm.redPacketConfigId" placeholder="不选则走全局当前商户" clearable filterable style="width: 100%">
+            <el-option
+              v-for="item in merchantOptions"
+              :key="item.id"
+              :label="formatMerchantOption(item)"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitMerchantForm">确 定</el-button>
+        <el-button @click="merchantDialog.open=false">取 消</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -874,7 +911,9 @@ import {
   setDiv, exitMiniProgram,
   getGatewayCompanyList,
   listCourseMaAppOptions,
-  changeWatchPasswordEnabled
+  changeWatchPasswordEnabled,
+  changeRedPacketMerchant,
+  listRedPacketMerchantOptions
 } from '@/api/his/company'
 import { getFollowDoctorList } from '@/api/his/doctor'
 import { docList } from '@/api/his/doctor'
@@ -1099,6 +1138,16 @@ export default {
       // 原始sipExtNumIds值(用于比较新旧值)
       originalSipExtNumIds: null,
       submitFormLoading:false,
+      merchantDialog: {
+        open: false,
+        title: '红包商户配置'
+      },
+      merchantForm: {
+        companyId: null,
+        companyName: null,
+        redPacketConfigId: null
+      },
+      merchantOptions: [],
     }
   },
   created() {
@@ -1129,8 +1178,50 @@ export default {
     docList().then(response => {
       this.doctor = response.rows
     })
+    this.loadMerchantOptions()
   },
   methods: {
+    changeMerchant(row) {
+      this.loadMerchantOptions()
+      this.merchantForm.companyId = row.companyId
+      this.merchantForm.companyName = row.companyName
+      this.merchantForm.redPacketConfigId = row.redPacketConfigId || null
+      this.merchantDialog.open = true
+    },
+    submitMerchantForm() {
+      changeRedPacketMerchant({
+        companyId: this.merchantForm.companyId,
+        redPacketConfigId: this.merchantForm.redPacketConfigId || null
+      }).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess(response.msg || '设置成功')
+          this.merchantDialog.open = false
+          this.getList()
+        }
+      })
+    },
+    loadMerchantOptions() {
+      listRedPacketMerchantOptions().then(response => {
+        this.merchantOptions = response.data || []
+      }).catch(() => {
+        this.merchantOptions = []
+      })
+    },
+    formatMerchantOption(item) {
+      if (!item) {
+        return ''
+      }
+      const type = item.isNew === 1 ? '新商户' : '老商户'
+      return type + ' ' + (item.mchId || '')
+    },
+    formatMerchantLabel(configId) {
+      const item = this.merchantOptions.find(o => o.id == configId)
+      return item ? this.formatMerchantOption(item) : ('配置ID ' + configId)
+    },
+    merchantTagType(configId) {
+      const item = this.merchantOptions.find(o => o.id == configId)
+      return item && item.isNew === 1 ? 'success' : 'info'
+    },
     // 添加分账账户
     addAcctInfo() {
       console.log("-----------------",this.revenueForm)

+ 5 - 3
src/views/his/guCoinOrder/index.vue

@@ -21,11 +21,12 @@
       </el-form-item>
       <el-form-item label="订单状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="请选择订单状态" clearable size="small">
+          <el-option label="待审核" :value="0" />
           <el-option label="待支付" :value="4" />
           <el-option label="待发货" :value="1" />
           <el-option label="待收货" :value="2" />
           <el-option label="已完成" :value="3" />
-          <el-option label="取消" :value="5" />
+          <el-option label="取消" :value="5" />
         </el-select>
       </el-form-item>
       <el-form-item label="支付状态" prop="isPay">
@@ -265,11 +266,12 @@ export default {
       });
     },
     statusText(status) {
-      const map = { 4: '待支付', 1: '待发货', 2: '待收货', 3: '已完成', '5': '取消' };
+      // 0待审核 1待发货 2待收货 3已完成 4待支付 5已取消
+      const map = { 0: '待审核', 1: '待发货', 2: '待收货', 3: '已完成', 4: '待支付', 5: '已取消' };
       return map[status] || '未知';
     },
     statusTagType(status) {
-      const map = { 4: 'warning', 1: 'danger', 2: '', 3: 'success', '5': 'info' };
+      const map = { 0: 'warning', 1: 'danger', 2: '', 3: 'success', 4: 'warning', 5: 'info' };
       return map[status] || 'info';
     },
     payTypeText(payType) {