index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="名称" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="所属公司" prop="companyId">
  14. <el-select
  15. v-model="queryParams.companyId"
  16. filterable
  17. remote
  18. reserve-keyword
  19. placeholder="请输入公司名称搜索"
  20. :remote-method="searchCompanies"
  21. :loading="companySearchLoading"
  22. style="width: 220px"
  23. clearable
  24. size="small"
  25. >
  26. <el-option
  27. v-for="item in companyOptions"
  28. :key="item.dictValue"
  29. :label="item.dictLabel"
  30. :value="item.dictValue"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="appid" prop="appid">
  35. <el-input
  36. v-model="queryParams.appid"
  37. placeholder="请输入appid"
  38. clearable
  39. size="small"
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <!-- <el-form-item label="状态" prop="status">-->
  44. <!-- <el-select-->
  45. <!-- v-model="queryParams.status"-->
  46. <!-- placeholder="请选择状态"-->
  47. <!-- clearable-->
  48. <!-- size="small"-->
  49. <!-- >-->
  50. <!-- <el-option-->
  51. <!-- v-for="item in statusOptions"-->
  52. <!-- :key="item.value"-->
  53. <!-- :label="item.label"-->
  54. <!-- :value="item.value"-->
  55. <!-- />-->
  56. <!-- </el-select>-->
  57. <!-- </el-form-item>-->
  58. <el-form-item>
  59. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  60. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  61. </el-form-item>
  62. </el-form>
  63. <el-row :gutter="10" class="mb8">
  64. <el-col :span="1.5">
  65. <el-button
  66. type="primary"
  67. plain
  68. icon="el-icon-plus"
  69. size="mini"
  70. @click="handleAdd"
  71. v-hasPermi="['course:playSourceConfig:add']"
  72. >新增</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="success"
  77. plain
  78. icon="el-icon-edit"
  79. size="mini"
  80. :disabled="single"
  81. @click="handleUpdate"
  82. v-hasPermi="['course:playSourceConfig:edit']"
  83. >修改</el-button>
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="danger"
  88. plain
  89. icon="el-icon-delete"
  90. size="mini"
  91. :disabled="multiple"
  92. @click="handleDelete"
  93. v-hasPermi="['course:playSourceConfig:remove']"
  94. >删除</el-button>
  95. </el-col>
  96. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  97. </el-row>
  98. <!-- 开关配置对话框 -->
  99. <el-dialog title="开关配置" :visible.sync="switchDialogVisible" width="500px" class="switch-dialog">
  100. <el-form :model="switchForm" label-width="100px">
  101. <el-form-item label="AppId">
  102. <el-input v-model="switchForm.appId" :disabled="true"></el-input>
  103. </el-form-item>
  104. <el-form-item label="开关状态">
  105. <el-switch
  106. v-model="switchForm.switchStatus"
  107. active-text="开启"
  108. inactive-text="关闭"
  109. active-value="001"
  110. inactive-value="002">
  111. </el-switch>
  112. </el-form-item>
  113. <el-form-item label="配置信息" v-if="switchForm.configInfo">
  114. <el-input
  115. type="textarea"
  116. :rows="4"
  117. v-model="switchForm.configInfo"
  118. :disabled="true">
  119. </el-input>
  120. </el-form-item>
  121. </el-form>
  122. <span slot="footer" class="dialog-footer">
  123. <el-button @click="switchDialogVisible = false">取 消</el-button>
  124. <el-button type="primary" @click="submitSwitchConfig">确 定</el-button>
  125. </span>
  126. </el-dialog>
  127. <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" border>
  128. <el-table-column type="selection" width="55" align="center" />
  129. <el-table-column label="ID" align="center" prop="id" />
  130. <el-table-column label="名称" align="center" prop="name" />
  131. <!-- <el-table-column label="所属公司" align="center" prop="companyId" :formatter="companyNameFormatter"/>-->
  132. <el-table-column label="图标" align="center" prop="img">
  133. <template slot-scope="scope">
  134. <el-image
  135. style="width: 80px; height: 80px"
  136. :src="scope.row.img"
  137. :preview-src-list="[scope.row.img]">
  138. </el-image>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="原始ID" align="center" prop="originalId" />
  142. <el-table-column label="appId" align="center" prop="appid" />
  143. <el-table-column label="secret" align="center" prop="secret" />
  144. <el-table-column label="msgDataFormat" align="center" prop="msgDataFormat" />
  145. <el-table-column label="积分商品" align="center" prop="integralGoods">
  146. <template slot-scope="scope">
  147. <div v-if="scope.row.integralGoods">
  148. <el-tooltip
  149. v-for="id in scope.row.integralGoods.split(',')"
  150. :key="id"
  151. :content="getGoodsNameById(id)"
  152. placement="top"
  153. :open-delay="300"
  154. >
  155. <el-tag
  156. size="small"
  157. style="margin-right: 4px; margin-bottom: 4px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"
  158. >
  159. {{ getGoodsNameById(id) }}
  160. </el-tag>
  161. </el-tooltip>
  162. </div>
  163. <span v-else>-</span>
  164. </template>
  165. </el-table-column>
  166. <!-- <el-table-column label="类型" align="center" prop="type">-->
  167. <!-- <template slot-scope="scope">-->
  168. <!-- <dict-tag :options="typesOptions" :value="scope.row.type"/>-->
  169. <!-- </template>-->
  170. <!-- </el-table-column>-->
  171. <!-- <el-table-column label="授权方式" align="center" prop="authType">-->
  172. <!-- <template slot-scope="scope">-->
  173. <!-- <dict-tag :options="authTypeOptions" :value="scope.row.authType"/>-->
  174. <!-- </template>-->
  175. <!-- </el-table-column>-->
  176. <el-table-column label="互医/商城小程序" align="center" prop="isMall" width="80px">
  177. <template slot-scope="scope">
  178. <el-tag prop="isMall" v-for="(item, index) in isMallOptions" v-if="scope.row.isMall==item.dictValue">{{item.dictLabel}}</el-tag>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="状态" align="center" prop="status" width="100px">
  182. <template slot-scope="scope">
  183. <el-tag
  184. :type="scope.row.status === 0 ? 'success' : scope.row.status === 1 ? 'warning' : 'danger'"
  185. >
  186. {{ getStatusLabel(scope.row.status) }}
  187. </el-tag>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="配置绑定Id" align="center" prop="merchantConfigId" width="85px"/>
  191. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  192. <template slot-scope="scope">
  193. <el-button
  194. size="mini"
  195. type="text"
  196. icon="el-icon-edit"
  197. @click="handleUpdate(scope.row)"
  198. v-hasPermi="['course:playSourceConfig:edit']"
  199. >修改</el-button>
  200. <el-button
  201. size="mini"
  202. type="text"
  203. icon="el-icon-delete"
  204. @click="handleDelete(scope.row)"
  205. v-hasPermi="['course:playSourceConfig:remove']"
  206. >删除</el-button>
  207. <el-button
  208. size="mini"
  209. type="text"
  210. icon="el-icon-setting"
  211. @click="handleSwitchConfig(scope.row)"
  212. >展示销售</el-button>
  213. <el-button
  214. size="mini"
  215. type="text"
  216. icon="el-icon-edit"
  217. @click="handleBind(scope.row)"
  218. v-hasPermi="['course:playSourceConfig:bind']"
  219. v-if="!scope.row.merchantConfigId"
  220. >绑定商户</el-button>
  221. <el-button
  222. size="mini"
  223. type="text"
  224. icon="el-icon-edit"
  225. @click="handleUnbind(scope.row)"
  226. v-hasPermi="['course:playSourceConfig:unbind']"
  227. v-if="scope.row.merchantConfigId"
  228. >解绑</el-button>
  229. <el-button
  230. size="mini"
  231. type="text"
  232. icon="el-icon-document"
  233. @click="handleAgreement(scope.row)"
  234. v-hasPermi="['course:playSourceConfig:agreement']"
  235. >协议配置</el-button>
  236. </template>
  237. </el-table-column>
  238. </el-table>
  239. <pagination
  240. v-show="total>0"
  241. :total="total"
  242. :page.sync="queryParams.pageNum"
  243. :limit.sync="queryParams.pageSize"
  244. @pagination="getList"
  245. />
  246. <!-- 添加或修改点播配置对话框 -->
  247. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :before-close="resetOption">
  248. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  249. <el-form-item label="名称" prop="name">
  250. <el-input v-model="form.name" placeholder="请输入名称" />
  251. </el-form-item>
  252. <el-form-item label="所属公司" prop="companyId">
  253. <el-select
  254. v-model="form.companyId"
  255. filterable
  256. remote
  257. reserve-keyword
  258. placeholder="请输入公司名称搜索"
  259. :remote-method="searchCompanies"
  260. :loading="companySearchLoading"
  261. style="width: 220px"
  262. clearable
  263. size="small"
  264. >
  265. <el-option
  266. v-for="item in companyOptions"
  267. :key="item.dictValue"
  268. :label="item.dictLabel"
  269. :value="item.dictValue"
  270. />
  271. </el-select>
  272. </el-form-item>
  273. <el-form-item label="可查看设置公司" prop="setCompanyIdList">
  274. <el-select
  275. v-model="form.setCompanyIdList"
  276. filterable
  277. multiple
  278. remote
  279. reserve-keyword
  280. placeholder="请输入公司名称搜索"
  281. :remote-method="searchCompanies"
  282. :loading="companySearchLoading"
  283. style="width: 220px"
  284. clearable
  285. size="small"
  286. >
  287. <el-option
  288. v-for="item in companyOptions"
  289. :key="item.dictValue"
  290. :label="item.dictLabel"
  291. :value="item.dictValue"
  292. />
  293. </el-select>
  294. </el-form-item>
  295. <el-form-item label="是否是互医/商城小程序" prop="isMall">
  296. <el-select
  297. v-model="form.isMall"
  298. style="width: 220px"
  299. clearable
  300. size="small"
  301. >
  302. <el-option
  303. v-for="item in isMallOptions"
  304. :key="item.dictValue"
  305. :label="item.dictLabel"
  306. :value="item.dictValue"
  307. />
  308. </el-select>
  309. </el-form-item>
  310. <el-form-item label="状态" prop="status">
  311. <el-select
  312. v-model="form.status"
  313. placeholder="请选择状态"
  314. style="width: 220px"
  315. clearable
  316. size="small"
  317. >
  318. <el-option
  319. v-for="item in statusOptions"
  320. :key="item.value"
  321. :label="item.label"
  322. :value="item.value"
  323. />
  324. </el-select>
  325. </el-form-item>
  326. <el-form-item label="图标" prop="img">
  327. <image-upload v-model="form.img" :file-type='["png", "jpg", "jpeg"]' :limit="1"/>
  328. </el-form-item>
  329. <el-form-item label="授权方式" prop="authType">
  330. <el-select
  331. v-model="form.authType"
  332. placeholder="请选择授权方式">
  333. <el-option
  334. v-for="item in authTypeOptions"
  335. :key="item.dictValue"
  336. :label="item.dictLabel"
  337. :value="item.dictValue"/>
  338. </el-select>
  339. </el-form-item>
  340. <el-form-item label="类型" prop="type">
  341. <el-select
  342. v-model="form.type"
  343. placeholder="请选择类型">
  344. <el-option
  345. v-for="item in typesOptions"
  346. :key="item.dictValue"
  347. :label="item.dictLabel"
  348. :value="item.dictValue"/>
  349. </el-select>
  350. </el-form-item>
  351. <el-form-item label="原始id" prop="originalId">
  352. <el-input v-model="form.originalId" placeholder="请输入原始id" />
  353. </el-form-item>
  354. <el-form-item label="appid" prop="appid">
  355. <el-input v-model="form.appid" placeholder="请输入appid" />
  356. </el-form-item>
  357. <el-form-item label="secret" prop="secret">
  358. <el-input v-model="form.secret" placeholder="请输入secret" />
  359. </el-form-item>
  360. <el-form-item label="msgDataFormat" prop="msgDataFormat">
  361. <el-input v-model="form.msgDataFormat" placeholder="请输入msgDataFormat" />
  362. </el-form-item>
  363. <el-form-item label="客服电话" prop="customerNum">
  364. <el-input v-model="form.customerNum" placeholder="请输入客服电话" />
  365. </el-form-item>
  366. <el-form-item label="备案号" prop="recordNumber">
  367. <el-input v-model="form.recordNumber" placeholder="请输入备案号" />
  368. </el-form-item>
  369. <el-form-item label="积分商品配置" prop="integralGoods" >
  370. <el-select
  371. v-model="form.integralGoods"
  372. filterable
  373. multiple
  374. remote
  375. reserve-keyword
  376. placeholder="请选择积分商品配置"
  377. clearable
  378. style="width: 625px"
  379. size="small"
  380. >
  381. <el-option
  382. v-for="item in IntegralGoodsList"
  383. :key="item.goodsId"
  384. :label="`${item.goodsName} 【所需积分: ${item.integral} / 需支付现金: ${item.cash} 元】`"
  385. :value="item.goodsId"
  386. :disabled="form.integralGoods && form.integralGoods.length >= 3 && !form.integralGoods.includes(item.goodsId)"
  387. />
  388. </el-select>
  389. </el-form-item>
  390. </el-form>
  391. <div slot="footer" class="dialog-footer">
  392. <el-button type="primary" @click="showOpenPlatformWarning">确 定</el-button>
  393. <el-button @click="cancel">取 消</el-button>
  394. </div>
  395. </el-dialog>
  396. <!-- 协议配置对话框 -->
  397. <el-dialog title="协议配置" :visible.sync="agreementDialogVisible" width="1000px" append-to-body>
  398. <el-form ref="agreementForm" :model="agreementForm" :rules="agreementRules" label-width="150px" style="margin-right: 25px">
  399. <el-form-item label="医生注册协议" prop="doctorRegister">
  400. <editor v-model="agreementForm.doctorRegister" :min-height="200"/>
  401. </el-form-item>
  402. <el-form-item label="医生多机构备案协议" prop="doctorFiling">
  403. <editor v-model="agreementForm.doctorFiling" :min-height="200"/>
  404. </el-form-item>
  405. <el-form-item label="用户协议" prop="userRegister">
  406. <editor v-model="agreementForm.userRegister" :min-height="200"/>
  407. </el-form-item>
  408. <el-form-item label="隐私协议" prop="userPrivacy">
  409. <editor v-model="agreementForm.userPrivacy" :min-height="200"/>
  410. </el-form-item>
  411. <el-form-item label="健康客服协议" prop="userHealth">
  412. <editor v-model="agreementForm.userHealth" :min-height="200"/>
  413. </el-form-item>
  414. <el-form-item label="会员服务协议" prop="vipService">
  415. <editor v-model="agreementForm.vipService" :min-height="200"/>
  416. </el-form-item>
  417. <el-form-item label="会员自动续费协议" prop="vipAutomaticService">
  418. <editor v-model="agreementForm.vipAutomaticService" :min-height="200"/>
  419. </el-form-item>
  420. <el-form-item label="用户注销协议" prop="userRemoveService">
  421. <editor v-model="agreementForm.userRemoveService" :min-height="200"/>
  422. </el-form-item>
  423. <el-form-item label="APP用户协议" prop="appUserAgreement">
  424. <editor v-model="agreementForm.appUserAgreement" :min-height="200"/>
  425. </el-form-item>
  426. <el-form-item label="APP隐私协议" prop="appPrivacyAgreement">
  427. <editor v-model="agreementForm.appPrivacyAgreement" :min-height="200"/>
  428. </el-form-item>
  429. </el-form>
  430. <div slot="footer" class="dialog-footer">
  431. <el-button @click="agreementDialogVisible = false">取 消</el-button>
  432. <el-button type="primary" @click="submitAgreementForm">确 定</el-button>
  433. </div>
  434. </el-dialog>
  435. <!-- 绑定 -->
  436. <el-dialog :title="bindForm.bindTitle" :visible.sync="bindForm.bindShow" width="800px" append-to-body :before-close="handleBindClose">
  437. <el-form ref="bindForm" :model="bindForm" :rules="bindRules" label-width="130px">
  438. <el-form-item label="商户类型" prop="merchantType">
  439. <el-select v-model="bindForm.merchantType" placeholder="请选择商户类型" clearable size="small" @change="changeSysPayModes">
  440. <el-option
  441. v-for="dict in sysPayModes"
  442. :key="dict.dictValue"
  443. :label="dict.dictLabel"
  444. :value="dict.dictValue"
  445. />
  446. </el-select>
  447. </el-form-item>
  448. <el-form-item label="商户号" prop="merchantId">
  449. <el-select v-model="bindForm.id" placeholder="请选择商户号" clearable size="small">
  450. <el-option
  451. v-for="dict in merchantAppConfigList"
  452. :key="dict.id"
  453. :label="dict.merchantId"
  454. :value="dict.id"
  455. />
  456. </el-select>
  457. </el-form-item>
  458. </el-form>
  459. <div slot="footer" class="dialog-footer">
  460. <el-button type="primary" @click="submitFormBind(bindCurrentRow)" >确 定</el-button>
  461. <el-button @click="cancelBind">取 消</el-button>
  462. </div>
  463. </el-dialog>
  464. </div>
  465. </template>
  466. <script>
  467. import {
  468. list,
  469. get,
  470. update,
  471. add,
  472. del,
  473. updateBindConfig,
  474. updateUnbindConfig,
  475. updateAgreementConfig,
  476. queryAgreementConfig
  477. } from '@/api/course/coursePlaySourceConfig'
  478. import {updateIsTownOn} from "@/api/system/config";
  479. import { allList } from '@/api/company/company'
  480. import { resetForm } from '@/utils/common'
  481. import { listMerchantAppConfig } from "@/api/merchantAppConfig/merchantAppConfig";
  482. import { norIntegralGoodsList } from '@/api/his/integralGoods'
  483. export default {
  484. name: 'CoursePlaySourceConfig',
  485. data() {
  486. return {
  487. sysPayModes: [],
  488. bindCurrentRow: {},
  489. authTypeOptions: [],
  490. bindForm:{
  491. bindTitle: '绑定支付配置',
  492. bindShow: false,
  493. merchantType: null,
  494. id:null,
  495. },
  496. merchantAppConfigList:[],
  497. switchDialogVisible: false,
  498. // 公司搜索相关
  499. companySearchLoading: false,
  500. companyOptions: [],
  501. formatterCompanyOptions: [],
  502. switchForm: {
  503. appId: '',
  504. switchStatus: '001',
  505. },
  506. queryParams: {
  507. pageNum: 1,
  508. pageSize: 10,
  509. name: null,
  510. appid: null,
  511. status: null
  512. },
  513. // 协议配置相关
  514. agreementDialogVisible: false,
  515. agreementForm: {
  516. appId: null,
  517. doctorRegister: '',
  518. doctorFiling: '',
  519. userRegister: '',
  520. userPrivacy: '',
  521. userHealth: '',
  522. vipService: '',
  523. vipAutomaticService: '',
  524. userRemoveService: '',
  525. appUserAgreement: '',
  526. appPrivacyAgreement: ''
  527. },
  528. agreementRules: {
  529. // doctorRegister: [
  530. // { required: true, message: "医生注册协议不能为空", trigger: "blur" }
  531. // ],
  532. // userRegister: [
  533. // { required: true, message: "用户协议不能为空", trigger: "blur" }
  534. // ]
  535. },
  536. showSearch: true,
  537. single: true,
  538. multiple: true,
  539. ids: [],
  540. loading: false,
  541. list: [],
  542. total: 0,
  543. //正常的积分列表
  544. IntegralGoodsList:[],
  545. typesOptions: [],
  546. statusOptions: [
  547. {
  548. label: "正常",
  549. value: 0
  550. },
  551. {
  552. label: "半封禁",
  553. value: 1
  554. },
  555. {
  556. label: "封禁",
  557. value: 2
  558. }
  559. ],
  560. isMallOptions:[
  561. {
  562. dictLabel: "是",
  563. dictValue: 1
  564. },
  565. {
  566. dictLabel: "否",
  567. dictValue: 0
  568. }
  569. ],
  570. title: null,
  571. open: false,
  572. form: {
  573. authType:'1',
  574. setCompanyIdList: []
  575. },
  576. bindRules:{
  577. merchantType: [
  578. { required: true, message: "商户类型不能为空", trigger: "blur" }
  579. ],
  580. id: [
  581. { required: true, message: "商户号不能为空", trigger: "blur" }
  582. ]
  583. },
  584. rules: {
  585. name: [
  586. { required: true, message: "名称不能为空", trigger: "blur" }
  587. ],
  588. // companyId: [
  589. // { required: true, message: "所属公司不能为空", trigger: "blur" }
  590. // ],
  591. appid: [
  592. { required: true, message: "appid不能为空", trigger: "blur" }
  593. ],
  594. img: [
  595. { required: true, message: "图标不能为空", trigger: "blur" }
  596. ],
  597. type: [
  598. { required: true, message: "类型不能为空", trigger: "blur" }
  599. ],
  600. originalId: [
  601. { required: true, message: "原始id不能为空", trigger: "blur" }
  602. ],
  603. secret: [
  604. { required: true, message: "secret不能为空", trigger: "blur" }
  605. ],
  606. token: [
  607. { required: true, message: "token不能为空", trigger: "blur" }
  608. ],
  609. aesKey: [
  610. { required: true, message: "aesKey不能为空", trigger: "blur" }
  611. ],
  612. msgDataFormat: [
  613. { required: true, message: "msgDataFormat不能为空", trigger: "blur" }
  614. ]
  615. }
  616. }
  617. },
  618. created() {
  619. this.getDicts("play_config_auth_type").then(response => {
  620. this.authTypeOptions = response.data;
  621. });
  622. this.getDicts("sys_pay_mode").then(response => {
  623. this.sysPayModes = response.data;
  624. });
  625. this.getDicts("play_source_type").then(response => {
  626. this.typesOptions = response.data.map(item => {
  627. return {
  628. ...item,
  629. listClass: 'primary'}
  630. })
  631. });
  632. this.getIntegralGoodsList();
  633. //初始化formatterCompanyOptions
  634. allList().then(e => {
  635. this.formatterCompanyOptions = e.rows;
  636. });
  637. this.getList();
  638. },
  639. methods: {
  640. resetForm,
  641. resetOption(){
  642. console.log(1)
  643. this.companyOptions = [];
  644. this.open = false;
  645. },
  646. getGoodsNameById(id) {
  647. const goods = this.IntegralGoodsList.find(item => item.goodsId == id)
  648. return goods ? goods.goodsName : id
  649. },
  650. showOpenPlatformWarning() {
  651. if (this.form.authType=='1'){
  652. this.$confirm('必须绑定开放平台,否则会导致看课冲突。是否继续?', '提示', {
  653. confirmButtonText: '确定',
  654. cancelButtonText: '取消',
  655. type: 'warning'
  656. }).then(() => {
  657. // 用户点击确定,执行原有提交逻辑
  658. this.submitForm()
  659. }).catch(() => {
  660. // 用户点击取消,停留在当前弹窗,不执行任何操作
  661. // 可以在这里添加一些提示信息
  662. console.log('用户取消提交')
  663. })
  664. }else {
  665. this.submitForm()
  666. }
  667. },
  668. getIntegralGoodsList(){
  669. norIntegralGoodsList().then(res=>{
  670. this.IntegralGoodsList= res.rows
  671. })
  672. },
  673. // 协议配置处理
  674. handleAgreement(row) {
  675. // 获取当前行的协议相关信息
  676. queryAgreementConfig({appid:row.appid}).then(response => {
  677. if (response.code === 200) {
  678. // 返回agreementData json串
  679. let agreementData = JSON.parse(response.data.agreementData);
  680. this.agreementForm = {
  681. appId: row.appid,
  682. doctorRegister: agreementData.doctorRegister || '',
  683. doctorFiling: agreementData.doctorFiling || '',
  684. userRegister: agreementData.userRegister || '',
  685. userPrivacy: agreementData.userPrivacy || '',
  686. userHealth: agreementData.userHealth || '',
  687. vipService: agreementData.vipService || '',
  688. vipAutomaticService: agreementData.vipAutomaticService || '',
  689. userRemoveService: agreementData.userRemoveService || '',
  690. appUserAgreement: agreementData.appUserAgreement || '',
  691. appPrivacyAgreement: agreementData.appPrivacyAgreement || ''
  692. };
  693. this.agreementDialogVisible = true;
  694. }
  695. })
  696. },
  697. // 提交协议配置
  698. submitAgreementForm() {
  699. this.$refs["agreementForm"].validate(valid => {
  700. if (valid) {
  701. // 调用API更新协议配置
  702. const params = {
  703. appId: this.agreementForm.appId,
  704. agreementData: JSON.stringify({
  705. doctorRegister: this.agreementForm.doctorRegister,
  706. doctorFiling: this.agreementForm.doctorFiling,
  707. userRegister: this.agreementForm.userRegister,
  708. userPrivacy: this.agreementForm.userPrivacy,
  709. userHealth: this.agreementForm.userHealth,
  710. vipService: this.agreementForm.vipService,
  711. vipAutomaticService: this.agreementForm.vipAutomaticService,
  712. userRemoveService: this.agreementForm.userRemoveService,
  713. appUserAgreement: this.agreementForm.appUserAgreement,
  714. appPrivacyAgreement: this.agreementForm.appPrivacyAgreement
  715. })
  716. };
  717. updateAgreementConfig(params).then(response => {
  718. if (response.code === 200) {
  719. this.msgSuccess("协议配置更新成功");
  720. this.agreementDialogVisible = false;
  721. this.getList(); // 刷新列表
  722. } else {
  723. this.msgError("协议配置更新失败:" + response.msg);
  724. }
  725. }).catch(error => {
  726. this.msgError("请求失败:" + error.message);
  727. });
  728. }
  729. });
  730. },
  731. handleUnbind(row) {
  732. this.$confirm('是否确认解绑该配置?', "警告", {
  733. confirmButtonText: "确定",
  734. cancelButtonText: "取消",
  735. type: "warning"
  736. }).then(() => {
  737. const params = {
  738. id: row.id
  739. };
  740. updateUnbindConfig(params).then(response => {
  741. if (response.code === 200) {
  742. this.msgSuccess("解绑成功");
  743. this.getList();
  744. } else {
  745. this.msgError("解绑失败: " + response.msg);
  746. }
  747. }).catch(error => {
  748. this.msgError("请求失败: " + error.message);
  749. });
  750. }).catch(() => {
  751. // 用户取消操作
  752. });
  753. }
  754. ,
  755. submitFormBind(row) {
  756. this.$refs["bindForm"].validate(valid => {
  757. if (valid) {
  758. // 构造请求参数
  759. const params = {
  760. id: row.id, // 使用传入行数据的ID
  761. merchantType: this.bindForm.merchantType,
  762. merchantConfigId: this.bindForm.id
  763. };
  764. // 调用API更新绑定关系
  765. updateBindConfig(params).then(response => {
  766. if (response.code === 200) {
  767. this.msgSuccess("绑定配置更新成功");
  768. this.bindForm.bindShow = false;
  769. this.getList(); // 刷新列表数据
  770. this.resetForm("bindForm");
  771. } else {
  772. this.msgError("更新失败: " + response.msg);
  773. }
  774. }).catch(error => {
  775. this.msgError("请求失败: " + error.message);
  776. });
  777. }
  778. });
  779. },
  780. handleBindClose(done) {
  781. this.resetForm("bindForm");
  782. this.bindForm.bindShow = false;
  783. this.bindForm.id = null;
  784. done();
  785. },
  786. cancelBind(){
  787. this.resetForm("bindForm");
  788. this.bindForm.bindShow = false; // 关闭对话框
  789. },
  790. // 绑定支付配置
  791. handleBind(row) {
  792. this.merchantAppConfigList= [];
  793. this.bindForm.merchantType = null;
  794. this.bindForm.id = null;
  795. this.bindCurrentRow = row; // 保存当前行数据
  796. this.bindForm.bindShow = true;
  797. },
  798. changeSysPayModes(value,row){
  799. const query = {
  800. pageNum: 1,
  801. pageSize: 100,
  802. merchantType: value,
  803. isDeleted: 0,
  804. appId:this.bindCurrentRow.appid
  805. }
  806. listMerchantAppConfig(query).then( response => {
  807. this.merchantAppConfigList = response.rows;
  808. }
  809. )
  810. },
  811. // 处理开关配置
  812. handleSwitchConfig(row) {
  813. this.switchForm.appId = row.appid;
  814. this.switchForm.switchStatus = "001"; // 默认关闭状态
  815. // 调用接口获取开关状态
  816. this.getSwitchConfig(row.appid);
  817. this.switchDialogVisible = true;
  818. },
  819. /** 搜索公司 */
  820. searchCompanies(query) {
  821. this.companySearchLoading = true;
  822. allList().then(response => {
  823. this.companyOptions = response.rows;
  824. if (query) {
  825. this.companyOptions = this.companyOptions.filter(item =>
  826. item.dictLabel.includes(query)
  827. );
  828. }
  829. this.companySearchLoading = false;
  830. }).catch(()=>{
  831. this.companySearchLoading = false;
  832. });
  833. },
  834. companyNameFormatter(row){
  835. let company = this.formatterCompanyOptions.filter(item => item.dictValue === row.companyId)[0];
  836. return company ? company.dictLabel : '';
  837. },
  838. // 获取开关配置
  839. getSwitchConfig(appId) {
  840. const params = {
  841. appId: this.switchForm.appId
  842. };
  843. updateIsTownOn(params).then(response=>{
  844. if (response.code === 200) {
  845. if ( response.date){
  846. this.switchForm.switchStatus = response.date;
  847. }
  848. } else {
  849. this.$message.error('获取配置失败: ' + response.msg);
  850. }
  851. }).catch(error => {
  852. this.$message.error('请求失败: ' + error.message);
  853. });
  854. },
  855. // 提交开关配置
  856. submitSwitchConfig() {
  857. const params = {
  858. appId: this.switchForm.appId,
  859. bock: this.switchForm.switchStatus
  860. };
  861. updateIsTownOn(params).then(response=>{
  862. if (response.code === 200) {
  863. this.$message.success('配置更新成功');
  864. this.switchDialogVisible = false;
  865. } else {
  866. this.$message.error('更新失败: ' + response.msg);
  867. }
  868. })
  869. },
  870. getList() {
  871. this.loading = true;
  872. list(this.queryParams).then(response => {
  873. this.list = response.rows;
  874. this.total = response.total;
  875. this.loading = false;
  876. });
  877. },
  878. handleQuery() {
  879. this.queryParams.pageNum = 1;
  880. this.getList();
  881. },
  882. resetQuery() {
  883. this.resetForm("queryForm");
  884. this.getList();
  885. },
  886. handleAdd() {
  887. this.reset()
  888. this.open = true
  889. this.form.isMall = 0;
  890. this.title = "添加小程序配置"
  891. },
  892. handleUpdate(row) {
  893. this.reset()
  894. const id = row.id || this.ids
  895. get(id).then(response => {
  896. this.form = {
  897. ...response.data,
  898. type: response.data.type.toString(),
  899. authType: response.data.authType ? response.data.authType.toString() : '1'
  900. }
  901. if(!!this.form.setCompanyIds){
  902. this.$set(
  903. this.form,
  904. "setCompanyIdList",
  905. this.form.setCompanyIds.split(",").map(str => parseInt(str, 10))
  906. );
  907. // this.form.setCompanyIdList = this.form.setCompanyIds.split(",").map(str => parseInt(str, 10));
  908. }
  909. if(!!this.form.integralGoods){
  910. this.$set(
  911. this.form,
  912. "integralGoods",
  913. this.form.integralGoods.split(",").map(str => parseInt(str, 10))
  914. );
  915. }
  916. this.searchCompanies("");
  917. this.open = true
  918. this.title = "修改小程序配置"
  919. })
  920. },
  921. handleDelete(row) {
  922. const id = row.id || this.ids
  923. this.$confirm('是否确认删除小程序配置编号为"' + id + '"的数据项?', "警告", {
  924. confirmButtonText: "确定",
  925. cancelButtonText: "取消",
  926. type: "warning"
  927. }).then(function() {
  928. return del(id);
  929. }).then(() => {
  930. this.getList();
  931. this.msgSuccess("删除成功");
  932. }).catch(() => {});
  933. },
  934. handleSelectionChange(selection) {
  935. this.ids = selection.map(item => item.id)
  936. this.single = selection.length!==1
  937. this.multiple = !selection.length
  938. },
  939. submitForm() {
  940. this.$refs["form"].validate(valid => {
  941. if (valid) {
  942. if(!!this.form.setCompanyIdList && this.form.setCompanyIdList.length > 0){
  943. this.form.setCompanyIds = this.form.setCompanyIdList.join(',')
  944. }else{
  945. this.form.setCompanyIds = "";
  946. }
  947. if(!!this.form.integralGoods && this.form.integralGoods.length > 0){
  948. this.form.integralGoods = this.form.integralGoods.join(',')
  949. }else{
  950. this.form.integralGoods = "";
  951. }
  952. if (this.form.id != null) {
  953. update(this.form).then(response => {
  954. const {code, msg} = response
  955. if (code !== 200) {
  956. this.msgError(msg)
  957. return
  958. }
  959. this.msgSuccess("修改成功");
  960. this.open = false;
  961. this.getList();
  962. });
  963. } else {
  964. add(this.form).then(response => {
  965. const {code, msg} = response
  966. if (code !== 200) {
  967. this.msgError(msg)
  968. return
  969. }
  970. this.msgSuccess("新增成功");
  971. this.open = false;
  972. this.getList();
  973. });
  974. }
  975. }
  976. });
  977. },
  978. cancel() {
  979. this.open = false;
  980. this.reset();
  981. },
  982. reset() {
  983. this.form = {
  984. id: null,
  985. name: null,
  986. appid: null,
  987. secret: null,
  988. img: null,
  989. originalId: null,
  990. setCompanyIdList: [],
  991. token: 'cbnd7lJvkripVOpyTFAna6NAWCxCrvC',
  992. aesKey: 'HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E',
  993. msgDataFormat: 'JSON',
  994. type: '1',
  995. status: 0
  996. }
  997. this.resetForm("form");
  998. },
  999. getStatusLabel(status) {
  1000. const statusMap = {
  1001. 0: '正常',
  1002. 1: '半封禁',
  1003. 2: '封禁'
  1004. };
  1005. return statusMap[status] || '未知';
  1006. }
  1007. },
  1008. }
  1009. </script>
  1010. <style scoped>
  1011. </style>