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.

1770 lines
72 KiB

3 weeks ago
3 weeks ago
1 week ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
1 week ago
1 week ago
3 weeks ago
3 weeks ago
1 week ago
3 weeks ago
1 week ago
3 weeks ago
1 week ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
1 week ago
3 weeks ago
1 week ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  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="row1">
  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-cascader style="width: 9vw;" v-model="searchData.markets" :options="market"
  19. placeholder="请选择所属地区" clearable @change="handleMarketChange" />
  20. </div>
  21. <!-- 地区财务固定显示付款币种删除客服的订单状态 -->
  22. <div class="rowItem">
  23. <el-text style="width: 4vw;">付款币种</el-text>
  24. <el-select v-model="searchData.paymentCurrency" placeholder="请选择付款币种" style="width: 10vw;"
  25. clearable>
  26. <el-option v-for="item in customOptions" :key="item" :label="item" :value="item" />
  27. </el-select>
  28. </div>
  29. <div class="rowItem">
  30. <el-text style="width: 4vw;">支付方式</el-text>
  31. <el-select v-model="searchData.payType" placeholder="请选择支付方式" style="width: 10vw;" clearable>
  32. <el-option v-for="item in paytypeList" :key="item" :label="item" :value="item" />
  33. </el-select>
  34. </div>
  35. </div>
  36. <div class="row2" style="margin-top: 10px;">
  37. <div class="left">
  38. <div class="rowItem">
  39. <el-text style="width: 4vw;">活动名称</el-text>
  40. <el-select v-model="searchData.activity" placeholder="请选择活动方式" style="width: 10vw;"
  41. clearable>
  42. <el-option v-for="item in activityList" :key="item.id" :label="item.activityName"
  43. :value="item.id" />
  44. </el-select>
  45. </div>
  46. <div class="rowItem">
  47. <el-text style="width: 4vw;">产品名称</el-text>
  48. <el-cascader v-model="searchData.goodsName" :options="productList" style="width: 10vw;"
  49. clearable />
  50. </div>
  51. <div class="rowItem" style="width: 25vw">
  52. <el-text style="width: 4vw; margin-left: 0.5vw;">付款时间</el-text>
  53. <el-date-picker v-model="getTime" type="datetimerange" range-separator=""
  54. start-placeholder="起始时间" end-placeholder="结束时间" style="width: 22vw; "
  55. @change="handleDatePickerChange" :default-time="defaultTime"
  56. :disabled-date="disabledDate" />
  57. </div>
  58. </div>
  59. <el-button style="width: 3vw;" type="primary" @click="search">查询</el-button>
  60. <el-button style="width: 3vw;" type="success" @click="reset">重置</el-button>
  61. <el-button v-if="activeTab == 'done'" style="width: 5vw;" type="warning"
  62. @click="exportExcel()">导出excel</el-button>
  63. <el-button v-if="activeTab == 'done'" style="width: 6vw;" type="primary"
  64. @click="openExportList">查看导出列表</el-button>
  65. </div>
  66. </el-card>
  67. </div>
  68. <div class="div-card2">
  69. <el-card class="card2">
  70. <div class="btns">
  71. <!-- 地区财务专属标签页待审核/已通过/已完成/已驳回 -->
  72. <div class="tabs">
  73. <el-button-group>
  74. <el-button class="btnItem"
  75. :style="{ backgroundColor: activeTab === 'wait' ? '#2741DE' : '#E5EBFE', color: activeTab === 'wait' ? 'white' : '#666' }"
  76. @click="navigateTo('wait')">
  77. 待审核
  78. </el-button>
  79. <el-button class="btnItem"
  80. :style="{ backgroundColor: activeTab === 'pass' ? '#2741DE' : '#E5EBFE', color: activeTab === 'pass' ? 'white' : '#666' }"
  81. @click="navigateTo('pass')">
  82. 已通过
  83. </el-button>
  84. <el-button class="btnItem"
  85. :style="{ backgroundColor: activeTab === 'done' ? '#2741DE' : '#E5EBFE', color: activeTab === 'done' ? 'white' : '#666' }"
  86. @click="navigateTo('done')">
  87. 已完成
  88. </el-button>
  89. <el-button class="btnItem"
  90. :style="{ backgroundColor: activeTab === 'reject' ? '#2741DE' : '#E5EBFE', color: activeTab === 'reject' ? 'white' : '#666' }"
  91. @click="navigateTo('reject')">
  92. 已驳回
  93. </el-button>
  94. </el-button-group>
  95. <div class="info-tooltip">
  96. <el-popover placement="top" title="数据说明" :width="260" trigger="hover"
  97. content="收款的所有页面:订单记录默认按照付款时间降序排列" popper-class="custom-popover" :show-arrow="false">
  98. <template #reference>
  99. <el-icon class="service-icon">
  100. <Warning />
  101. </el-icon>
  102. </template>
  103. </el-popover>
  104. </div>
  105. </div>
  106. <!-- 删除客服的添加收款按钮 -->
  107. <div class="btnAdd"></div>
  108. </div>
  109. <div class="table">
  110. <el-table :data="tableData" style="width: 80vw;height:64vh;" @sort-change="handleSortChange"
  111. :row-style="{ height: '60px' }" :header-cell-style="{ textAlign: 'center' }"
  112. :cell-style="{ textAlign: 'center' }">
  113. <el-table-column type="index" label="序号" width="100px" fixed="left">
  114. <template #default="scope">
  115. <span>{{ scope.$index + 1 + (pageInfo.pageNum - 1) * pageInfo.pageSize }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column fixed="left" prop="jwcode" label="Homily ID" width="110px" />
  119. <el-table-column fixed="left" prop="name" label="姓名" width="110px" />
  120. <el-table-column prop="marketName" label="所属地区" width="80px" />
  121. <el-table-column prop="activity" label="活动名称" width="120px" show-overflow-tooltip />
  122. <el-table-column prop="goodsName" label="产品名称" width="120px" />
  123. <el-table-column prop="goodNum" label="产品数量" width="130px">
  124. <template #default="scope">
  125. <span v-if="scope.row.goodsName == '金币充值'">{{ scope.row.permanentGold }}</span>
  126. <span v-else>{{ scope.row.goodNum }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="paymentCurrency" label="付款币种" width="100px" />
  130. <el-table-column prop="paymentAmount" label="付款金额" width="120px" />
  131. <!-- 地区财务显示到账币种/金额/手续费已通过/已完成标签页 -->
  132. <el-table-column prop="receivedCurrency" label="到账币种"
  133. v-if="activeTab == 'pass' || activeTab == 'done'" width="150px"></el-table-column>
  134. <el-table-column prop="receivedAmount" label="到账金额"
  135. v-if="activeTab == 'pass' || activeTab == 'done'" width="150px">
  136. <template #default="scope">
  137. <div v-if="!scope.row.receivedAmount">
  138. <text style="color: #FA5A1E;">待补充</text>
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column prop="handlingCharge" label="手续费"
  143. v-if="activeTab == 'pass' || activeTab == 'done'" width="150px">
  144. <template #default="scope">
  145. <div v-if="scope.row.handlingCharge == null">
  146. <text style="color: #FA5A1E;">待补充</text>
  147. </div>
  148. </template>
  149. </el-table-column>
  150. <el-table-column prop="payType" label="支付方式" width="130px" />
  151. <el-table-column prop="payTime" label="付款时间" width="180px" />
  152. <el-table-column prop="voucher" label="转账凭证" width="110px">
  153. <template #default="scope">
  154. <div v-if="scope.row.voucher"
  155. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  156. @click="previewImage(scope.row.voucher)">
  157. <img :src="scope.row.voucher" alt="支付凭证" style="width: auto; height: 40px;">
  158. </div>
  159. <div v-else
  160. style="display: flex; justify-content: center; align-items: center; height: 40px;">
  161. </div>
  162. </template>
  163. </el-table-column>
  164. <el-table-column prop="submitterName" label="提交人" width="150px"
  165. show-overflow-tooltip></el-table-column>
  166. <!-- 地区财务显示审核人已通过/已驳回/已完成标签页 -->
  167. <el-table-column prop="auditName" label="审核人"
  168. v-if="activeTab == 'pass' || activeTab == 'reject' || activeTab == 'done'" width="150px"
  169. show-overflow-tooltip></el-table-column>
  170. <el-table-column prop="receivedTime" label="到账时间"
  171. v-if="activeTab == 'pass' || activeTab == 'done'" width="180px" />
  172. <el-table-column prop="remark" label="备注" v-if="activeTab != 'reject'" width="150px"
  173. show-overflow-tooltip></el-table-column>
  174. <el-table-column prop="status" fixed="right" label="订单状态" v-if="activeTab == 'done'"
  175. width="150px" show-overflow-tooltip>
  176. <template #default="scope">
  177. <span style="color: rgb(242, 84, 83);" v-if="scope.row.status == 6">退款</span>
  178. <span style="color: rgb(127,204,133);" v-else>正常</span>
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="auditTime" label="驳回时间" v-if="activeTab == 'reject'" width="180px"
  182. show-overflow-tooltip></el-table-column>
  183. <el-table-column prop="rejectReason" label="驳回理由" v-if="activeTab == 'reject'" width="150px">
  184. <template #default="scope">
  185. <div class="ellipsis-container"
  186. @mouseenter="handleMouseEnter($event, scope.row.rejectReason)"
  187. @mouseleave="handleMouseLeave" @mousemove="handleMouseMove($event)">
  188. <span class="ellipsis-text">
  189. {{ scope.row.rejectReason || '—' }}
  190. </span>
  191. <!-- 自定义提示框 -->
  192. <div v-if="showTooltip && tooltipContent" class="custom-tooltip" :style="{
  193. left: `${tooltipLeft}px`,
  194. top: `${tooltipTop}px`
  195. }">
  196. {{ tooltipContent }}
  197. </div>
  198. </div>
  199. </template>
  200. </el-table-column>
  201. <!-- 地区财务表格操作待审核审核已通过编辑 -->
  202. <el-table-column fixed="right" label="操作" width="120px" v-if="activeTab != 'reject'">
  203. <template #default=scope>
  204. <el-link v-if="activeTab == 'wait'" style="color: #2741DE;"
  205. @click="openAuditForm(scope.row)">审核
  206. </el-link>
  207. <el-link
  208. v-else-if="activeTab == 'pass' && !(scope.row.status == 6 || scope.row.status == 4) && scope.row.receivedMarket == scope.row.submitterMarket"
  209. style="color: #2741DE;" @click="openEditForm(scope.row)">编辑
  210. </el-link>
  211. <el-link
  212. v-else-if="activeTab == 'done' && scope.row.status == 4 && startsWith(scope.row.orderCode, 'GOLDCOIN')"
  213. style="color: rgb(242, 84, 83);" @click="openRefundConfirm(scope.row)">退款
  214. </el-link>
  215. </template>
  216. </el-table-column>
  217. </el-table>
  218. </div>
  219. <div class="pagination">
  220. <el-pagination background :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize"
  221. :page-sizes="[5, 10, 20, 50, 100]" layout="total, sizes, prev, pager, next, jumper"
  222. :total="total" @size-change="handlePagination('size', $event)"
  223. @current-change="handlePagination('page', $event)"></el-pagination>
  224. </div>
  225. </el-card>
  226. </div>
  227. <!-- 退款确认弹窗 -->
  228. <div class="recallDialog" v-show="refundConfirmDialog">
  229. <div class="close">
  230. <button @click="closeConfirmRefund" class="Btn">关闭</button>
  231. </div>
  232. <div class="text">
  233. <text class="txt">{{ textContent }}</text>
  234. </div>
  235. <div class="cancle">
  236. <button @click="closeConfirmRefund" class="Btn">取消</button>
  237. </div>
  238. <div class="confirm">
  239. <button @click="openRefundDialog" class="Btn">确定</button>
  240. </div>
  241. </div>
  242. <!-- 导出列表 -->
  243. <el-dialog v-model="exportListVisible" title="导出列表" width="60vw">
  244. <el-table :data="exportList" style="width: 100% ;height: 60vh;" :loading="exportListLoading">
  245. <el-table-column prop="fileName" label="文件名" />
  246. <el-table-column prop="state" label="状态">
  247. <template #default="scope">
  248. <el-tag :type="getTagType(scope.row.state)" :effect="scope.row.state === 3 ? 'light' : 'plain'">
  249. {{ getTagText(scope.row.state) }}
  250. </el-tag>
  251. </template>
  252. </el-table-column>
  253. <el-table-column prop="createTime" label="创建时间">
  254. <template #default="scope">
  255. {{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
  256. </template>
  257. </el-table-column>
  258. <el-table-column label="操作">
  259. <template #default="scope">
  260. <el-button type="primary" size="small" @click="downloadExportFile(scope.row)"
  261. :disabled="scope.row.state !== 2">
  262. 下载
  263. </el-button>
  264. </template>
  265. </el-table-column>
  266. </el-table>
  267. <template #footer>
  268. <div class="dialog-footer">
  269. <el-button text @click="exportListVisible = false">关闭</el-button>
  270. </div>
  271. </template>
  272. </el-dialog>
  273. <!-- 审核弹窗 -->
  274. <el-dialog class="adddialog" v-model="auditFormisible" width="20vw" :before-close="closeAuditForm">
  275. <el-form class="addForm" label-width="4vw" label-position="left">
  276. <el-form-item label="精网号">
  277. <el-input disabled="true" v-model="auditFormData.jwcode" placeholder="请输入驳回理由" />
  278. </el-form-item>
  279. <el-form-item label="客户姓名">
  280. <el-input disabled="true" v-model="auditFormData.name" placeholder="请输入客户姓名" />
  281. </el-form-item>
  282. <el-form-item label="所属地区">
  283. <el-input disabled="true" v-model="auditFormData.market" />
  284. </el-form-item>
  285. <el-form-item label="活动名称">
  286. <el-input disabled="true" v-model="auditFormData.activity" placeholder="请输入活动名称" />
  287. </el-form-item>
  288. <el-form-item label="产品名称">
  289. <el-select disabled="true" v-model="auditFormData.goodsName" />
  290. </el-form-item>
  291. <el-form-item v-if="!isGold" label="产品数量">
  292. <div style="display: flex;">
  293. <el-input disabled="true" style="padding-right: 30px; flex: 3;" v-model="auditFormData.goodNum"
  294. placeholder="请输入产品数量" />
  295. <CurrencySelect disabled="true" v-model="auditFormData.numUnit" :items="numUnitList"
  296. style="flex: 1.5;" placeholder="单位" @change="handleCurrencyChange" />
  297. </div>
  298. </el-form-item>
  299. <div v-show="isGold" style="margin-bottom: 15px; display: flex;">
  300. <div style=" display: flex; ">
  301. <span
  302. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">永久金币</span>
  303. <el-input disabled="true"
  304. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  305. v-model="auditFormData.permanentGold" />
  306. </div>
  307. <div style="padding-right: 5px; display: flex;">
  308. <span
  309. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">免费金币</span>
  310. <el-input disabled="true"
  311. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  312. v-model="auditFormData.freeGold" />
  313. </div>
  314. </div>
  315. <el-form-item label="付款币种">
  316. <el-select disabled="true" v-model="auditFormData.paymentCurrency" placeholder="请选择付款币种"
  317. @change="handleCurrencyChange" />
  318. </el-form-item>
  319. <el-form-item label="付款金额">
  320. <el-input disabled="true" v-model="auditFormData.paymentAmount" placeholder="请输入付款金额" />
  321. </el-form-item>
  322. <el-form-item label="支付方式">
  323. <el-select disabled="true" v-model="auditFormData.payType" :items="paytypeOptions"
  324. placeholder="请选择支付方式" />
  325. </el-form-item>
  326. <el-form-item label="到账地区">
  327. <el-select disabled="true" v-model="auditFormData.receivedMarket" placeholder="到账地区" />
  328. </el-form-item>
  329. <el-form-item label="付款时间">
  330. <el-date-picker disabled="true" type="datetime" v-model="auditFormData.payTime"
  331. placeholder="请选择付款时间" />
  332. </el-form-item>
  333. <el-form-item label="转账凭证">
  334. <div class="pic">
  335. <el-upload disabled="true" ref="uploadRef" class="uploader" :show-file-list="false"
  336. list-type="picture-card" :auto-upload="false" :before-upload="beforeUpload"
  337. :on-error="handelImgErr" :on-change="handleImageChange" :http-request="customUpload">
  338. <img v-if="auditFormData.voucher" :src="auditFormData.voucher" class="avatar"
  339. style="height: 100%; width: 100%; object-fit: cover;" />
  340. <el-icon v-else class="avatar-uploader-icon">
  341. <Plus />
  342. </el-icon>
  343. </el-upload>
  344. <el-text class="picText">
  345. 仅支持.jpg .png格式文件 2 MB
  346. </el-text>
  347. </div>
  348. </el-form-item>
  349. <el-form-item label="备注">
  350. <el-input disabled="true" v-model="auditFormData.remark" type="textarea" :rows="3" maxlength="100"
  351. show-word-limit />
  352. </el-form-item>
  353. <el-form-item label="驳回理由" v-if="ifReject" required>
  354. <el-input v-model="auditFormData.rejectReason" type="textarea" :rows="3" placeholder="请输入驳回理由"
  355. maxlength="100" show-word-limit />
  356. </el-form-item>
  357. </el-form>
  358. <template #footer>
  359. <span class="dialog-footer" v-if="!ifReject">
  360. <el-button style="background-color: #7E91FF;" @click="ifReject = true">驳回</el-button>
  361. <el-button :style="{
  362. backgroundColor: isBtnDisabled ? '#E5E5E5FF' : '#2741DEFF',
  363. marginLeft: '60px',
  364. color: isBtnDisabled ? '#8A8A8A' : '#F3FAFE'
  365. }" @click="handelAudit" :disabled="isBtnDisabled">{{ btnText }}</el-button>
  366. </span>
  367. <span class="dialog-footer" v-if="ifReject">
  368. <el-button style="background-color: #7E91FF;" @click="closeAuditForm">取消</el-button>
  369. <el-button style="background-color: #2741DE; margin-left: 2.5vw;" type="primary"
  370. @click="throttledhandelAuditReject">确定</el-button>
  371. </span>
  372. </template>
  373. </el-dialog>
  374. <!-- 编辑填手续费弹窗 -->
  375. <el-dialog class="editdialog" v-model="editFormisible" width="20vw" :before-close="closeEditForm">
  376. <div class="content">
  377. <div class="left">
  378. <el-form class="editForm" label-width="4.5vw" label-position="left">
  379. <el-form-item label="精网号">
  380. <el-input disabled="true" v-model="editFormData.jwcode" placeholder="精网号" />
  381. </el-form-item>
  382. <el-form-item label="客户姓名">
  383. <el-input disabled="true" v-model="editFormData.name" placeholder="客户姓名" />
  384. </el-form-item>
  385. <el-form-item label="所属地区">
  386. <el-input disabled="true" v-model="editFormData.marketName" placeholder="所属地区" />
  387. </el-form-item>
  388. <el-form-item label="活动名称">
  389. <el-input disabled="true" v-model="editFormData.activity" placeholder="活动名称" />
  390. </el-form-item>
  391. <el-form-item label="产品名称">
  392. <el-select disabled="true" v-model="editFormData.goodsName" placeholder="产品名称"
  393. clearable></el-select>
  394. </el-form-item>
  395. <!-- 金币产品特殊显示 -->
  396. <el-form-item v-show="!isEditGold" label="产品数量">
  397. <div style="display: flex;">
  398. <el-input disabled="true" style="padding-right: 30px; flex: 3;"
  399. v-model="editFormData.goodNum" placeholder="请输入产品数量" />
  400. <CurrencySelect disabled="true" v-model="editFormData.numUnit" :items="numUnitList"
  401. style="flex: 1.5;" placeholder="单位" @change="handleCurrencyChange" />
  402. </div>
  403. </el-form-item>
  404. <div v-show="isEditGold" style="margin-bottom: 15px; display: flex;">
  405. <div style=" display: flex; margin-right: 10px;">
  406. <span
  407. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">永久金币</span>
  408. <el-input disabled="true"
  409. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  410. v-model="editFormData.permanentGold" />
  411. </div>
  412. <div style="padding-right: 5px; display: flex;">
  413. <span
  414. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">免费金币</span>
  415. <el-input disabled="true"
  416. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  417. v-model="editFormData.freeGold" />
  418. </div>
  419. </div>
  420. <el-form-item label="付款币种">
  421. <CurrencySelect :disabled="!ifOnline" v-model="editFormData.paymentCurrency"
  422. :items="customOptions" placeholder="付款币种" />
  423. </el-form-item>
  424. <el-form-item label="付款金额">
  425. <el-input :disabled="!ifOnline" v-model="editFormData.paymentAmount" placeholder="付款金额" />
  426. </el-form-item>
  427. <el-form-item label="支付方式">
  428. <el-select disabled="true" v-model="editFormData.payType" placeholder="支付方式"
  429. clearable></el-select>
  430. </el-form-item>
  431. <el-form-item label="到账地区">
  432. <el-select disabled="true" v-model="editFormData.receivedMarket" placeholder="到账地区"
  433. clearable></el-select>
  434. </el-form-item>
  435. <el-form-item label="付款时间">
  436. <el-date-picker disabled="true" type="datetime" v-model="editFormData.payTime"
  437. placeholder="付款时间" />
  438. </el-form-item>
  439. <el-form-item label="转账凭证">
  440. <div class="pic">
  441. <el-upload disabled="true" ref="uploadRef" class="uploader" :show-file-list="false"
  442. list-type="picture-card" :auto-upload="false" :before-upload="beforeUpload"
  443. :on-error="handelImgErr" :on-change="handleImageChange"
  444. :http-request="customUpload">
  445. <img v-if="editFormData.voucher" :src="editFormData.voucher" class="avatar"
  446. style="height: 100%; width: 100%; object-fit: cover;" />
  447. <el-icon v-else class="avatar-uploader-icon">
  448. <Plus />
  449. </el-icon>
  450. </el-upload>
  451. <el-text class="picText">仅支持.jpg .png格式文件 2 MB</el-text>
  452. </div>
  453. </el-form-item>
  454. <el-form-item label="备注">
  455. <el-input disabled="true" v-model="editFormData.remark" type="textarea" :rows="4"
  456. placeholder="备注" maxlength="100" show-word-limit />
  457. </el-form-item>
  458. </el-form>
  459. </div>
  460. <div class="right">
  461. <el-form ref="editFormRef" :rules="editFormRule" :model="editFormData" class="editFormRighrt"
  462. label-width="4.5vw" label-position="left">
  463. <el-form-item label="到账货币">
  464. <CurrencySelect v-model="editFormData.receivedCurrency" :items="customOptions"
  465. placeholder="请选择到账货币" />
  466. </el-form-item>
  467. <el-form-item label="到账金额" prop="receivedAmount">
  468. <el-input v-model="editFormData.receivedAmount" placeholder="请输入到账金额" type="number" />
  469. </el-form-item>
  470. <el-form-item label="手续费" prop="handlingCharge">
  471. <el-input v-model="editFormData.handlingCharge" placeholder="请输入手续费" type="number" />
  472. </el-form-item>
  473. <el-form-item label="到账时间">
  474. <el-date-picker type="datetime" v-model="editFormData.receivedTime" placeholder="请选择到账时间" />
  475. </el-form-item>
  476. </el-form>
  477. <span class="editBtns">
  478. <button class="editBtn1" @click="closeEditForm">
  479. <text class="txt">取消</text>
  480. </button>
  481. <button class="editBtn2" @click="throttledsubmitEditForm">
  482. <text class="txt">提交</text>
  483. </button>
  484. </span>
  485. </div>
  486. </div>
  487. </el-dialog>
  488. <!-- 新增退款 -->
  489. <el-dialog v-model="refundDialog" title="退款" class="refundDialog" overflow draggable style="width: 40vw;"
  490. :before-close="closeRefundForm">
  491. <div style="display: flex;">
  492. <div class="left">
  493. <div class="add-item">
  494. <el-text style="width:4vw;">精网号</el-text>
  495. <el-input v-model="refundFormData.jwcode" style="width:10vw;" disabled />
  496. </div>
  497. <div class="add-item">
  498. <el-text style="width:4vw;">客户姓名</el-text>
  499. <el-input v-model="refundFormData.name" style="width:10vw;" disabled />
  500. </div>
  501. <div class="add-item">
  502. <el-text style="width:4vw;">所属地区</el-text>
  503. <el-input v-model="refundFormData.marketName" style="width:10vw;" disabled />
  504. </div>
  505. <div class="add-item">
  506. <el-text style="width:4vw;">活动名称</el-text>
  507. <el-input v-model="refundFormData.activity" style="width:10vw;" disabled />
  508. </div>
  509. <div class="add-item">
  510. <el-text style="width:4vw;">产品名称</el-text>
  511. <el-input v-model="refundFormData.goodsName" style="width:10vw;" disabled />
  512. </div>
  513. <div v-show="!isRefundGold" class="add-item">
  514. <el-text style="width:4vw;">产品数量</el-text>
  515. <el-input style="padding-right: 10px; width:6.5vw;" v-model="refundFormData.goodNum"
  516. placeholder="请输入产品数量" disabled />
  517. <CurrencySelect disabled="true" v-model="refundFormData.numUnit" :items="numUnitList"
  518. style=" width: 3.5vw;" placeholder="单位" @change="handleCurrencyChange" />
  519. </div>
  520. <div v-show="isRefundGold" style="display: flex; margin-bottom: 10px;">
  521. <div style=" display: flex; align-items: center;justify-content: center; ">
  522. <span style="color: #999999; white-space: nowrap;">永久金币</span>
  523. <el-input style="padding-right: 10px; height: 30px; width: 70px;"
  524. v-model="refundFormData.permanentGold" disabled />
  525. </div>
  526. <div style=" display: flex; align-items: center;justify-content: center; ">
  527. <span style="color: #999999; white-space: nowrap;">免费金币</span>
  528. <el-input style="padding-right: 10px; height: 30px; width: 70px;"
  529. v-model="refundFormData.freeGold" disabled />
  530. </div>
  531. </div>
  532. <div class="add-item">
  533. <el-text style="width:4vw;">付款币种</el-text>
  534. <el-input v-model="refundFormData.paymentCurrency" style="width:10vw;" disabled />
  535. </div>
  536. <div class="add-item">
  537. <el-text style="width:4vw;">付款金额</el-text>
  538. <el-input v-model="refundFormData.paymentAmount" style="width:10vw;" disabled />
  539. </div>
  540. <div class="add-item">
  541. <el-text style="width:4vw;">支付方式</el-text>
  542. <el-input v-model="refundFormData.payType" style="width:10vw;" disabled />
  543. </div>
  544. <div class="add-item">
  545. <el-text style="width:4vw;">付款时间</el-text>
  546. <el-date-picker v-model="refundFormData.payTime" type="datetime" style="width:10vw;" disabled />
  547. </div>
  548. <div class="add-item">
  549. <el-text style="width:4vw;" size="small">转账凭证</el-text>
  550. <el-form-item :rules="{ required: true, message: '请上传图片', trigger: 'change' }">
  551. <el-upload ref="uploadRef" :auto-upload="false" list-type="picture-card"
  552. :show-file-list="false">
  553. <template #default>
  554. <img v-if="refundFormData.voucher" :src="refundFormData.voucher"
  555. style="width: 100%; height: 100%; object-fit: cover;">
  556. <el-icon v-else>
  557. <Plus />
  558. </el-icon>
  559. </template>
  560. </el-upload>
  561. </el-form-item>
  562. </div>
  563. <div class="add-item">
  564. <el-text style="width:4vw;">备注</el-text>
  565. <el-input v-model="refundFormData.remark" style="width:10vw;" :rows="2" type="textarea"
  566. maxLength="100" disabled show-word-limit />
  567. </div>
  568. </div>
  569. <div class="right">
  570. <div class="add-item">
  571. <el-text style="width:4vw;">退款模式</el-text>
  572. <el-radio-group v-model="refundFormData.refundModel">
  573. <el-radio value="0">全部退款</el-radio>
  574. <el-radio value="1">部分退款</el-radio>
  575. </el-radio-group>
  576. </div>
  577. <div v-show="refundFormData.refundModel == '1'" style="display: flex; margin-bottom: 10px;">
  578. <div style=" display: flex; align-items: center;justify-content: center; ">
  579. <span style="color: #999999; white-space: nowrap;">永久金币</span>
  580. <el-input style="padding-right: 10px; height: 30px; width: 70px;"
  581. v-model="refundFormData.partRefundGold" dsabled />
  582. </div>
  583. <div style=" display: flex; align-items: center;justify-content: center; ">
  584. <span style="color: #999999; white-space: nowrap;">免费金币</span>
  585. <el-input style="padding-right: 10px; height: 30px; width: 70px;"
  586. v-model="refundFormData.partRefundFree" />
  587. </div>
  588. </div>
  589. <div class="add-item">
  590. <el-text style="width:4vw;">退款理由</el-text>
  591. <el-input v-model="refundFormData.refundReason" style="width:10vw;" :rows="5" maxlength="150"
  592. show-word-limit type="textarea" />
  593. </div>
  594. <div>ps:请在退款理由表明用户的退款需求</div>
  595. <div style="display:flex;justify-content: center;margin-top: 5vh;">
  596. <el-button type="default" @click="resetRefund">重置</el-button>
  597. <el-button type="primary" @click="throttledsubmitRefund">提交</el-button>
  598. </div>
  599. </div>
  600. </div>
  601. </el-dialog>
  602. </div>
  603. </template>
  604. <script setup>
  605. // 仅导入地区财务所需依赖
  606. import { ref, watch, onMounted } from 'vue';
  607. import { storeToRefs } from 'pinia';
  608. import { ElMessage, ElMessageBox } from 'element-plus';
  609. import API from '@/util/http.js';
  610. import request from '@/util/http.js';
  611. import moment from 'moment';
  612. import _ from 'lodash';
  613. import { Plus } from '@element-plus/icons-vue';
  614. import { startsWith } from './utils/util.js'
  615. import { isNumber } from 'lodash'
  616. // 筛选地区树
  617. const market = ref([])
  618. // 地区财务专属组件
  619. import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue';
  620. // 静态数据与规则(仅保留必要项)
  621. import { editFormRule } from './utils/recriveFormRules.js';
  622. import { productList, MarketNameForId, CurrencyForId, marketList } from './utils/staticData.js';
  623. import { useAdminStore } from '@/store/index.js';
  624. import { hasMenuPermission } from '@/utils/menuTreePermission.js';
  625. // ===================== 1. 核心状态管理(仅地区财务) =====================
  626. const adminStore = useAdminStore();
  627. const { menuTree } = storeToRefs(adminStore);
  628. // 角色固定:地区财务(caiwu=true,其他角色关闭)
  629. const kefu = ref(false);
  630. const caiwu = ref(true);
  631. const HQcaiwu = ref(false);
  632. const superAdmin = ref(false);
  633. // 表格与分页数据
  634. const tableData = ref([]);
  635. const total = ref(0);
  636. const pageInfo = ref({ pageSize: 10, pageNum: 1 });
  637. // 搜索条件
  638. const searchData = ref({});
  639. const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)];
  640. const getTime = ref([]);
  641. // 标签页:默认“待审核”
  642. const activeTab = ref('wait');
  643. // 审核弹窗状态
  644. const auditFormisible = ref(false);
  645. const auditFormData = ref({});
  646. const ifReject = ref(false);
  647. const countdown = ref(0);
  648. const isBtnDisabled = ref(false);
  649. const btnText = ref('通过(3)');
  650. // 编辑弹窗状态
  651. const editFormisible = ref(false);
  652. const editFormData = ref({});
  653. const editFormRef = ref(null);
  654. const isEditGold = ref(false); // 金币产品标记
  655. const ifOnline = ref(false); // 在线支付标记
  656. // 辅助状态:图片上传、悬浮提示
  657. const uploadRef = ref(null);
  658. const showTooltip = ref(false);
  659. const tooltipContent = ref('');
  660. const tooltipLeft = ref(0);
  661. const tooltipTop = ref(0);
  662. // 退款确认弹窗
  663. const refundConfirmDialog = ref(false)
  664. const textContent = ref('')
  665. //退款弹窗
  666. const refundDialog = ref(false)
  667. const refundFormData = ref({})
  668. const openRefundDialog = () => {
  669. refundDialog.value = true
  670. closeConfirmRefund()
  671. }
  672. const closeRefundForm = () => {
  673. refundDialog.value = false
  674. refundFormData.value = {}
  675. }
  676. const isRefundGold = ref(false)
  677. const ifRefundGold = () => {
  678. if (refundFormData.value.goodsName === '金币充值') {
  679. isRefundGold.value = true
  680. refundFormData.value.goodNum = 0
  681. } else {
  682. isRefundGold.value = false
  683. }
  684. }
  685. // 基础数据
  686. const adminData = ref({});
  687. const activityList = ref([]);
  688. const customOptions = ref(['美元(USD)', '港币(HKD)', '新币(SGD)', '马币(MYR)', '泰铢(THB)', '加币(CAD)', '越南盾(VDN)', '韩元(KRW)']);
  689. const paytypeList = ["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"];
  690. const paytypeOptions = ref([...paytypeList]);
  691. // ===================== 2. 核心功能函数(仅地区财务) =====================
  692. //确认退款弹窗
  693. const openRefundConfirm = (row) => {
  694. textContent.value = '将要对该订单退款!'
  695. refundConfirmDialog.value = true
  696. refundFormData.value = { ...row }
  697. ifRefundGold()
  698. console.log(row);
  699. }
  700. const closeConfirmRefund = () => {
  701. refundConfirmDialog.value = false
  702. textContent.value = ''
  703. }
  704. //导出相关
  705. const exportListVisible = ref(false)
  706. const exportList = ref([])
  707. const exportListLoading = ref(false)
  708. const exportExcel = async function () {
  709. let payCurrencySelect = '';
  710. let goodsName = '';
  711. // 处理时间范围
  712. if (getTime.value && getTime.value.length === 2) {
  713. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss');
  714. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss');
  715. } else {
  716. searchData.value.startTime = '';
  717. searchData.value.endTime = '';
  718. }
  719. // 处理产品名称(级联选择取最后一级)
  720. if (searchData.value.goodsName) {
  721. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1];
  722. }
  723. // 处理付款币种(转ID)
  724. if (searchData.value.paymentCurrency) {
  725. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency);
  726. }
  727. if (searchData.value.jwcode && !isNumber(searchData.value.jwcode)) {
  728. ElMessage.error('精网号只能是数字')
  729. return
  730. }
  731. const cashRoleId = '1';
  732. const submitterMarket = adminData.value.markets;
  733. searchData.value.status = 46;
  734. const params = {
  735. ...pageInfo.value,
  736. cashCollection: {
  737. ...searchData.value,
  738. submitterId: adminData.value.id,
  739. receivedMarket: MarketNameForId(submitterMarket),
  740. cashRoleId: cashRoleId,
  741. paymentCurrency: payCurrencySelect,
  742. submitterMarket: submitterMarket,
  743. goodsName: goodsName,
  744. market: MarketNameForId(searchData.value.market)
  745. }
  746. }
  747. const res = await API({ url: '/export/exportCash', data: params })
  748. if (res.code === 200) {
  749. ElMessage.success('导出成功')
  750. } else {
  751. ElMessage.error(res.msg || '导出失败')
  752. }
  753. }
  754. const openExportList = () => {
  755. getExportList()
  756. exportListVisible.value = true
  757. }
  758. //获取导出列表
  759. const getExportList = async () => {
  760. exportListLoading.value = true
  761. try {
  762. const result = await API({ url: '/export/export' })
  763. if (result.code === 200) {
  764. const filteredData = result.data.filter(item => {
  765. return item.type === 13
  766. })
  767. exportList.value = filteredData
  768. } else {
  769. ElMessage.error(result.msg || '获取导出列表失败')
  770. }
  771. } catch (error) {
  772. console.error('获取导出列表出错:', error)
  773. ElMessage.error('获取导出列表失败,请稍后重试')
  774. } finally {
  775. exportListLoading.value = false
  776. }
  777. }
  778. const downloadExportFile = (item) => {
  779. if (item.state === 2) {
  780. const link = document.createElement('a')
  781. link.href = item.url
  782. link.download = item.fileName
  783. link.click()
  784. } else {
  785. ElMessage.warning('文件还在导出中,请稍后再试')
  786. }
  787. }
  788. //根据状态返回对应的标签类型
  789. const getTagType = (state) => {
  790. switch (state) {
  791. case 0:
  792. return 'info';
  793. case 1:
  794. return 'primary';
  795. case 2:
  796. return 'success';
  797. case 3:
  798. return 'danger';
  799. default:
  800. return 'info';
  801. }
  802. }
  803. //根据状态返回对应的标签文案
  804. const getTagText = (state) => {
  805. switch (state) {
  806. case 0:
  807. return '待执行';
  808. case 1:
  809. return '执行中';
  810. case 2:
  811. return '执行完成';
  812. case 3:
  813. return '执行出错';
  814. default:
  815. return '未知状态';
  816. }
  817. }
  818. // 2.1 数据加载:获取地区财务订单列表
  819. const getlist = async () => {
  820. try {
  821. let payCurrencySelect = '';
  822. let goodsName = '';
  823. // 处理时间范围
  824. if (getTime.value && getTime.value.length === 2) {
  825. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss');
  826. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss');
  827. } else {
  828. searchData.value.startTime = '';
  829. searchData.value.endTime = '';
  830. }
  831. // 处理产品名称(级联选择取最后一级)
  832. if (searchData.value.goodsName) {
  833. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1];
  834. }
  835. // 处理付款币种(转ID)
  836. if (searchData.value.paymentCurrency) {
  837. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency);
  838. }
  839. // 地区财务固定参数:角色ID=1,按标签页筛选状态
  840. const cashRoleId = '1';
  841. const receivedMarket = adminData.value.markets;
  842. if (activeTab.value === 'wait') searchData.value.status = 0;
  843. else if (activeTab.value === 'pass') searchData.value.status = 13;
  844. else if (activeTab.value === 'done') searchData.value.status = 46;
  845. else if (activeTab.value === 'reject') searchData.value.status = 2;
  846. // 地区处理
  847. const markets = ref(null)
  848. if (searchData.value.markets) {
  849. markets.value = searchData.value.markets[searchData.value.markets.length - 1]
  850. console.log('地区转换', markets.value)
  851. }
  852. if (searchData.value.jwcode) {
  853. const isPositiveInteger = /^[1-9]\d*$/.test(searchData.value.jwcode);
  854. if (!isPositiveInteger) {
  855. ElMessage.error('请输入正确的精网号')
  856. return;
  857. }
  858. }
  859. const result = await request({
  860. url: '/cashCollection/selectCollection',
  861. data: {
  862. ...pageInfo.value,
  863. cashCollection: {
  864. ...searchData.value,
  865. submitterId: adminData.value.id,
  866. receivedMarket: MarketNameForId(receivedMarket),
  867. cashRoleId: cashRoleId,
  868. paymentCurrency: payCurrencySelect,
  869. submitterMarket: receivedMarket,
  870. goodsName: goodsName,
  871. // market: MarketNameForId(searchData.value.market)
  872. market: markets.value
  873. }
  874. }
  875. });
  876. if (result.code === 200) {
  877. tableData.value = result.data.list;
  878. total.value = result.data.total;
  879. } else {
  880. ElMessage.error('订单数据加载失败');
  881. }
  882. } catch (error) {
  883. console.error('地区财务订单列表请求异常:', error);
  884. ElMessage.error('网络异常,请重试');
  885. }
  886. };
  887. //重置退款
  888. const resetRefund = () => {
  889. refundFormData.value.refundModel = ''
  890. refundFormData.value.refundReason = ''
  891. }
  892. //提交退款
  893. const submitRefund = async () => {
  894. try {
  895. if (refundFormData.value.goodsName != '金币充值') {
  896. return ElMessage.error('线上数据仅支持金币充值退款');
  897. }
  898. if (!refundFormData.value.refundModel) {
  899. return ElMessage.error('请选择退款方式');
  900. }
  901. if (!refundFormData.value.refundReason) {
  902. return ElMessage.error('请输入退款原因');
  903. }
  904. if (refundFormData.value.refundModel == 0) {
  905. refundFormData.value.partRefundGold = refundFormData.value.permanentGold,
  906. refundFormData.value.partRefundFree = refundFormData.value.freeGold
  907. }
  908. const result = await request({
  909. url: '/Money/addOnline',
  910. data: {
  911. jwcode: refundFormData.value.jwcode,
  912. name: refundFormData.value.name,
  913. market: refundFormData.value.marketName,
  914. submitterId: adminData.value.id,
  915. submitterMarket: adminData.value.markets,
  916. remark: refundFormData.value.remark,
  917. refundReason: refundFormData.value.refundReason,
  918. refundModel: refundFormData.value.refundModel,
  919. originalOrderId: refundFormData.value.id,
  920. orderCode: refundFormData.value.orderCode,
  921. permanentGold: (refundFormData.value.permanentGold) * 100 || 0,
  922. freeGold: (refundFormData.value.freeGold) * 100 || 0,
  923. partRefundGold: (refundFormData.value.partRefundGold) * 100 || 0,
  924. partRefundFree: (refundFormData.value.partRefundFree) * 100 || 0,
  925. handlingCharge: refundFormData.value.handlingCharge == null ? null : refundFormData.value.handlingCharge * 100,
  926. }
  927. })
  928. if (result.code == 200) {
  929. ElMessage.success('新增退款成功')
  930. getlist()
  931. closeRefundForm()
  932. } else {
  933. ElMessage.error(result.msg)
  934. getlist()
  935. }
  936. console.log('返回参数:', result);
  937. } catch (error) {
  938. console.log(error);
  939. }
  940. }
  941. // 2.2 搜索与重置
  942. const search = () => {
  943. getlist();
  944. ElMessage.success('查询成功');
  945. };
  946. const reset = () => {
  947. searchData.value = {};
  948. // 重置页码
  949. pageInfo.value.pageNum = 1;
  950. getTime.value = []
  951. getlist();
  952. };
  953. // 2.3 标签页切换
  954. const navigateTo = async (tab) => {
  955. activeTab.value = tab;
  956. await getlist();
  957. };
  958. // 2.4 审核功能
  959. // 打开审核弹窗
  960. const openAuditForm = (row) => {
  961. auditFormData.value = { ...row, market: row.marketName };
  962. ifGold(auditFormData.value)
  963. console.log('isGold', isGold.value);
  964. auditFormisible.value = true;
  965. };
  966. // 关闭审核弹窗
  967. const closeAuditForm = () => {
  968. ifReject.value = false;
  969. auditFormisible.value = false;
  970. auditFormData.value = {};
  971. };
  972. // 审核通过
  973. const handelAudit = async () => {
  974. try {
  975. const result = await request({
  976. url: '/cashAudit/collectionAudit',
  977. data: {
  978. orderCode: auditFormData.value.orderCode,
  979. action: 1,
  980. auditId: adminData.value.id
  981. }
  982. });
  983. if (result.code === 200) {
  984. ElMessage.success('审核通过');
  985. getlist();
  986. closeAuditForm();
  987. } else {
  988. ElMessage.error(result.msg || '审核失败');
  989. }
  990. } catch (error) {
  991. console.error('审核通过请求异常:', error);
  992. ElMessage.error('网络异常,请重试');
  993. }
  994. };
  995. // 审核驳回
  996. const handelAuditReject = async () => {
  997. if (!auditFormData.value.rejectReason) {
  998. ElMessage.warning('请输入驳回理由');
  999. return;
  1000. }
  1001. try {
  1002. const result = await request({
  1003. url: '/cashAudit/collectionAudit',
  1004. data: {
  1005. orderCode: auditFormData.value.orderCode,
  1006. rejectReason: auditFormData.value.rejectReason,
  1007. action: 2,
  1008. auditId: adminData.value.id
  1009. }
  1010. });
  1011. if (result.code === 200) {
  1012. ElMessage.success('驳回成功');
  1013. getlist();
  1014. closeAuditForm();
  1015. } else {
  1016. ElMessage.error(result.msg || '驳回失败');
  1017. }
  1018. } catch (error) {
  1019. console.error('审核驳回请求异常:', error);
  1020. ElMessage.error('网络异常,请重试');
  1021. }
  1022. };
  1023. //判断产品类型
  1024. const isGold = ref(false)
  1025. const ifGold = (data) => {
  1026. console.log('data', data);
  1027. if (data.goodsName === '金币充值') {
  1028. isGold.value = true
  1029. } else {
  1030. isGold.value = false
  1031. }
  1032. }
  1033. // 审核按钮倒计时(防止误操作)
  1034. watch(auditFormisible, (val) => {
  1035. if (val) {
  1036. countdown.value = 3;
  1037. isBtnDisabled.value = true;
  1038. btnText.value = `通过(${countdown.value})`;
  1039. const timer = setInterval(() => {
  1040. countdown.value--;
  1041. btnText.value = `通过(${countdown.value})`;
  1042. if (countdown.value <= 0) {
  1043. isBtnDisabled.value = false;
  1044. clearInterval(timer);
  1045. btnText.value = '通过';
  1046. }
  1047. }, 1000);
  1048. }
  1049. });
  1050. // 2.5 编辑手续费功能
  1051. // 打开编辑弹窗
  1052. const openEditForm = (row) => {
  1053. console.log('row.aaa', row.handlingCharge);
  1054. editFormData.value = { ...row };
  1055. // 区分金币产品与普通产品
  1056. if (row.goodsName === '金币充值') isEditGold.value = true;
  1057. else isEditGold.value = false;
  1058. // 在线支付订单允许修改付款信息
  1059. if (row.status === 3) ifOnline.value = true;
  1060. else ifOnline.value = false;
  1061. editFormisible.value = true;
  1062. };
  1063. // 关闭编辑弹窗
  1064. const closeEditForm = () => {
  1065. editFormisible.value = false;
  1066. editFormData.value = {};
  1067. editFormRef.value.resetFields();
  1068. };
  1069. // 提交编辑(补充手续费)
  1070. const submitEditForm = async () => {
  1071. try {
  1072. await editFormRef.value.validate();
  1073. // 处理时间格式
  1074. if (editFormData.value.receivedTime) {
  1075. editFormData.value.receivedTime = moment(editFormData.value.receivedTime).format('YYYY-MM-DD HH:mm:ss');
  1076. }
  1077. console.log('editFormData.value.handlingCharge', editFormData.value.handlingCharge);
  1078. const result = await request({
  1079. url: '/cashCollection/complete',
  1080. data: {
  1081. orderCode: editFormData.value.orderCode,
  1082. handlingCharge: editFormData.value.handlingCharge == null ? null : editFormData.value.handlingCharge * 100, // 转为分单位
  1083. paymentCurrency: CurrencyForId(editFormData.value.paymentCurrency),
  1084. paymentAmount: editFormData.value.paymentAmount * 100, // 转为分单位
  1085. receivedCurrency: CurrencyForId(editFormData.value.receivedCurrency),
  1086. receivedAmount: editFormData.value.receivedAmount * 100 || null, // 转为分单位
  1087. receivedTime: editFormData.value.receivedTime,
  1088. receivedRemark: editFormData.value.receivedRemark || ''
  1089. }
  1090. });
  1091. if (result.code === 200) {
  1092. ElMessage.success('编辑提交成功');
  1093. getlist();
  1094. closeEditForm();
  1095. } else {
  1096. ElMessage.error(result.msg || '提交失败');
  1097. }
  1098. } catch (error) {
  1099. console.error('编辑提交请求异常:', error);
  1100. ElMessage.error('表单验证失败,请检查数据格式');
  1101. }
  1102. };
  1103. // 2.6 辅助功能
  1104. // 图片预览
  1105. const previewImage = (imageUrl) => {
  1106. if (!imageUrl) return;
  1107. const imageElement = document.createElement('img');
  1108. imageElement.src = imageUrl;
  1109. imageElement.style.maxWidth = '80vw';
  1110. imageElement.style.maxHeight = '80vh';
  1111. imageElement.style.objectFit = 'contain';
  1112. const viewer = document.createElement('div');
  1113. viewer.style.position = 'fixed';
  1114. viewer.style.top = '0';
  1115. viewer.style.left = '0';
  1116. viewer.style.width = '100vw';
  1117. viewer.style.height = '100vh';
  1118. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  1119. viewer.style.display = 'flex';
  1120. viewer.style.justifyContent = 'center';
  1121. viewer.style.alignItems = 'center';
  1122. viewer.style.zIndex = '9999';
  1123. viewer.appendChild(imageElement);
  1124. // 点击关闭预览
  1125. viewer.addEventListener('click', () => {
  1126. document.body.removeChild(viewer);
  1127. });
  1128. document.body.appendChild(viewer);
  1129. };
  1130. // 驳回理由悬浮提示
  1131. const handleMouseEnter = (e, content) => {
  1132. if (!content) return;
  1133. showTooltip.value = true;
  1134. tooltipContent.value = content;
  1135. handleMouseMove(e);
  1136. };
  1137. const handleMouseLeave = () => {
  1138. showTooltip.value = false;
  1139. tooltipContent.value = '';
  1140. };
  1141. const handleMouseMove = (e) => {
  1142. // 提示框显示在鼠标左侧,避免遮挡
  1143. tooltipLeft.value = e.clientX - 210;
  1144. tooltipTop.value = e.clientY - 10;
  1145. };
  1146. // 2.7 基础数据加载(初始化)
  1147. // 获取管理员信息
  1148. const getAdminData = async () => {
  1149. try {
  1150. const result = await API({ url: '/admin/userinfo', data: {} });
  1151. adminData.value = result;
  1152. // 超级管理员判断(仅用于角色切换权限)
  1153. if (adminData.value.roleId === 2) {
  1154. superAdmin.value = true;
  1155. // 管理员所属地区提示
  1156. if (adminData.value.markets === '总部' || adminData.value.markets === '研发部') {
  1157. ElMessageBox.alert(
  1158. '管理员账号仅显示所属地区的财务数据,请确认地区设置',
  1159. '温馨提示',
  1160. { type: 'warning' }
  1161. );
  1162. }
  1163. }
  1164. } catch (error) {
  1165. console.error('管理员信息获取失败:', error);
  1166. ElMessage.error('管理员信息加载异常');
  1167. }
  1168. };
  1169. // 获取活动列表
  1170. const getActivitys = async () => {
  1171. try {
  1172. const result = await API({ url: '/cashCollection/getActivityList', data: {} });
  1173. if (result.code === 200) {
  1174. activityList.value = result.data;
  1175. } else {
  1176. ElMessage.error('活动列表加载失败');
  1177. }
  1178. } catch (error) {
  1179. console.error('活动列表获取失败:', error);
  1180. ElMessage.error('活动数据加载异常');
  1181. }
  1182. };
  1183. // 2.8 节流函数(防止重复提交)
  1184. const throttledhandelAuditReject = _.throttle(handelAuditReject, 3000, { trailing: false });
  1185. const throttledsubmitEditForm = _.throttle(submitEditForm, 3000, { trailing: false });
  1186. const throttledsubmitRefund = _.throttle(submitRefund, 5000, {
  1187. trailing: false
  1188. })
  1189. // 2.9 页面初始化
  1190. onMounted(async () => {
  1191. await getAdminData();
  1192. await getActivitys();
  1193. // 初始化加载地区财务订单数据
  1194. await getlist();
  1195. // if (!hasMenuPermission(menuTree.value, 67)) {
  1196. // ElMessageBox.alert(
  1197. // '您暂无该页面操作权限,请联系管理员',
  1198. // '权限提示',
  1199. // { type: 'error' }
  1200. // ).then(() => {
  1201. // window.history.back();
  1202. // });
  1203. // }
  1204. //背景预加载
  1205. const bgImg = new Image();
  1206. bgImg.src = '/src/assets/receive-recall.png';
  1207. getMarket()
  1208. });
  1209. // 2.10 未使用函数占位(避免报错)
  1210. const handleCurrencyChange = () => { };
  1211. const beforeUpload = () => true;
  1212. const handelImgErr = () => { };
  1213. const handleImageChange = () => { };
  1214. const customUpload = () => { };
  1215. const handleDatePickerChange = () => { };
  1216. const disabledDate = () => false;
  1217. const handleSortChange = () => { };
  1218. const getMarket = async function () {
  1219. try {
  1220. const result = await API({
  1221. url: '/market/selectMarket',
  1222. })
  1223. console.log('看看地区树', result)
  1224. const transformTree = (nodes) => {
  1225. const allChildren = nodes.flatMap(node => node.children || []);
  1226. return allChildren.map(child => {
  1227. const grandchildren = child.children && child.children.length
  1228. ? transformTree([child])
  1229. : null;
  1230. return {
  1231. value: child.id,
  1232. label: child.name,
  1233. children: grandchildren
  1234. };
  1235. });
  1236. };
  1237. market.value = transformTree(result.data)
  1238. console.log('转换后的地区树==============', market.value)
  1239. } catch (error) {
  1240. console.log('请求失败', error)
  1241. }
  1242. }
  1243. const handlePagination = (type, val) => {
  1244. if (type === 'size') pageInfo.value.pageSize = val;
  1245. else pageInfo.value.pageNum = val;
  1246. getlist();
  1247. };
  1248. </script>
  1249. <style scoped lang="scss">
  1250. .content {
  1251. height: 100%;
  1252. width: 80vw;
  1253. .card1 {
  1254. width: 100%;
  1255. background: #F3FAFE;
  1256. .rowItem {
  1257. display: flex;
  1258. width: 15vw;
  1259. align-items: center;
  1260. justify-content: center;
  1261. margin-right: 0.5vw;
  1262. }
  1263. el-button {
  1264. margin-left: 10px;
  1265. }
  1266. .row1 {
  1267. height: 4vh;
  1268. width: 80vw;
  1269. display: flex;
  1270. min-height: 40px;
  1271. }
  1272. .row2 {
  1273. height: 4vh;
  1274. width: 80vw;
  1275. display: flex;
  1276. align-items: center;
  1277. min-height: 40px;
  1278. .left {
  1279. height: 4vh;
  1280. width: 58vw;
  1281. display: flex;
  1282. min-height: 40px;
  1283. }
  1284. }
  1285. }
  1286. .div-card2 {
  1287. width: 100%;
  1288. margin-top: 2vh;
  1289. .card2 {
  1290. background: #E7F4FD;
  1291. }
  1292. .btns {
  1293. width: 100%;
  1294. display: flex;
  1295. align-items: center;
  1296. justify-content: space-between;
  1297. padding-bottom: 10px;
  1298. .tabs {
  1299. width: 100%;
  1300. min-width: 300px;
  1301. display: flex;
  1302. align-items: center;
  1303. justify-content: space-between;
  1304. .btnItem {
  1305. margin-left: 10px;
  1306. border-radius: 5px;
  1307. }
  1308. .info-tooltip {
  1309. display: flex;
  1310. align-items: center;
  1311. }
  1312. .service-icon {
  1313. color: #666;
  1314. cursor: pointer;
  1315. font-size: 18px;
  1316. transition: all 0.3s ease;
  1317. padding: 4px;
  1318. border-radius: 50%;
  1319. }
  1320. }
  1321. }
  1322. .table {
  1323. margin: 10px;
  1324. border-radius: 20px;
  1325. .ellipsis-container {
  1326. position: relative;
  1327. width: 100%;
  1328. .ellipsis-text {
  1329. display: inline-block;
  1330. width: 100%;
  1331. white-space: nowrap;
  1332. overflow: hidden;
  1333. text-overflow: ellipsis;
  1334. cursor: pointer;
  1335. }
  1336. .custom-tooltip {
  1337. position: fixed;
  1338. z-index: 9999;
  1339. padding: 8px 12px;
  1340. width: 200px;
  1341. background-color: #E4F0FC;
  1342. color: #333333;
  1343. border: 1px solid #e5e7eb;
  1344. border-radius: 4px;
  1345. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  1346. min-height: 30px;
  1347. max-height: 300px;
  1348. overflow-y: auto;
  1349. font-size: 14px;
  1350. line-height: 1.5;
  1351. }
  1352. }
  1353. }
  1354. .pagination {
  1355. margin-top: 10px;
  1356. padding: 10px 10px;
  1357. }
  1358. }
  1359. :deep(.adddialog) {
  1360. min-width: 500px;
  1361. background-color: #F3FAFE !important;
  1362. margin-top: 8vh;
  1363. border-radius: 8px;
  1364. .addForm {
  1365. padding: 0 60px 1vh 60px;
  1366. .el-date-editor {
  1367. display: flex;
  1368. flex: 1;
  1369. }
  1370. .pic {
  1371. display: flex;
  1372. align-items: center;
  1373. .uploader {
  1374. height: 80px;
  1375. width: 80px;
  1376. .el-upload {
  1377. height: 100%;
  1378. width: 100%;
  1379. }
  1380. }
  1381. .picText {
  1382. color: #999999;
  1383. font-family: "PingFang SC";
  1384. font-size: 10px;
  1385. font-style: normal;
  1386. font-weight: 400;
  1387. line-height: 20px;
  1388. margin-left: 10px;
  1389. }
  1390. }
  1391. }
  1392. .dialog-footer {
  1393. display: flex;
  1394. justify-content: center;
  1395. padding-bottom: 1.5vh;
  1396. }
  1397. }
  1398. :deep(.editdialog) {
  1399. min-width: 990px;
  1400. background-color: #F3FAFE !important;
  1401. margin-top: 8vh;
  1402. border-radius: 8px;
  1403. .editForm {
  1404. padding: 0 60px 1vh 60px;
  1405. .el-date-editor {
  1406. display: flex;
  1407. flex: 1;
  1408. }
  1409. .pic {
  1410. display: flex;
  1411. align-items: center;
  1412. .uploader {
  1413. height: 80px;
  1414. width: 80px;
  1415. .el-upload {
  1416. height: 100%;
  1417. width: 100%;
  1418. }
  1419. }
  1420. .picText {
  1421. color: #999999;
  1422. font-family: "PingFang SC";
  1423. font-size: 10px;
  1424. font-style: normal;
  1425. font-weight: 400;
  1426. line-height: 20px;
  1427. margin-left: 10px;
  1428. }
  1429. }
  1430. }
  1431. .content {
  1432. display: flex;
  1433. height: 100%;
  1434. width: 100%;
  1435. .left {
  1436. min-width: 500px;
  1437. }
  1438. .right {
  1439. flex: 1;
  1440. .editFormRighrt {
  1441. padding: 0 60px 0 40px;
  1442. .el-date-editor {
  1443. display: flex;
  1444. flex: 1;
  1445. }
  1446. }
  1447. .editBtns {
  1448. display: flex;
  1449. justify-content: center;
  1450. margin-top: 60px;
  1451. .txt {
  1452. color: #f3fafe;
  1453. text-align: center;
  1454. font-family: "PingFang SC";
  1455. font-size: 14px;
  1456. font-style: normal;
  1457. font-weight: 700;
  1458. line-height: 22px;
  1459. }
  1460. .editBtn1 {
  1461. min-width: 80px;
  1462. padding: 5px 12px;
  1463. justify-content: center;
  1464. align-items: center;
  1465. gap: 4px;
  1466. border-radius: 4px;
  1467. background: #7E91FF;
  1468. border: none;
  1469. box-shadow: 0 0 4px 0 #00000040;
  1470. }
  1471. .editBtn2 {
  1472. display: flex;
  1473. width: 80px;
  1474. min-width: 80px;
  1475. padding: 5px 12px;
  1476. justify-content: center;
  1477. align-items: center;
  1478. gap: 4px;
  1479. border-radius: 4px;
  1480. background: #2741DE;
  1481. border: none;
  1482. box-shadow: 0 0 4px 0 #00000040;
  1483. margin-left: 60px;
  1484. }
  1485. }
  1486. }
  1487. }
  1488. }
  1489. :deep(.adddialog .el-form-item__label) {
  1490. min-width: 80px;
  1491. width: auto;
  1492. font-weight: 800;
  1493. padding-bottom: 15px;
  1494. }
  1495. .refundDialog {
  1496. .left {
  1497. width: 50%;
  1498. height: 70vh;
  1499. min-height: 700px;
  1500. padding: 0 2vw;
  1501. .add-item {
  1502. display: flex;
  1503. align-items: center;
  1504. margin-bottom: 1vh;
  1505. }
  1506. .image {
  1507. width: 4vw !important;
  1508. height: 4vw !important;
  1509. }
  1510. }
  1511. .right {
  1512. width: 50%;
  1513. height: 50vh;
  1514. .add-item {
  1515. display: flex;
  1516. align-items: center;
  1517. margin-bottom: 1vh;
  1518. }
  1519. }
  1520. }
  1521. }
  1522. // 表格样式统一
  1523. :deep(.el-table__header-wrapper),
  1524. :deep(.el-table__body-wrapper),
  1525. :deep(.el-table__cell),
  1526. :deep(.el-table__body td) {
  1527. background-color: #F3FAFE !important;
  1528. }
  1529. :deep(.el-table__header th) {
  1530. background-color: #F3FAFE !important;
  1531. }
  1532. :deep(.el-table__row:hover > .el-table__cell) {
  1533. background-color: #E5EBFE !important;
  1534. }
  1535. // 驳回理由弹窗样式
  1536. .reject-reason-box {
  1537. --el-message-box-height: 500px;
  1538. }
  1539. .reject-reason-box .el-message-box__content {
  1540. max-height: 350px;
  1541. overflow-y: auto;
  1542. white-space: pre-wrap;
  1543. }
  1544. .recallDialog {
  1545. //撤回弹窗提示
  1546. height: 392px;
  1547. width: 700px;
  1548. background-image: url('/src/assets/receive-recall.png');
  1549. position: fixed; // 固定定位,相对于浏览器窗口
  1550. top: 50%; // 距离顶部50%
  1551. left: 50%; // 距离左侧50%
  1552. transform: translate(-50%, -50%); // 向左、向上平移自身宽高的50%,实现居中
  1553. z-index: 1000; // 确保在其他元素上层显示
  1554. .close {
  1555. position: absolute;
  1556. left: 625px;
  1557. top: 20px;
  1558. height: 38px;
  1559. width: 38px;
  1560. opacity: 0;
  1561. .Btn {
  1562. height: 100%;
  1563. width: 100%;
  1564. border-radius: 10px;
  1565. }
  1566. }
  1567. .text {
  1568. position: absolute;
  1569. left: 185px;
  1570. top: 190px;
  1571. height: 67px;
  1572. width: 500px;
  1573. .txt {
  1574. height: 100%;
  1575. width: 100%;
  1576. color: #001a42;
  1577. font-family: "PingFang SC";
  1578. font-size: 48px;
  1579. font-style: normal;
  1580. font-weight: 900;
  1581. line-height: normal;
  1582. }
  1583. }
  1584. .cancle {
  1585. position: absolute;
  1586. left: 185px;
  1587. top: 304px;
  1588. height: 55px;
  1589. width: 150px;
  1590. opacity: 0;
  1591. .Btn {
  1592. height: 100%;
  1593. width: 100%;
  1594. border-radius: 20px;
  1595. }
  1596. }
  1597. .confirm {
  1598. position: absolute;
  1599. left: 375px;
  1600. top: 304px;
  1601. height: 55px;
  1602. width: 150px;
  1603. opacity: 0;
  1604. .Btn {
  1605. height: 100%;
  1606. width: 100%;
  1607. border-radius: 20px;
  1608. }
  1609. }
  1610. }
  1611. </style>