You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1166 lines
49 KiB

  1. <template>
  2. <div class="content">
  3. <div class="div-card1">
  4. <el-card class="card1" style="margin-bottom: 0.5vh; min-height: 110px;">
  5. <div class="row">
  6. <div class="rowItem">
  7. <el-text style="width: 4vw;">精网号</el-text>
  8. <el-input v-model="searchData.jwcode" placeholder="请输入精网号" style="width:10vw;"
  9. clearable></el-input>
  10. </div>
  11. <div class="rowItem">
  12. <el-text style="width: 4vw;">客户姓名</el-text>
  13. <el-input v-model="searchData.name" placeholder="请输入客户姓名" style="width:10vw;"
  14. clearable></el-input>
  15. </div>
  16. <div class="rowItem">
  17. <el-text style="width: 4vw;">所属地区</el-text>
  18. <el-select v-model="searchData.market" placeholder="请选择所属地区" style="width:10vw;" clearable>
  19. <el-option v-for="item in marketList" :key="item" :label="item" :value="item" />
  20. </el-select>
  21. </div>
  22. <!-- 地区财务固定显示付款币种删除客服的订单状态 -->
  23. <div class="rowItem">
  24. <el-text style="width: 4vw;">付款币种</el-text>
  25. <el-select v-model="searchData.paymentCurrency" placeholder="请选择付款币种" style="width: 10vw;"
  26. clearable>
  27. <el-option v-for="item in customOptions" :key="item" :label="item" :value="item" />
  28. </el-select>
  29. </div>
  30. <div class="rowItem">
  31. <el-text style="width: 4vw;">支付方式</el-text>
  32. <el-select v-model="searchData.payType" placeholder="请选择支付方式" style="width: 10vw;" clearable>
  33. <el-option v-for="item in paytypeList" :key="item" :label="item" :value="item" />
  34. </el-select>
  35. </div>
  36. </div>
  37. <div class="row" style="margin-top: 10px;">
  38. <div class="rowItem">
  39. <el-text style="width: 4vw;">活动名称</el-text>
  40. <el-select v-model="searchData.activity" placeholder="请选择活动方式" style="width: 10vw;" clearable>
  41. <el-option v-for="item in activityList" :key="item.id" :label="item.activityName"
  42. :value="item.id" />
  43. </el-select>
  44. </div>
  45. <div class="rowItem">
  46. <el-text style="width: 4vw;">产品名称</el-text>
  47. <el-cascader v-model="searchData.goodsName" :options="productList" style="width: 10vw;"
  48. clearable />
  49. </div>
  50. <div class="rowItem" style="width: 30vw">
  51. <el-text style="width: 4vw; margin-left: 0.5vw;">付款时间</el-text>
  52. <el-date-picker v-model="getTime" type="datetimerange" range-separator=""
  53. start-placeholder="起始时间" end-placeholder="结束时间" style="width: 22vw; "
  54. @change="handleDatePickerChange" :default-time="defaultTime"
  55. :disabled-date="disabledDate" />
  56. </div>
  57. <!-- 地区财务查询/重置按钮删除客服相关按钮 -->
  58. <div class="buttons">
  59. <el-button type="primary" @click="search">查询</el-button>
  60. <el-button type="success" @click="reset">重置</el-button>
  61. </div>
  62. </div>
  63. </el-card>
  64. </div>
  65. <div class="div-card2">
  66. <el-card class="card2">
  67. <div class="btns">
  68. <!-- 地区财务专属标签页待审核/已通过/已完成/已驳回 -->
  69. <div class="tabs">
  70. <el-button-group>
  71. <el-button class="btnItem"
  72. :style="{ backgroundColor: activeTab === 'wait' ? '#2741DE' : '#E5EBFE', color: activeTab === 'wait' ? 'white' : '#666' }"
  73. @click="navigateTo('wait')">
  74. 待审核
  75. </el-button>
  76. <el-button class="btnItem"
  77. :style="{ backgroundColor: activeTab === 'pass' ? '#2741DE' : '#E5EBFE', color: activeTab === 'pass' ? 'white' : '#666' }"
  78. @click="navigateTo('pass')">
  79. 已通过
  80. </el-button>
  81. <el-button class="btnItem"
  82. :style="{ backgroundColor: activeTab === 'done' ? '#2741DE' : '#E5EBFE', color: activeTab === 'done' ? 'white' : '#666' }"
  83. @click="navigateTo('done')">
  84. 已完成
  85. </el-button>
  86. <el-button class="btnItem"
  87. :style="{ backgroundColor: activeTab === 'reject' ? '#2741DE' : '#E5EBFE', color: activeTab === 'reject' ? 'white' : '#666' }"
  88. @click="navigateTo('reject')">
  89. 已驳回
  90. </el-button>
  91. </el-button-group>
  92. </div>
  93. <!-- 删除客服的添加收款按钮 -->
  94. <div class="btnAdd"></div>
  95. </div>
  96. <div class="table">
  97. <el-table :data="tableData" style="width: 80vw;height:54vh;" @sort-change="handleSortChange"
  98. :row-style="{ height: '60px' }" :header-cell-style="{ textAlign: 'center' }"
  99. :cell-style="{ textAlign: 'center' }">
  100. <el-table-column type="index" label="序号" width="100px" fixed="left">
  101. <template #default="scope">
  102. <span>{{ scope.$index + 1 + (pageInfo.pageNum - 1) * pageInfo.pageSize }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column fixed="left" prop="jwcode" label="Homily ID" width="110px" />
  106. <el-table-column fixed="left" prop="name" label="姓名" width="110px" />
  107. <el-table-column prop="marketName" label="所属地区" width="80px" />
  108. <el-table-column prop="activity" label="活动名称" width="120px" show-overflow-tooltip />
  109. <el-table-column prop="goodsName" label="产品名称" width="120px" />
  110. <el-table-column prop="goodNum" label="产品数量" width="130px">
  111. <template #default="scope">
  112. <span v-if="scope.row.goodsName == '金币充值'">{{ scope.row.permanentGold }}</span>
  113. <span v-else>{{ scope.row.goodNum }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="paymentCurrency" label="付款币种" width="100px" />
  117. <el-table-column prop="paymentAmount" label="付款金额" width="120px" />
  118. <!-- 地区财务显示到账币种/金额/手续费已通过/已完成标签页 -->
  119. <el-table-column prop="receivedCurrency" label="到账币种"
  120. v-if="activeTab == 'pass' || activeTab == 'done'" width="150px"></el-table-column>
  121. <el-table-column prop="receivedAmount" label="到账金额"
  122. v-if="activeTab == 'pass' || activeTab == 'done'" width="150px">
  123. <template #default="scope">
  124. <div v-if="!scope.row.receivedAmount">
  125. <text style="color: #FA5A1E;">待补充</text>
  126. </div>
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="handlingCharge" label="手续费"
  130. v-if="activeTab == 'pass' || activeTab == 'done'" width="150px">
  131. <template #default="scope">
  132. <div v-if="scope.row.handlingCharge == null">
  133. <text style="color: #FA5A1E;">待补充</text>
  134. </div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column prop="payType" label="支付方式" width="130px" />
  138. <el-table-column prop="payTime" label="付款时间" width="180px" />
  139. <el-table-column prop="voucher" label="转账凭证" width="110px">
  140. <template #default="scope">
  141. <div v-if="scope.row.voucher"
  142. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  143. @click="previewImage(scope.row.voucher)">
  144. <img :src="scope.row.voucher" alt="支付凭证" style="width: auto; height: 40px;">
  145. </div>
  146. <div v-else
  147. style="display: flex; justify-content: center; align-items: center; height: 40px;">
  148. </div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="submitterName" label="提交人" width="150px"
  152. show-overflow-tooltip></el-table-column>
  153. <!-- 地区财务显示审核人已通过/已驳回/已完成标签页 -->
  154. <el-table-column prop="auditName" label="审核人"
  155. v-if="activeTab == 'pass' || activeTab == 'reject' || activeTab == 'done'" width="150px"
  156. show-overflow-tooltip></el-table-column>
  157. <el-table-column prop="receivedTime" label="到账时间"
  158. v-if="activeTab == 'pass' || activeTab == 'done'" width="180px" />
  159. <el-table-column prop="remark" label="备注" v-if="activeTab != 'reject'" width="150px"
  160. show-overflow-tooltip></el-table-column>
  161. <el-table-column prop="status" label="订单状态" v-if="activeTab == 'done'" width="150px"
  162. show-overflow-tooltip>
  163. <template #default="scope">
  164. <span v-if="scope.row.status == 6">退款</span>
  165. <span v-else>正常</span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column prop="auditTime" label="驳回时间" v-if="activeTab == 'reject'" width="180px"
  169. show-overflow-tooltip></el-table-column>
  170. <el-table-column prop="rejectReason" label="驳回理由" v-if="activeTab == 'reject'" width="150px">
  171. <template #default="scope">
  172. <div class="ellipsis-container"
  173. @mouseenter="handleMouseEnter($event, scope.row.rejectReason)"
  174. @mouseleave="handleMouseLeave" @mousemove="handleMouseMove($event)">
  175. <span class="ellipsis-text">
  176. {{ scope.row.rejectReason || '—' }}
  177. </span>
  178. <!-- 自定义提示框 -->
  179. <div v-if="showTooltip && tooltipContent" class="custom-tooltip" :style="{
  180. left: `${tooltipLeft}px`,
  181. top: `${tooltipTop}px`
  182. }">
  183. {{ tooltipContent }}
  184. </div>
  185. </div>
  186. </template>
  187. </el-table-column>
  188. <!-- 地区财务表格操作待审核审核已通过编辑 -->
  189. <el-table-column fixed="right" label="操作" width="120px"
  190. v-if="activeTab != 'reject' && activeTab != 'done'">
  191. <template #default=scope>
  192. <el-link v-if="activeTab == 'wait'" style="color: #2741DE;"
  193. @click="openAuditForm(scope.row)">审核
  194. </el-link>
  195. <el-link
  196. v-else-if="activeTab == 'pass' && !(scope.row.status == 6 || scope.row.status == 4)"
  197. style="color: #2741DE;" @click="openEditForm(scope.row)">编辑
  198. </el-link>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. </div>
  203. <div class="pagination">
  204. <el-pagination background :page-size="pageInfo.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
  205. layout="total, sizes, prev, pager, next, jumper" :total="total"
  206. @size-change="handlePagination('size', $event)"
  207. @current-change="handlePagination('page', $event)"></el-pagination>
  208. </div>
  209. </el-card>
  210. </div>
  211. <!-- 仅保留地区财务相关弹窗审核弹窗编辑手续费弹窗 -->
  212. <!-- 审核弹窗 -->
  213. <el-dialog class="adddialog" v-model="auditFormisible" width="20vw" :before-close="closeAuditForm">
  214. <el-form class="addForm" label-width="4vw" label-position="left">
  215. <el-form-item label="精网号">
  216. <el-input disabled="true" v-model="auditFormData.jwcode" placeholder="请输入驳回理由" />
  217. </el-form-item>
  218. <el-form-item label="客户姓名">
  219. <el-input disabled="true" v-model="auditFormData.name" placeholder="请输入客户姓名" />
  220. </el-form-item>
  221. <el-form-item label="所属地区">
  222. <el-input disabled="true" v-model="auditFormData.market" />
  223. </el-form-item>
  224. <el-form-item label="活动名称">
  225. <el-input disabled="true" v-model="auditFormData.activity" placeholder="请输入活动名称" />
  226. </el-form-item>
  227. <el-form-item label="产品名称">
  228. <el-select disabled="true" v-model="auditFormData.goodsName" />
  229. </el-form-item>
  230. <el-form-item label="付款币种">
  231. <el-select disabled="true" v-model="auditFormData.paymentCurrency" placeholder="请选择付款币种"
  232. @change="handleCurrencyChange" />
  233. </el-form-item>
  234. <el-form-item label="付款金额">
  235. <el-input disabled="true" v-model="auditFormData.paymentAmount" placeholder="请输入付款金额" />
  236. </el-form-item>
  237. <el-form-item label="支付方式">
  238. <el-select disabled="true" v-model="auditFormData.payType" :items="paytypeOptions"
  239. placeholder="请选择支付方式" />
  240. </el-form-item>
  241. <el-form-item label="到账地区">
  242. <el-select disabled="true" v-model="auditFormData.receivedMarket" placeholder="到账地区" />
  243. </el-form-item>
  244. <el-form-item label="付款时间">
  245. <el-date-picker disabled="true" type="datetime" v-model="auditFormData.payTime"
  246. placeholder="请选择付款时间" />
  247. </el-form-item>
  248. <el-form-item label="转账凭证">
  249. <div class="pic">
  250. <el-upload disabled="true" ref="uploadRef" class="uploader" :show-file-list="false"
  251. list-type="picture-card" :auto-upload="false" :before-upload="beforeUpload"
  252. :on-error="handelImgErr" :on-change="handleImageChange" :http-request="customUpload">
  253. <img v-if="auditFormData.voucher" :src="auditFormData.voucher" class="avatar"
  254. style="height: 100%; width: 100%; object-fit: cover;" />
  255. <el-icon v-else class="avatar-uploader-icon">
  256. <Plus />
  257. </el-icon>
  258. </el-upload>
  259. <el-text class="picText">
  260. 仅支持.jpg .png格式文件 1 MB
  261. </el-text>
  262. </div>
  263. </el-form-item>
  264. <el-form-item label="备注">
  265. <el-input disabled="true" v-model="auditFormData.remark" type="textarea" :rows="3"
  266. placeholder="请输入备注" maxlength="100" show-word-limit />
  267. </el-form-item>
  268. <el-form-item label="驳回理由" v-if="ifReject" required>
  269. <el-input v-model="auditFormData.rejectReason" type="textarea" :rows="3" placeholder="请输入驳回理由"
  270. maxlength="100" show-word-limit />
  271. </el-form-item>
  272. </el-form>
  273. <template #footer>
  274. <span class="dialog-footer" v-if="!ifReject">
  275. <el-button style="background-color: #7E91FF;" @click="ifReject = true">驳回</el-button>
  276. <el-button :style="{
  277. backgroundColor: isBtnDisabled ? '#E5E5E5FF' : '#2741DEFF',
  278. marginLeft: '60px',
  279. color: isBtnDisabled ? '#8A8A8A' : '#F3FAFE'
  280. }" @click="handelAudit" :disabled="isBtnDisabled">{{ btnText }}</el-button>
  281. </span>
  282. <span class="dialog-footer" v-if="ifReject">
  283. <el-button style="background-color: #7E91FF;" @click="closeAuditForm">取消</el-button>
  284. <el-button style="background-color: #2741DE; margin-left: 2.5vw;" type="primary"
  285. @click="throttledhandelAuditReject">确定</el-button>
  286. </span>
  287. </template>
  288. </el-dialog>
  289. <!-- 编辑填手续费弹窗地区财务核心编辑功能 -->
  290. <el-dialog class="editdialog" v-model="editFormisible" width="20vw" :before-close="closeEditForm">
  291. <div class="content">
  292. <div class="left">
  293. <el-form class="editForm" label-width="4.5vw" label-position="left">
  294. <el-form-item label="精网号">
  295. <el-input disabled="true" v-model="editFormData.jwcode" placeholder="精网号" />
  296. </el-form-item>
  297. <el-form-item label="客户姓名">
  298. <el-input disabled="true" v-model="editFormData.name" placeholder="客户姓名" />
  299. </el-form-item>
  300. <el-form-item label="所属地区">
  301. <el-input disabled="true" v-model="editFormData.marketName" placeholder="所属地区" />
  302. </el-form-item>
  303. <el-form-item label="活动名称">
  304. <el-input disabled="true" v-model="editFormData.activity" placeholder="活动名称" />
  305. </el-form-item>
  306. <el-form-item label="产品名称">
  307. <el-select disabled="true" v-model="editFormData.goodsName" placeholder="产品名称"
  308. clearable></el-select>
  309. </el-form-item>
  310. <!-- 金币产品特殊显示 -->
  311. <el-form-item v-show="!isEditGold" label="产品数量">
  312. <div style="padding-right: 50px; display: flex;">
  313. <el-input disabled="true" style="padding-right: 10px;" v-model="editFormData.goodNum"
  314. placeholder="产品数量" />
  315. <span style="color: #999999;"></span>
  316. </div>
  317. </el-form-item>
  318. <div v-show="isEditGold" style="margin-bottom: 15px; display: flex;">
  319. <div style=" display: flex; margin-right: 10px;">
  320. <span
  321. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">永久金币</span>
  322. <el-input disabled="true"
  323. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  324. v-model="editFormData.permanentGold" />
  325. </div>
  326. <div style="padding-right: 5px; display: flex;">
  327. <span
  328. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">免费金币</span>
  329. <el-input disabled="true"
  330. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  331. v-model="editFormData.freeGold" />
  332. </div>
  333. </div>
  334. <el-form-item label="付款币种">
  335. <CurrencySelect :disabled="!ifOnline" v-model="editFormData.paymentCurrency"
  336. :items="customOptions" placeholder="付款币种" />
  337. </el-form-item>
  338. <el-form-item label="付款金额">
  339. <el-input :disabled="!ifOnline" v-model="editFormData.paymentAmount" placeholder="付款金额" />
  340. </el-form-item>
  341. <el-form-item label="支付方式">
  342. <el-select disabled="true" v-model="editFormData.payType" placeholder="支付方式"
  343. clearable></el-select>
  344. </el-form-item>
  345. <el-form-item label="到账地区">
  346. <el-select disabled="true" v-model="editFormData.receivedMarket" placeholder="到账地区"
  347. clearable></el-select>
  348. </el-form-item>
  349. <el-form-item label="付款时间">
  350. <el-date-picker disabled="true" type="datetime" v-model="editFormData.payTime"
  351. placeholder="付款时间" />
  352. </el-form-item>
  353. <el-form-item label="转账凭证">
  354. <div class="pic">
  355. <el-upload disabled="true" ref="uploadRef" class="uploader" :show-file-list="false"
  356. list-type="picture-card" :auto-upload="false" :before-upload="beforeUpload"
  357. :on-error="handelImgErr" :on-change="handleImageChange"
  358. :http-request="customUpload">
  359. <img v-if="editFormData.voucher" :src="editFormData.voucher" class="avatar"
  360. style="height: 100%; width: 100%; object-fit: cover;" />
  361. <el-icon v-else class="avatar-uploader-icon">
  362. <Plus />
  363. </el-icon>
  364. </el-upload>
  365. <el-text class="picText">仅支持.jpg .png格式文件 1 MB</el-text>
  366. </div>
  367. </el-form-item>
  368. <el-form-item label="备注">
  369. <el-input disabled="true" v-model="editFormData.remark" type="textarea" :rows="4"
  370. placeholder="备注" maxlength="100" show-word-limit />
  371. </el-form-item>
  372. </el-form>
  373. </div>
  374. <div class="right">
  375. <!-- 地区财务可编辑项仅到账相关信息 -->
  376. <el-form ref="editFormRef" :rules="editFormRule" :model="editFormData" class="editFormRighrt"
  377. label-width="4.5vw" label-position="left">
  378. <el-form-item label="到账货币" required>
  379. <CurrencySelect v-model="editFormData.receivedCurrency" :items="customOptions"
  380. placeholder="请选择到账货币" />
  381. </el-form-item>
  382. <el-form-item label="到账金额" prop="receivedAmount" required>
  383. <el-input v-model="editFormData.receivedAmount" placeholder="请输入到账金额" type="number" />
  384. </el-form-item>
  385. <el-form-item label="手续费" prop="handlingCharge" required>
  386. <el-input v-model="editFormData.handlingCharge" placeholder="请输入手续费" type="number" />
  387. </el-form-item>
  388. <el-form-item label="到账时间" required>
  389. <el-date-picker type="datetime" v-model="editFormData.receivedTime" placeholder="请选择到账时间" />
  390. </el-form-item>
  391. </el-form>
  392. <span class="editBtns">
  393. <button class="editBtn1" @click="closeEditForm">
  394. <text class="txt">取消</text>
  395. </button>
  396. <button class="editBtn2" @click="throttledsubmitEditForm">
  397. <text class="txt">提交</text>
  398. </button>
  399. </span>
  400. </div>
  401. </div>
  402. </el-dialog>
  403. </div>
  404. </template>
  405. <script setup>
  406. // 仅导入地区财务所需依赖
  407. import { ref, watch, onMounted } from 'vue';
  408. import { storeToRefs } from 'pinia';
  409. import { ElMessage, ElMessageBox } from 'element-plus';
  410. import API from '@/util/http.js';
  411. import request from '@/util/http.js';
  412. import moment from 'moment';
  413. import _ from 'lodash';
  414. import { Plus } from '@element-plus/icons-vue';
  415. // 地区财务专属组件
  416. import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue';
  417. // 静态数据与规则(仅保留必要项)
  418. import { editFormRule } from './utils/recriveFormRules.js';
  419. import { productList, MarketNameForId, CurrencyForId, marketList } from './utils/staticData.js';
  420. import { useAdminStore } from '@/store/index.js';
  421. import { hasMenuPermission } from '@/utils/menuTreePermission.js';
  422. // ===================== 1. 核心状态管理(仅地区财务) =====================
  423. const adminStore = useAdminStore();
  424. const { menuTree } = storeToRefs(adminStore);
  425. // 角色固定:地区财务(caiwu=true,其他角色关闭)
  426. const kefu = ref(false);
  427. const caiwu = ref(true);
  428. const HQcaiwu = ref(false);
  429. const superAdmin = ref(false);
  430. // 表格与分页数据
  431. const tableData = ref([]);
  432. const total = ref(0);
  433. const pageInfo = ref({ pageSize: 10, pageNum: 1 });
  434. // 搜索条件
  435. const searchData = ref({});
  436. const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)];
  437. const getTime = ref([]);
  438. // 标签页:默认“待审核”
  439. const activeTab = ref('wait');
  440. // 审核弹窗状态
  441. const auditFormisible = ref(false);
  442. const auditFormData = ref({});
  443. const ifReject = ref(false);
  444. const countdown = ref(0);
  445. const isBtnDisabled = ref(false);
  446. const btnText = ref('通过(3)');
  447. // 编辑弹窗状态
  448. const editFormisible = ref(false);
  449. const editFormData = ref({});
  450. const editFormRef = ref(null);
  451. const isEditGold = ref(false); // 金币产品标记
  452. const ifOnline = ref(false); // 在线支付标记
  453. // 辅助状态:图片上传、悬浮提示
  454. const uploadRef = ref(null);
  455. const showTooltip = ref(false);
  456. const tooltipContent = ref('');
  457. const tooltipLeft = ref(0);
  458. const tooltipTop = ref(0);
  459. // 基础数据(地区财务专用)
  460. const adminData = ref({});
  461. const activityList = ref([]);
  462. const customOptions = ref(['美元(USD)', '港币(HKD)', '新币(SGD)', '马币(MYR)', '泰铢(THB)', '加币(CAD)', '越南盾(VDN)', '韩元(KRW)']);
  463. const paytypeList = ["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"];
  464. const paytypeOptions = ref([...paytypeList]);
  465. // ===================== 2. 核心功能函数(仅地区财务) =====================
  466. // 2.1 数据加载:获取地区财务订单列表
  467. const getlist = async () => {
  468. try {
  469. let payCurrencySelect = '';
  470. let goodsName = '';
  471. // 处理时间范围
  472. if (getTime.value && getTime.value.length === 2) {
  473. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss');
  474. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss');
  475. } else {
  476. searchData.value.startTime = '';
  477. searchData.value.endTime = '';
  478. }
  479. // 处理产品名称(级联选择取最后一级)
  480. if (searchData.value.goodsName) {
  481. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1];
  482. }
  483. // 处理付款币种(转ID)
  484. if (searchData.value.paymentCurrency) {
  485. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency);
  486. }
  487. // 地区财务固定参数:角色ID=1,按标签页筛选状态
  488. const cashRoleId = '1';
  489. const receivedMarket = adminData.value.markets;
  490. if (activeTab.value === 'wait') searchData.value.status = 0;
  491. else if (activeTab.value === 'pass') searchData.value.status = 13;
  492. else if (activeTab.value === 'done') searchData.value.status = 46;
  493. else if (activeTab.value === 'reject') searchData.value.status = 2;
  494. const result = await request({
  495. url: '/cashCollection/selectCollection',
  496. data: {
  497. ...pageInfo.value,
  498. cashCollection: {
  499. ...searchData.value,
  500. submitterId: adminData.value.id,
  501. receivedMarket: MarketNameForId(receivedMarket),
  502. cashRoleId: cashRoleId,
  503. paymentCurrency: payCurrencySelect,
  504. submitterMarket: receivedMarket,
  505. goodsName: goodsName,
  506. market: MarketNameForId(searchData.value.market)
  507. }
  508. }
  509. });
  510. if (result.code === 200) {
  511. tableData.value = result.data.list;
  512. total.value = result.data.total;
  513. } else {
  514. ElMessage.error('订单数据加载失败');
  515. }
  516. } catch (error) {
  517. console.error('地区财务订单列表请求异常:', error);
  518. ElMessage.error('网络异常,请重试');
  519. }
  520. };
  521. // 2.2 搜索与重置
  522. const search = () => {
  523. getlist();
  524. ElMessage.success('查询成功');
  525. };
  526. const reset = () => {
  527. searchData.value = {};
  528. getlist();
  529. };
  530. // 2.3 标签页切换
  531. const navigateTo = async (tab) => {
  532. activeTab.value = tab;
  533. await getlist();
  534. };
  535. // 2.4 审核功能
  536. // 打开审核弹窗
  537. const openAuditForm = (row) => {
  538. auditFormData.value = { ...row, market: row.marketName };
  539. auditFormisible.value = true;
  540. };
  541. // 关闭审核弹窗
  542. const closeAuditForm = () => {
  543. ifReject.value = false;
  544. auditFormisible.value = false;
  545. auditFormData.value = {};
  546. };
  547. // 审核通过
  548. const handelAudit = async () => {
  549. try {
  550. const result = await request({
  551. url: '/cashAudit/collectionAudit',
  552. data: {
  553. orderCode: auditFormData.value.orderCode,
  554. action: 1,
  555. auditId: adminData.value.id
  556. }
  557. });
  558. if (result.code === 200) {
  559. ElMessage.success('审核通过');
  560. getlist();
  561. closeAuditForm();
  562. } else {
  563. ElMessage.error(result.msg || '审核失败');
  564. }
  565. } catch (error) {
  566. console.error('审核通过请求异常:', error);
  567. ElMessage.error('网络异常,请重试');
  568. }
  569. };
  570. // 审核驳回
  571. const handelAuditReject = async () => {
  572. if (!auditFormData.value.rejectReason) {
  573. ElMessage.warning('请输入驳回理由');
  574. return;
  575. }
  576. try {
  577. const result = await request({
  578. url: '/cashAudit/collectionAudit',
  579. data: {
  580. orderCode: auditFormData.value.orderCode,
  581. rejectReason: auditFormData.value.rejectReason,
  582. action: 2,
  583. auditId: adminData.value.id
  584. }
  585. });
  586. if (result.code === 200) {
  587. ElMessage.success('驳回成功');
  588. getlist();
  589. closeAuditForm();
  590. } else {
  591. ElMessage.error(result.msg || '驳回失败');
  592. }
  593. } catch (error) {
  594. console.error('审核驳回请求异常:', error);
  595. ElMessage.error('网络异常,请重试');
  596. }
  597. };
  598. // 审核按钮倒计时(防止误操作)
  599. watch(auditFormisible, (val) => {
  600. if (val) {
  601. countdown.value = 3;
  602. isBtnDisabled.value = true;
  603. btnText.value = `通过(${countdown.value})`;
  604. const timer = setInterval(() => {
  605. countdown.value--;
  606. btnText.value = `通过(${countdown.value})`;
  607. if (countdown.value <= 0) {
  608. isBtnDisabled.value = false;
  609. clearInterval(timer);
  610. btnText.value = '通过';
  611. }
  612. }, 1000);
  613. }
  614. });
  615. // 2.5 编辑手续费功能
  616. // 打开编辑弹窗
  617. const openEditForm = (row) => {
  618. editFormData.value = { ...row };
  619. // 区分金币产品与普通产品
  620. if (row.goodsName === '金币充值') isEditGold.value = true;
  621. else isEditGold.value = false;
  622. // 在线支付订单允许修改付款信息
  623. if (row.status === 3) ifOnline.value = true;
  624. else ifOnline.value = false;
  625. editFormisible.value = true;
  626. };
  627. // 关闭编辑弹窗
  628. const closeEditForm = () => {
  629. editFormisible.value = false;
  630. editFormData.value = {};
  631. };
  632. // 提交编辑(补充手续费)
  633. const submitEditForm = async () => {
  634. try {
  635. await editFormRef.value.validate();
  636. // 处理时间格式
  637. if (editFormData.value.receivedTime) {
  638. editFormData.value.receivedTime = moment(editFormData.value.receivedTime).format('YYYY-MM-DD HH:mm:ss');
  639. }
  640. const result = await request({
  641. url: '/cashCollection/complete',
  642. data: {
  643. orderCode: editFormData.value.orderCode,
  644. handlingCharge: editFormData.value.handlingCharge * 100, // 转为分单位
  645. paymentCurrency: CurrencyForId(editFormData.value.paymentCurrency),
  646. paymentAmount: editFormData.value.paymentAmount * 100, // 转为分单位
  647. receivedCurrency: CurrencyForId(editFormData.value.receivedCurrency),
  648. receivedAmount: editFormData.value.receivedAmount * 100, // 转为分单位
  649. receivedTime: editFormData.value.receivedTime,
  650. receivedRemark: editFormData.value.receivedRemark || ''
  651. }
  652. });
  653. if (result.code === 200) {
  654. ElMessage.success('编辑提交成功');
  655. getlist();
  656. closeEditForm();
  657. } else {
  658. ElMessage.error(result.msg || '提交失败');
  659. }
  660. } catch (error) {
  661. console.error('编辑提交请求异常:', error);
  662. ElMessage.error('表单验证失败,请检查数据格式');
  663. }
  664. };
  665. // 2.6 辅助功能
  666. // 图片预览
  667. const previewImage = (imageUrl) => {
  668. if (!imageUrl) return;
  669. const imageElement = document.createElement('img');
  670. imageElement.src = imageUrl;
  671. imageElement.style.maxWidth = '80vw';
  672. imageElement.style.maxHeight = '80vh';
  673. imageElement.style.objectFit = 'contain';
  674. const viewer = document.createElement('div');
  675. viewer.style.position = 'fixed';
  676. viewer.style.top = '0';
  677. viewer.style.left = '0';
  678. viewer.style.width = '100vw';
  679. viewer.style.height = '100vh';
  680. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  681. viewer.style.display = 'flex';
  682. viewer.style.justifyContent = 'center';
  683. viewer.style.alignItems = 'center';
  684. viewer.style.zIndex = '9999';
  685. viewer.appendChild(imageElement);
  686. // 点击关闭预览
  687. viewer.addEventListener('click', () => {
  688. document.body.removeChild(viewer);
  689. });
  690. document.body.appendChild(viewer);
  691. };
  692. // 驳回理由悬浮提示
  693. const handleMouseEnter = (e, content) => {
  694. if (!content) return;
  695. showTooltip.value = true;
  696. tooltipContent.value = content;
  697. handleMouseMove(e);
  698. };
  699. const handleMouseLeave = () => {
  700. showTooltip.value = false;
  701. tooltipContent.value = '';
  702. };
  703. const handleMouseMove = (e) => {
  704. // 提示框显示在鼠标左侧,避免遮挡
  705. tooltipLeft.value = e.clientX - 210;
  706. tooltipTop.value = e.clientY - 10;
  707. };
  708. // 2.7 基础数据加载(初始化)
  709. // 获取管理员信息
  710. const getAdminData = async () => {
  711. try {
  712. const result = await API({ url: '/admin/userinfo', data: {} });
  713. adminData.value = result;
  714. // 超级管理员判断(仅用于角色切换权限)
  715. if (adminData.value.roleId === 2) {
  716. superAdmin.value = true;
  717. // 管理员所属地区提示
  718. if (adminData.value.markets === '总部' || adminData.value.markets === '研发部') {
  719. ElMessageBox.alert(
  720. '管理员账号仅显示所属地区的财务数据,请确认地区设置',
  721. '温馨提示',
  722. { type: 'warning' }
  723. );
  724. }
  725. }
  726. } catch (error) {
  727. console.error('管理员信息获取失败:', error);
  728. ElMessage.error('管理员信息加载异常');
  729. }
  730. };
  731. // 获取活动列表
  732. const getActivitys = async () => {
  733. try {
  734. const result = await API({ url: '/cashCollection/getActivityList', data: {} });
  735. if (result.code === 200) {
  736. activityList.value = result.data;
  737. } else {
  738. ElMessage.error('活动列表加载失败');
  739. }
  740. } catch (error) {
  741. console.error('活动列表获取失败:', error);
  742. ElMessage.error('活动数据加载异常');
  743. }
  744. };
  745. // 2.8 节流函数(防止重复提交)
  746. const throttledhandelAuditReject = _.throttle(handelAuditReject, 3000, { trailing: false });
  747. const throttledsubmitEditForm = _.throttle(submitEditForm, 3000, { trailing: false });
  748. // 2.9 页面初始化
  749. onMounted(async () => {
  750. await getAdminData();
  751. await getActivitys();
  752. // 初始化加载地区财务订单数据
  753. await getlist();
  754. // 菜单权限校验(确保地区财务权限)
  755. if (!hasMenuPermission(menuTree.value, 78)) {
  756. ElMessageBox.alert(
  757. '您暂无地区财务操作权限,请联系管理员',
  758. '权限提示',
  759. { type: 'error' }
  760. ).then(() => {
  761. window.history.back();
  762. });
  763. }
  764. });
  765. // 2.10 未使用函数占位(避免报错)
  766. const handleCurrencyChange = () => { };
  767. const beforeUpload = () => true;
  768. const handelImgErr = () => { };
  769. const handleImageChange = () => { };
  770. const customUpload = () => { };
  771. const handleDatePickerChange = () => { };
  772. const disabledDate = () => false;
  773. const handleSortChange = () => { };
  774. const handlePagination = (type, val) => {
  775. if (type === 'size') pageInfo.value.pageSize = val;
  776. else pageInfo.value.pageNum = val;
  777. getlist();
  778. };
  779. </script>
  780. <style scoped lang="scss">
  781. // 地区财务界面样式优化:移除客服/总部相关样式,保留核心样式
  782. .content {
  783. height: 100%;
  784. width: 80vw;
  785. margin: 0 auto;
  786. padding: 1vh 0;
  787. // 搜索卡片样式
  788. .div-card1 {
  789. .card1 {
  790. background: #F3FAFE;
  791. border: none;
  792. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  793. .row {
  794. height: auto;
  795. width: 100%;
  796. display: flex;
  797. align-items: center;
  798. margin-bottom: 1vh;
  799. min-height: 40px;
  800. .rowItem {
  801. display: flex;
  802. align-items: center;
  803. margin-right: 1.5vw;
  804. width: auto;
  805. el-text {
  806. min-width: 60px;
  807. margin-right: 0.5vw;
  808. color: #333;
  809. font-weight: 500;
  810. }
  811. el-input,
  812. el-select,
  813. el-cascader {
  814. min-width: 160px;
  815. }
  816. }
  817. .buttons {
  818. display: flex;
  819. justify-content: center;
  820. align-items: center;
  821. margin-left: 10px;
  822. }
  823. }
  824. }
  825. }
  826. // 数据展示卡片样式
  827. .div-card2 {
  828. margin-top: 1.5vh;
  829. .card2 {
  830. background: #F3FAFE;
  831. border: none;
  832. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  833. // 标签页样式
  834. .btns {
  835. display: flex;
  836. align-items: center;
  837. justify-content: space-between;
  838. padding: 1vh 1vw;
  839. border-bottom: 1px solid #E5EBFE;
  840. .tabs {
  841. .btnItem {
  842. margin-right: 0.5vw;
  843. border-radius: 4px;
  844. padding: 0.3vh 1vw;
  845. font-size: 0.9vw;
  846. &:hover {
  847. opacity: 0.9;
  848. }
  849. }
  850. }
  851. .btnAdd {
  852. display: none; // 隐藏客服的添加收款按钮
  853. }
  854. }
  855. // 表格样式
  856. .table {
  857. margin: 1vh 1vw;
  858. overflow: hidden;
  859. .el-table {
  860. border: none;
  861. .el-table__header th {
  862. background: #E5EBFE;
  863. color: #2741DE;
  864. font-weight: 500;
  865. }
  866. .el-table__body tr {
  867. background: #F3FAFE;
  868. &:hover>td {
  869. background: #EEF3FF !important;
  870. }
  871. }
  872. .el-table-column {
  873. &[label="序号"],
  874. &[label="Homily ID"],
  875. &[label="姓名"] {
  876. background: #F3FAFE;
  877. z-index: 1;
  878. }
  879. &[label="操作"] {
  880. el-link {
  881. color: #2741DE;
  882. cursor: pointer;
  883. &:hover {
  884. color: #1A30B9;
  885. text-decoration: underline;
  886. }
  887. }
  888. }
  889. }
  890. // 驳回理由悬浮提示
  891. .ellipsis-container {
  892. .ellipsis-text {
  893. color: #333;
  894. cursor: pointer;
  895. &:hover {
  896. color: #2741DE;
  897. }
  898. }
  899. .custom-tooltip {
  900. position: fixed;
  901. z-index: 9999;
  902. padding: 8px 12px;
  903. width: 200px;
  904. background-color: #fff;
  905. color: #333;
  906. border: 1px solid #E5EBFE;
  907. border-radius: 4px;
  908. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  909. max-height: 300px;
  910. overflow-y: auto;
  911. font-size: 14px;
  912. line-height: 1.5;
  913. }
  914. }
  915. }
  916. }
  917. // 分页样式
  918. .pagination {
  919. padding: 1vh 1vw;
  920. text-align: right;
  921. .el-pagination {
  922. .el-pager li {
  923. &.active {
  924. background: #2741DE;
  925. color: #fff;
  926. }
  927. }
  928. }
  929. }
  930. }
  931. }
  932. // 审核弹窗样式
  933. :deep(.adddialog) {
  934. background-color: #F3FAFE !important;
  935. border-radius: 8px;
  936. .addForm {
  937. padding: 1.5vh 2vw;
  938. .el-form-item {
  939. margin-bottom: 1.5vh;
  940. &:last-of-type {
  941. margin-bottom: 0;
  942. }
  943. .el-form-item__label {
  944. color: #333;
  945. font-weight: 500;
  946. min-width: 80px;
  947. }
  948. .pic {
  949. display: flex;
  950. align-items: center;
  951. .uploader {
  952. height: 80px;
  953. width: 80px;
  954. border: 1px dashed #DCDFE6;
  955. .el-upload {
  956. height: 100%;
  957. width: 100%;
  958. display: flex;
  959. align-items: center;
  960. justify-content: center;
  961. }
  962. }
  963. .picText {
  964. margin-left: 1vw;
  965. color: #999;
  966. font-size: 12px;
  967. }
  968. }
  969. }
  970. .dialog-footer {
  971. display: flex;
  972. justify-content: center;
  973. gap: 1vw;
  974. padding-top: 1.5vh;
  975. button {
  976. padding: 0.5vh 1.5vw;
  977. border-radius: 4px;
  978. &:first-of-type {
  979. background: #7E91FF;
  980. border: none;
  981. color: #fff;
  982. }
  983. &:last-of-type {
  984. background: #2741DE;
  985. border: none;
  986. color: #fff;
  987. }
  988. }
  989. }
  990. }
  991. }
  992. // 编辑弹窗样式
  993. :deep(.editdialog) {
  994. background-color: #F3FAFE !important;
  995. border-radius: 8px;
  996. width: 60vw !important;
  997. .content {
  998. display: flex;
  999. gap: 2vw;
  1000. padding: 1.5vh 2vw;
  1001. .left,
  1002. .right {
  1003. flex: 1;
  1004. }
  1005. .editForm,
  1006. .editFormRighrt {
  1007. .el-form-item {
  1008. margin-bottom: 1.5vh;
  1009. .el-form-item__label {
  1010. color: #333;
  1011. font-weight: 500;
  1012. min-width: 80px;
  1013. }
  1014. }
  1015. }
  1016. .right {
  1017. .editBtns {
  1018. display: flex;
  1019. justify-content: center;
  1020. gap: 1vw;
  1021. margin-top: 2vh;
  1022. .editBtn1,
  1023. .editBtn2 {
  1024. padding: 0.5vh 1.5vw;
  1025. border-radius: 4px;
  1026. border: none;
  1027. color: #fff;
  1028. .txt {
  1029. font-size: 14px;
  1030. }
  1031. }
  1032. .editBtn1 {
  1033. background: #7E91FF;
  1034. }
  1035. .editBtn2 {
  1036. background: #2741DE;
  1037. }
  1038. }
  1039. }
  1040. }
  1041. }
  1042. }
  1043. // 全局样式修复
  1044. :deep(.el-date-editor) {
  1045. width: 100%;
  1046. }
  1047. :deep(.el-select-dropdown) {
  1048. max-height: 200px;
  1049. }
  1050. :deep(.el-cascader-panel) {
  1051. max-height: 200px;
  1052. }
  1053. </style>