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.

1174 lines
48 KiB

  1. <template>
  2. <div class="content">
  3. <!-- 搜索区域仅保留客服相关筛选条件 -->
  4. <div class="div-card1">
  5. <el-card class="card1" style="margin-bottom: 0.5vh; min-height: 110px;">
  6. <div class="row">
  7. <div class="rowItem">
  8. <el-text style="width: 4vw;">精网号</el-text>
  9. <el-input v-model="searchData.jwcode" placeholder="请输入精网号" style="width:10vw;"
  10. clearable></el-input>
  11. </div>
  12. <div class="rowItem">
  13. <el-text style="width: 4vw;">客户姓名</el-text>
  14. <el-input v-model="searchData.name" placeholder="请输入客户姓名" style="width:10vw;"
  15. clearable></el-input>
  16. </div>
  17. <div class="rowItem">
  18. <el-text style="width: 4vw;">所属地区</el-text>
  19. <el-select v-model="searchData.market" placeholder="请选择所属地区" style="width:10vw;" clearable>
  20. <el-option v-for="item in marketList" :key="item" :label="item" :value="item" />
  21. </el-select>
  22. </div>
  23. <!-- 仅保留客服专属的订单状态筛选 -->
  24. <div class="rowItem">
  25. <el-text style="width: 4vw;">订单状态</el-text>
  26. <el-select v-model="searchData.status" placeholder="请选择订单状态" style="width: 10vw;" clearable>
  27. <el-option v-for="item in statusList" :key="item.name" :label="item.name"
  28. :value="item.value" />
  29. </el-select>
  30. </div>
  31. <div class="rowItem">
  32. <el-text style="width: 4vw;">支付方式</el-text>
  33. <el-select v-model="searchData.payType" placeholder="请选择支付方式" style="width: 10vw;" clearable>
  34. <el-option v-for="item in paytypeList" :key="item" :label="item" :value="item" />
  35. </el-select>
  36. </div>
  37. </div>
  38. <div class="row" style="margin-top: 10px;">
  39. <div class="rowItem">
  40. <el-text style="width: 4vw;">活动名称</el-text>
  41. <el-select v-model="searchData.activity" placeholder="请选择活动方式" style="width: 10vw;" 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: 30vw">
  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. <!-- 仅保留客服的查询重置按钮删除超级管理员相关按钮 -->
  59. <div class="buttons">
  60. <el-button type="primary" @click="search">查询</el-button>
  61. <el-button type="success" @click="reset">重置</el-button>
  62. </div>
  63. </div>
  64. </el-card>
  65. </div>
  66. <!-- 表格区域仅保留客服相关列和操作 -->
  67. <div class="div-card2">
  68. <el-card class="card2">
  69. <div class="btns">
  70. <!-- 删除财务专属的标签页切换 -->
  71. <div class="btnAdd">
  72. <el-button @click="openAddForm" type="success">添加收款</el-button>
  73. </div>
  74. </div>
  75. <div class="table">
  76. <el-table :data="tableData" style="width: 80vw;height:54vh;" @sort-change="handleSortChange"
  77. :row-style="{ height: '60px' }" :header-cell-style="{ textAlign: 'center' }"
  78. :cell-style="{ textAlign: 'center' }">
  79. <el-table-column type="index" label="序号" width="100px" fixed="left">
  80. <template #default="scope">
  81. <span>{{ scope.$index + 1 + (pageInfo.pageNum - 1) * pageInfo.pageSize }}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column fixed="left" prop="jwcode" label="Homily ID" width="110px" />
  85. <el-table-column fixed="left" prop="name" label="姓名" width="110px" />
  86. <el-table-column prop="marketName" label="所属地区" width="80px" />
  87. <el-table-column prop="activity" label="活动名称" width="120px" show-overflow-tooltip />
  88. <el-table-column prop="goodsName" label="产品名称" width="120px" />
  89. <el-table-column prop="goodNum" label="产品数量" width="130px">
  90. <template #default="scope">
  91. <span v-if="scope.row.goodsName == '金币充值'">{{ scope.row.permanentGold }}</span>
  92. <span v-else>{{ scope.row.goodNum }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column prop="paymentCurrency" label="付款币种" width="100px" />
  96. <el-table-column prop="paymentAmount" label="付款金额" width="120px" />
  97. <el-table-column prop="payType" label="支付方式" width="130px" />
  98. <el-table-column prop="payTime" label="付款时间" width="180px" />
  99. <el-table-column prop="voucher" label="转账凭证" width="110px">
  100. <template #default="scope">
  101. <div v-if="scope.row.voucher"
  102. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  103. @click="previewImage(scope.row.voucher)">
  104. <img :src="scope.row.voucher" alt="支付凭证" style="width: auto; height: 40px;">
  105. </div>
  106. <div v-else
  107. style="display: flex; justify-content: center; align-items: center; height: 40px;">
  108. </div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="submitterName" label="提交人" width="150px" show-overflow-tooltip />
  112. <el-table-column prop="remark" label="备注" width="150px" show-overflow-tooltip />
  113. <!-- 客服专属的订单状态列 -->
  114. <el-table-column fixed="right" prop="status" label="订单状态" width="100px">
  115. <template #default="scope">
  116. <span v-if="scope.row.status == 0">待审核</span>
  117. <span v-else-if="scope.row.status == 1 || scope.row.status == 4">已通过</span>
  118. <span v-else-if="scope.row.status == 2">已驳回</span>
  119. <span v-else-if="scope.row.status == 5">已撤回</span>
  120. <span v-else-if="scope.row.status == 6">退款</span>
  121. <span v-else></span>
  122. </template>
  123. </el-table-column>
  124. <!-- 仅保留客服专属操作删除财务审核编辑手续费操作 -->
  125. <el-table-column fixed="right" label="操作" width="120px">
  126. <template #default=scope>
  127. <el-link v-if="scope.row.status == 4" style="color: #FA5A1E;"
  128. @click="openConfirm('refund', scope.row)">退款</el-link>
  129. <el-link v-else-if="scope.row.status == 1" style="color: #2741DE;">待填写手续费</el-link>
  130. <el-link v-else-if="scope.row.status == 5" style="color: #2741DE;"
  131. @click="openAddForm(scope.row)">编辑</el-link>
  132. <el-link v-else-if="scope.row.status == 0" style="color: #FA5A1E;"
  133. @click="openConfirm('recall', scope.row)">撤回</el-link>
  134. <el-link v-else-if="scope.row.status == 2" style="color: #FA5A1E;"
  135. @click="openRejectReason(scope.row.rejectReason)">查看驳回理由</el-link>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. <!-- 分页组件保留公共逻辑 -->
  141. <div class="pagination">
  142. <el-pagination background :page-size="pageInfo.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
  143. layout="total, sizes, prev, pager, next, jumper" :total="total"
  144. @size-change="handlePagination('size', $event)"
  145. @current-change="handlePagination('page', $event)"></el-pagination>
  146. </div>
  147. </el-card>
  148. </div>
  149. <!-- 仅保留客服专属弹窗撤回确认退款确认新增/编辑收款退款弹窗 -->
  150. <!-- 撤回确认弹窗 -->
  151. <div class="recallDialog" v-show="recallDialog">
  152. <div class="close">
  153. <button @click="closeRecall" class="Btn">关闭</button>
  154. </div>
  155. <div class="text">
  156. <text class="txt">{{ textContent }}</text>
  157. </div>
  158. <div class="cancle">
  159. <button @click="closeRecall" class="Btn">取消</button>
  160. </div>
  161. <div class="confirm">
  162. <button @click="handleRecall" class="Btn">确定</button>
  163. </div>
  164. </div>
  165. <!-- 退款确认弹窗 -->
  166. <div class="recallDialog" v-show="refundConfirmDialog">
  167. <div class="close">
  168. <button @click="closeConfirmRefund" class="Btn">关闭</button>
  169. </div>
  170. <div class="text">
  171. <text class="txt">{{ textContent }}</text>
  172. </div>
  173. <div class="cancle">
  174. <button @click="closeConfirmRefund" class="Btn">取消</button>
  175. </div>
  176. <div class="confirm">
  177. <button @click="openRefundDialog" class="Btn">确定</button>
  178. </div>
  179. </div>
  180. <!-- 客服新增/编辑收款弹窗 -->
  181. <el-dialog class="adddialog" v-model="addFormisible" width="20vw" :before-close="closeAddForm">
  182. <el-form class="addForm" ref="addFormRef" :rules="addFormRule" :model="addFormData" label-width="4vw"
  183. label-position="left">
  184. <el-form-item label="精网号" required prop="jwcode">
  185. <el-input v-model="addFormData.jwcode" placeholder="请输入精网号" @blur="jwcodeSeachMarket" />
  186. </el-form-item>
  187. <el-form-item label="客户姓名" required prop="name">
  188. <el-input disabled v-model="addFormData.name" placeholder="请输入客户姓名" />
  189. </el-form-item>
  190. <el-form-item label="所属地区" required prop="market">
  191. <el-input disabled v-model="addFormData.marketName" placeholder="请输入所属地区" />
  192. </el-form-item>
  193. <el-form-item label="活动名称" required prop="activity">
  194. <el-input v-model="addFormData.activity" placeholder="请输入活动名称" />
  195. </el-form-item>
  196. <el-form-item label="产品名称" required @change="ifGold" prop="goodsName">
  197. <ProductSelect ref="productSelectRef" v-model="addFormData.goodsName"></ProductSelect>
  198. </el-form-item>
  199. <el-form-item v-show="!isGold" label="产品数量" required prop="goodNum">
  200. <div style="padding-right: 50px; display: flex;">
  201. <el-input style="padding-right: 10px;" v-model="addFormData.goodNum" placeholder="请输入产品数量" />
  202. <span style="color: #999999;">{{ productUnit }}</span>
  203. </div>
  204. </el-form-item>
  205. <div v-show="isGold" style="margin-bottom: 15px; display: flex;">
  206. <div style=" display: flex; ">
  207. <span
  208. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">永久金币</span>
  209. <el-input style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  210. v-model="addFormData.permanentGold" />
  211. </div>
  212. <div style="padding-right: 5px; display: flex;">
  213. <span
  214. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">免费金币</span>
  215. <el-input style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  216. v-model="addFormData.freeGold" />
  217. </div>
  218. </div>
  219. <el-form-item label="付款币种" required prop="paymentCurrency">
  220. <CurrencySelect v-model="addFormData.paymentCurrency" :items="customOptions" placeholder="请选择付款币种"
  221. @change="handleCurrencyChange" />
  222. </el-form-item>
  223. <el-form-item label="付款金额" required prop="paymentAmount">
  224. <el-input v-model="addFormData.paymentAmount" placeholder="请输入付款金额" />
  225. </el-form-item>
  226. <el-form-item label="支付方式" required prop="payType">
  227. <CurrencySelect v-model="addFormData.payType" :items="paytypeOptions" placeholder="请选择支付方式"
  228. @change="ifGroup">
  229. </CurrencySelect>
  230. </el-form-item>
  231. <el-form-item label="到账地区" required prop="receivedMarket">
  232. <CurrencySelect v-model="addFormData.receivedMarket" :items="MoneyAddressOptions"
  233. :disabled="isGroup" placeholder="请选择到账地区">
  234. </CurrencySelect>
  235. </el-form-item>
  236. <el-form-item label="付款时间" required prop="payTime">
  237. <el-date-picker type="datetime" placement="right" v-model="addFormData.payTime"
  238. placeholder="请选择付款时间" />
  239. </el-form-item>
  240. <el-form-item label="转账凭证" required prop="voucher">
  241. <div class="pic">
  242. <el-upload ref="uploadRef" class="uploader" :show-file-list="false" list-type="picture-card"
  243. :auto-upload="false" :before-upload="beforeUpload" :on-error="handelImgErr"
  244. :on-change="handleImageChange" :http-request="customUpload">
  245. <img v-if="addFormData.voucher" :src="addFormData.voucher" class="avatar"
  246. style="height: 100%; width: 100%; object-fit: cover;" />
  247. <el-icon v-else class="avatar-uploader-icon">
  248. <Plus />
  249. </el-icon>
  250. </el-upload>
  251. </div>
  252. </el-form-item>
  253. <el-form-item label="备注" required prop="remark">
  254. <el-input v-model="addFormData.remark" type="textarea" :rows="4" placeholder="请输入备注" maxlength="100"
  255. show-word-limit />
  256. </el-form-item>
  257. </el-form>
  258. <template #footer>
  259. <span class="dialog-footer">
  260. <el-button style="background-color: #7E91FF;" @click="closeAddForm">取消</el-button>
  261. <el-button v-if="addOrEdit == 1" style="background-color: #2741DE; margin-left: 2.5vw;"
  262. type="primary" @click="throttledhandleAddForm">确定</el-button>
  263. <el-button v-else-if="addOrEdit == 2" style="background-color: #2741DE; margin-left: 2.5vw;"
  264. type="primary" @click="throttledhandleEditForm">编辑</el-button>
  265. </span>
  266. </template>
  267. </el-dialog>
  268. <!-- 客服新增退款弹窗 -->
  269. <el-dialog v-model="refundDialog" title="退款" class="refundDialog" overflow draggable style="width: 40vw;"
  270. :before-close="closeRefundForm">
  271. <div style="display: flex;">
  272. <div class="left">
  273. <div class="add-item">
  274. <el-text style="width:4vw;">精网号</el-text>
  275. <el-input v-model="refundFormData.jwcode" style="width:10vw;" disabled />
  276. </div>
  277. <div class="add-item">
  278. <el-text style="width:4vw;">客户姓名</el-text>
  279. <el-input v-model="refundFormData.name" style="width:10vw;" disabled />
  280. </div>
  281. <div class="add-item">
  282. <el-text style="width:4vw;">所属地区</el-text>
  283. <el-input v-model="refundFormData.marketName" style="width:10vw;" disabled />
  284. </div>
  285. <div class="add-item">
  286. <el-text style="width:4vw;">活动名称</el-text>
  287. <el-input v-model="refundFormData.activity" style="width:10vw;" disabled />
  288. </div>
  289. <div class="add-item">
  290. <el-text style="width:4vw;">产品名称</el-text>
  291. <el-input v-model="refundFormData.goodsName" style="width:10vw;" disabled />
  292. </div>
  293. <div v-show="!isRefundGold" class="add-item">
  294. <el-text style="width:4vw;">产品数量</el-text>
  295. <el-input style="padding-right: 10px; width:10.5vw;" v-model="refundFormData.goodNum"
  296. placeholder="请输入产品数量" disabled />
  297. <span style="color: #999999;">{{ productUnit }}</span>
  298. </div>
  299. <div v-show="isRefundGold" style="margin-bottom: 15px; ">
  300. <div style=" display: flex; ">
  301. <span
  302. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">永久金币</span>
  303. <el-input style="padding-right: 10px; height: 30px; width: 110px; margin-bottom: 10px"
  304. v-model="refundFormData.permanentGold" disabled />
  305. </div>
  306. <div style="padding-right: 5px; display: flex;">
  307. <span
  308. style="color: #999999; display: flex; white-space: nowrap;align-items: center;">免费金币</span>
  309. <el-input style="padding-right: 10px; height: 30px; width: 110px;"
  310. v-model="refundFormData.freeGold" disabled />
  311. </div>
  312. </div>
  313. <div class="add-item">
  314. <el-text style="width:4vw;">付款币种</el-text>
  315. <el-input v-model="refundFormData.paymentCurrency" style="width:10vw;" disabled />
  316. </div>
  317. <div class="add-item">
  318. <el-text style="width:4vw;">付款金额</el-text>
  319. <el-input v-model="refundFormData.paymentAmount" style="width:10vw;" disabled />
  320. </div>
  321. <div class="add-item">
  322. <el-text style="width:4vw;">支付方式</el-text>
  323. <el-input v-model="refundFormData.payType" style="width:10vw;" disabled />
  324. </div>
  325. <div class="add-item">
  326. <el-text style="width:4vw;">付款时间</el-text>
  327. <el-date-picker v-model="refundFormData.payTime" type="datetime" style="width:10vw;" disabled />
  328. </div>
  329. <div class="add-item">
  330. <el-text style="width:4vw;" size="small">转账凭证</el-text>
  331. <el-form-item :rules="{ required: true, message: '请上传图片', trigger: 'change' }">
  332. <el-upload ref="uploadRef" :auto-upload="false" list-type="picture-card"
  333. :show-file-list="false">
  334. <template #default>
  335. <img v-if="refundFormData.voucher" :src="refundFormData.voucher"
  336. style="width: 100%; height: 100%; object-fit: cover;">
  337. <el-icon v-else>
  338. <Plus />
  339. </el-icon>
  340. </template>
  341. </el-upload>
  342. </el-form-item>
  343. </div>
  344. <div class="add-item">
  345. <el-text style="width:4vw;">备注</el-text>
  346. <el-input v-model="refundFormData.remark" style="width:10vw;" :rows="2" type="textarea"
  347. maxLength="100" disabled show-word-limit />
  348. </div>
  349. </div>
  350. <div class="right">
  351. <div class="add-item">
  352. <el-text style="width:4vw;">退款模式</el-text>
  353. <el-radio-group v-model="refundFormData.refundModel">
  354. <el-radio value="0">全部退款</el-radio>
  355. <el-radio value="1">部分退款</el-radio>
  356. </el-radio-group>
  357. </div>
  358. <div class="add-item">
  359. <el-text style="width:4vw;">退款理由</el-text>
  360. <el-input v-model="refundFormData.refundReason" style="width:10vw;" :rows="5" maxlength="150"
  361. show-word-limit type="textarea" />
  362. </div>
  363. <div>ps:请在退款理由表明用户的退款需求</div>
  364. <div style="display:flex;justify-content: center;margin-top: 5vh;">
  365. <el-button type="default" @click="">重置</el-button>
  366. <el-button type="primary" @click="throttledsubmitRefund">提交</el-button>
  367. </div>
  368. </div>
  369. </div>
  370. </el-dialog>
  371. </div>
  372. </template>
  373. <script setup>
  374. import { ref, watch, onMounted } from 'vue';
  375. import { storeToRefs } from 'pinia';
  376. import { ElMessage, ElMessageBox } from 'element-plus'
  377. import API from '@/util/http.js'
  378. import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue'
  379. import ProductSelect from '@/components/MoneyManage/ProductSelect.vue'
  380. import { Plus } from '@element-plus/icons-vue'; // 补充图标导入(原代码遗漏)
  381. import request from '@/util/http.js'
  382. import moment from 'moment'
  383. import { useAdminStore } from '@/store/index.js'
  384. import { hasMenuPermission } from '@/utils/menuTreePermission.js'
  385. import _ from 'lodash'
  386. // 导入客服相关规则和静态数据
  387. import { addFormRule } from './utils/recriveFormRules.js'
  388. import { productList, MarketNameForId, CurrencyForId, marketList, statusList } from './utils/staticData.js'
  389. // ===================== 基础状态管理(仅保留客服相关) =====================
  390. const adminStore = useAdminStore();
  391. const { menuTree } = storeToRefs(adminStore);
  392. const adminData = ref({}) // 管理员信息
  393. const tableData = ref([]) // 表格数据
  394. const total = ref(0) // 总条数
  395. const pageInfo = ref({ pageSize: 10, pageNum: 1 }) // 分页信息
  396. // 角色标识:固定为客服(删除财务、总部财务、超级管理员标识)
  397. const kefu = ref(true)
  398. const caiwu = ref(false)
  399. const HQcaiwu = ref(false)
  400. const superAdmin = ref(false)
  401. // ===================== 查询相关 =====================
  402. const searchData = ref({}) // 搜索参数
  403. const getTime = ref([]) // 时间范围
  404. const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] // 默认时间
  405. // 查询按钮
  406. const search = () => {
  407. getlist()
  408. ElMessage.success('查询成功')
  409. }
  410. // 重置按钮
  411. const reset = () => {
  412. searchData.value = {}
  413. getTime.value = []
  414. getlist()
  415. }
  416. // 时间选择器变更(原代码声明未实现,保留空函数避免报错)
  417. const handleDatePickerChange = () => { }
  418. // 日期禁用(原代码声明未实现,保留空函数避免报错)
  419. const disabledDate = () => { }
  420. // 表格排序(原代码声明未实现,保留空函数避免报错)
  421. const handleSortChange = () => { }
  422. // 获取表格数据(仅保留客服角色逻辑)
  423. const getlist = async () => {
  424. try {
  425. let payCurrencySelect = ''
  426. let goodsName = ''
  427. // 处理时间范围
  428. if (getTime.value && getTime.value.length === 2) {
  429. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss')
  430. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss')
  431. } else {
  432. searchData.value.startTime = ''
  433. searchData.value.endTime = ''
  434. }
  435. // 处理产品名称(级联选择器取最后一级)
  436. if (searchData.value.goodsName) {
  437. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1]
  438. }
  439. // 处理付款币种
  440. if (searchData.value.paymentCurrency) {
  441. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency)
  442. }
  443. // 客服角色固定参数:cashRoleId=0,无到账地区筛选
  444. const cashRoleId = '0'
  445. const receivedMarket = ''
  446. const result = await request({
  447. url: '/cashCollection/selectCollection',
  448. data: {
  449. ...pageInfo.value,
  450. cashCollection: {
  451. ...searchData.value,
  452. ...getTime.value,
  453. submitterId: adminData.value.id,
  454. receivedMarket: MarketNameForId(receivedMarket),
  455. cashRoleId: cashRoleId,
  456. paymentCurrency: payCurrencySelect,
  457. submitterMarket: adminData.value.markets,
  458. goodsName: goodsName,
  459. market: MarketNameForId(searchData.value.market)
  460. }
  461. }
  462. })
  463. if (result.code == 200) {
  464. tableData.value = result.data.list
  465. total.value = result.data.total
  466. } else {
  467. ElMessage.error('数据异常')
  468. console.log(result.msg);
  469. }
  470. } catch (error) {
  471. console.log(error);
  472. }
  473. }
  474. // ===================== 分页相关 =====================
  475. const handlePagination = (type, val) => {
  476. if (type === 'size') {
  477. pageInfo.value.pageSize = val
  478. } else {
  479. pageInfo.value.pageNum = val
  480. }
  481. getlist()
  482. }
  483. // ===================== 客服新增/编辑收款弹窗 =====================
  484. const addFormisible = ref(false) // 弹窗显隐
  485. const addFormData = ref({ name: '', market: '', permanentGold: 0, freeGold: 0, goodsName: '' }) // 表单数据
  486. const addFormRef = ref(null) // 表单引用
  487. const addOrEdit = ref(0) // 1=新增,2=编辑
  488. const isGold = ref(false) // 是否为金币充值产品
  489. const productUnit = ref('个') // 产品单位
  490. const productSelectRef = ref(null) // 产品选择器引用
  491. const uploadRef = ref(null) // 上传组件引用
  492. // 产品选择变更:判断是否为金币充值
  493. const ifGold = () => {
  494. if (addFormData.value.goodsName === '金币充值') {
  495. isGold.value = true
  496. addFormData.value.goodNum = 0
  497. } else {
  498. isGold.value = false
  499. // 特殊产品单位为“年”
  500. const selectItems = ["AI机构追踪", "AI机构出击", "AI机构资金", "AI机活跃度", "超级机构透视", "超级机构伏击", "超级机构猎杀", "超级机构脉搏", "超级机构罗盘", "静态信息费", "博股会员"]
  501. productUnit.value = selectItems.includes(addFormData.value.goodsName) ? '年' : '个'
  502. }
  503. }
  504. // 支付方式变更:判断是否为默认归属平台
  505. const isGroup = ref(false)
  506. const ifGroup = () => {
  507. if (addFormData.value.payType === 'Stripe-链接收款' || addFormData.value.payType === 'PaymentAsia-链接收款') {
  508. isGroup.value = true
  509. addFormData.value.receivedMarket = '香港'
  510. } else if (addFormData.value.payType === 'Ipay88-链接收款') {
  511. isGroup.value = true
  512. addFormData.value.receivedMarket = '马来西亚'
  513. } else {
  514. isGroup.value = false
  515. }
  516. }
  517. // 精网号失焦:查询客户姓名和地区
  518. const jwcodeSeachMarket = async () => {
  519. try {
  520. const result = await request({
  521. url: '/cashCollection/getNameAndMarket',
  522. data: addFormData.value.jwcode
  523. })
  524. addFormData.value.market = result.data.market
  525. addFormData.value.marketName = result.data.marketName
  526. addFormData.value.name = result.data.name
  527. } catch (error) {
  528. console.log(error);
  529. }
  530. }
  531. // 打开新增/编辑弹窗
  532. const openAddForm = (row) => {
  533. productSelectRef.value?.resetSelect();
  534. if (row?.jwcode) {
  535. // 编辑模式
  536. addOrEdit.value = 2
  537. addFormData.value = { ...row }
  538. jwcodeSeachMarket()
  539. ifGold()
  540. } else {
  541. // 新增模式
  542. addOrEdit.value = 1
  543. addFormData.value = { goodsName: '' }
  544. }
  545. addFormisible.value = true
  546. }
  547. // 关闭新增/编辑弹窗
  548. const closeAddForm = () => {
  549. addFormisible.value = false
  550. addFormData.value = {}
  551. addOrEdit.value = 0
  552. isGold.value = false
  553. addFormRef.value?.resetFields();
  554. }
  555. // 客服新增收款
  556. const handleAddForm = async () => {
  557. try {
  558. await addFormRef.value.validate();
  559. // 处理时间格式
  560. if (addFormData.value.payTime) {
  561. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  562. }
  563. const result = await request({
  564. url: '/cashCollection/add',
  565. data: {
  566. ...addFormData.value,
  567. submitterId: adminData.value.id,
  568. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  569. freeGold: (addFormData.value.freeGold || 0) * 100,
  570. goodNum: addFormData.value.goodNum || 0,
  571. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  572. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  573. paymentAmount: (addFormData.value.paymentAmount) * 100,
  574. submitterMarket: adminData.value.markets
  575. }
  576. })
  577. if (result.code == 200) {
  578. ElMessage.success('添加成功')
  579. getlist()
  580. closeAddForm()
  581. }
  582. } catch (error) {
  583. console.log('新增报错:', error);
  584. ElMessage.error('请完善表单信息后提交');
  585. }
  586. }
  587. // 客服编辑收款(撤回后重新提交)
  588. const handleEditForm = async () => {
  589. try {
  590. // 处理时间格式
  591. if (addFormData.value.payTime) {
  592. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  593. }
  594. const result = await request({
  595. url: '/cashCollection/reSubmit',
  596. data: {
  597. ...addFormData.value,
  598. submitterId: adminData.value.id,
  599. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  600. freeGold: (addFormData.value.freeGold || 0) * 100,
  601. goodNum: addFormData.value.goodNum || 0,
  602. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  603. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  604. paymentAmount: (addFormData.value.paymentAmount) * 100
  605. }
  606. })
  607. if (result.code == 200) {
  608. ElMessage.success('编辑成功')
  609. getlist()
  610. closeAddForm()
  611. }
  612. } catch (error) {
  613. console.log(error);
  614. }
  615. }
  616. // 付款币种和支付方式选项(客服专用)
  617. const customOptions = ref(['美元(USD)', '港币(HKD)', '新币(SGD)', '马币(MYR)', '泰铢(THB)', '加币(CAD)', '越南盾(VDN)', '韩元(KRW)'])
  618. const paytypeOptions = ref(["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"])
  619. const MoneyAddressOptions = ref(['马来西亚', '香港', '新加坡', '泰国', '越南HCM', '加拿大'])
  620. const handleCurrencyChange = (option) => {
  621. console.log('选中的币种:', option);
  622. };
  623. // 图片上传相关
  624. const handleImgSuccess = (response) => {
  625. try {
  626. addFormData.value.voucher = response.data.url
  627. } catch (error) {
  628. ElMessage.error(response.msg || '图片上传失败')
  629. }
  630. }
  631. const handelImgErr = (err) => {
  632. console.log(err);
  633. addFormData.value.imageUrl = null
  634. ElMessage.error("图片上传失败")
  635. }
  636. const beforeUpload = (rawFile) => {
  637. if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/png') {
  638. ElMessage.error('图片必须是jpg或png类型!')
  639. return false
  640. } else if (rawFile.size / 1024 / 1024 > 2) {
  641. ElMessage.error('图片大小不能超过 2MB!')
  642. return false
  643. }
  644. return true
  645. }
  646. const handleImageChange = (file) => {
  647. uploadRef.value.submit()
  648. }
  649. const customUpload = async (options) => {
  650. try {
  651. const formData = new FormData()
  652. formData.append('file', options.file)
  653. const response = await API({
  654. url: 'https://api.homilychart.com/hljw/api/aws/upload',
  655. method: 'POST',
  656. data: formData,
  657. headers: { 'Content-Type': 'multipart/form-data' }
  658. })
  659. if (response.code === 200 && response.data) {
  660. handleImgSuccess(response, options.file)
  661. ElMessage.success('上传成功')
  662. } else {
  663. options.onError(response)
  664. ElMessage.error(response.msg || '上传失败')
  665. }
  666. } catch (error) {
  667. console.error('上传错误:', error)
  668. ElMessage.error(`上传失败: ${error.msg || error.message || '网络异常'}`)
  669. }
  670. }
  671. // 图片预览
  672. const previewImage = (imageUrl) => {
  673. const imageElement = document.createElement('img');
  674. imageElement.src = imageUrl;
  675. imageElement.style.maxWidth = '80vw';
  676. imageElement.style.maxHeight = '80vh';
  677. const viewer = document.createElement('div');
  678. viewer.style.position = 'fixed';
  679. viewer.style.top = '0';
  680. viewer.style.left = '0';
  681. viewer.style.width = '100vw';
  682. viewer.style.height = '100vh';
  683. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  684. viewer.style.display = 'flex';
  685. viewer.style.justifyContent = 'center';
  686. viewer.style.alignItems = 'center';
  687. viewer.style.zIndex = '9999';
  688. viewer.style.overflow = 'auto';
  689. viewer.appendChild(imageElement);
  690. document.body.appendChild(viewer);
  691. viewer.addEventListener('click', () => {
  692. document.body.removeChild(viewer);
  693. });
  694. };
  695. // ===================== 客服退款/撤回相关 =====================
  696. // 撤回弹窗
  697. const textContent = ref('')
  698. const recallDialog = ref(false)
  699. const RecallNum = ref('')
  700. // 退款确认弹窗
  701. const refundConfirmDialog = ref(false)
  702. const refundDialog = ref(false) // 退款详情弹窗
  703. const refundFormData = ref({}) // 退款表单数据
  704. const isRefundGold = ref(false) // 退款产品是否为金币
  705. // 判断退款产品类型
  706. const ifRefundGold = () => {
  707. if (refundFormData.value.goodsName === '金币充值') {
  708. isRefundGold.value = true
  709. refundFormData.value.goodNum = 0
  710. } else {
  711. isRefundGold.value = false
  712. const selectItems = ["AI机构追踪", "AI机构出击", "AI机构资金", "AI机活跃度", "超级机构透视", "超级机构伏击", "超级机构猎杀", "超级机构脉搏", "超级机构罗盘", "静态信息费", "博股会员"]
  713. productUnit.value = selectItems.includes(refundFormData.value.goodsName) ? '年' : '个'
  714. }
  715. }
  716. // 打开撤回/退款确认弹窗
  717. const openConfirm = (val, row) => {
  718. if (val === 'refund') {
  719. textContent.value = '将要对该订单退款!'
  720. refundFormData.value = { ...row }
  721. ifRefundGold()
  722. refundConfirmDialog.value = true
  723. } else if (val === 'recall') {
  724. textContent.value = '将要撤回该信息!'
  725. recallDialog.value = true
  726. RecallNum.value = row.orderCode
  727. }
  728. }
  729. // 关闭撤回弹窗
  730. const closeRecall = () => {
  731. recallDialog.value = false
  732. textContent.value = ''
  733. RecallNum.value = ''
  734. }
  735. // 执行撤回
  736. const handleRecall = async () => {
  737. try {
  738. const result = await request({
  739. url: '/cashCollection/cancel',
  740. data: { orderCode: RecallNum.value }
  741. })
  742. if (result.code == 200) {
  743. ElMessage.success('撤回成功')
  744. getlist()
  745. closeRecall()
  746. }
  747. } catch (error) {
  748. console.log(error);
  749. }
  750. }
  751. // 关闭退款确认弹窗
  752. const closeConfirmRefund = () => {
  753. refundConfirmDialog.value = false
  754. textContent.value = ''
  755. }
  756. // 打开退款详情弹窗
  757. const openRefundDialog = () => {
  758. refundDialog.value = true
  759. closeConfirmRefund()
  760. }
  761. // 关闭退款详情弹窗
  762. const closeRefundForm = () => {
  763. refundDialog.value = false
  764. refundFormData.value = {}
  765. }
  766. // 提交退款
  767. const submitRefund = async () => {
  768. try {
  769. const result = await request({
  770. url: '/Money/add',
  771. data: {
  772. jwcode: refundFormData.value.jwcode,
  773. name: refundFormData.value.name,
  774. market: refundFormData.value.marketName,
  775. activity: refundFormData.value.activity,
  776. bankCode: refundFormData.value.bankCode,
  777. goodsName: refundFormData.value.goodsName,
  778. goodNum: refundFormData.value.goodNum,
  779. paymentCurrency: refundFormData.value.paymentCurrency,
  780. paymentAmount: (refundFormData.value.paymentAmount) * 100,
  781. receivedCurrency: refundFormData.value.receivedCurrency,
  782. receivedAmount: (refundFormData.value.receivedAmount) * 100,
  783. handlingCharge: (refundFormData.value.handlingCharge) * 100,
  784. receivedMarket: refundFormData.value.receivedMarket,
  785. payType: refundFormData.value.payType,
  786. payTime: refundFormData.value.payTime,
  787. receivedTime: refundFormData.value.receivedTime,
  788. areaServise: adminData.value.adminName,
  789. submitterId: adminData.value.id,
  790. voucher: refundFormData.value.voucher,
  791. remark: refundFormData.value.remark,
  792. refundReason: refundFormData.value.refundReason,
  793. refundModel: refundFormData.value.refundModel,
  794. id: refundFormData.value.id,
  795. orderCode: refundFormData.value.orderCode,
  796. permanentGold: (refundFormData.value.permanentGold) * 100 || 0,
  797. freeGold: (refundFormData.value.freeGold) * 100 || 0
  798. }
  799. })
  800. if (result.code == 200) {
  801. ElMessage.success('新增退款成功')
  802. getlist()
  803. closeRefundForm()
  804. } else {
  805. ElMessage.error(result.msg)
  806. }
  807. } catch (error) {
  808. console.log(error);
  809. }
  810. }
  811. // 查看驳回理由
  812. const openRejectReason = (reason) => {
  813. ElMessageBox.alert(reason, '驳回理由', {
  814. confirmButtonText: '确认',
  815. customClass: 'reject-reason-box',
  816. })
  817. }
  818. // ===================== 初始化与节流 =====================
  819. // 节流处理(防止重复提交)
  820. const throttledhandleAddForm = _.throttle(handleAddForm, 5000, { trailing: false })
  821. const throttledhandleEditForm = _.throttle(handleEditForm, 5000, { trailing: false })
  822. const throttledsubmitRefund = _.throttle(submitRefund, 5000, { trailing: false })
  823. // 活动列表(客服需要)
  824. const activityList = ref([])
  825. const getActivitys = async () => {
  826. try {
  827. const result = await API({ url: '/cashCollection/getActivityList', data: {} })
  828. if (result.code == 200) {
  829. activityList.value = result.data
  830. } else {
  831. ElMessage.error('活动列表获取失败')
  832. }
  833. } catch (error) {
  834. console.log('活动列表请求失败', error)
  835. }
  836. }
  837. // 获取管理员信息
  838. const getAdminData = async () => {
  839. try {
  840. const result = await API({ url: '/admin/userinfo', data: {} })
  841. adminData.value = result
  842. } catch (error) {
  843. console.log('管理员信息请求失败', error)
  844. }
  845. }
  846. // 支付方式列表(表格筛选用)
  847. const paytypeList = ["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"]
  848. // 初始化
  849. onMounted(async () => {
  850. await getAdminData()
  851. await getActivitys()
  852. // 客服角色默认加载列表
  853. getlist()
  854. })
  855. </script>
  856. <style scoped lang="scss">
  857. .content {
  858. height: 100%;
  859. width: 80vw;
  860. .card1 {
  861. width: 100%;
  862. background: #F3FAFE;
  863. .row {
  864. height: 4vh;
  865. width: 80vw;
  866. display: flex;
  867. min-height: 40px;
  868. .rowItem {
  869. display: flex;
  870. width: 15vw;
  871. align-items: center;
  872. justify-content: center;
  873. margin-right: 0.5vw;
  874. }
  875. .buttons {
  876. display: flex;
  877. justify-content: center;
  878. align-items: center;
  879. margin-left: 10px;
  880. }
  881. }
  882. }
  883. .div-card2 {
  884. width: 100%;
  885. margin-top: 2vh;
  886. .btns {
  887. display: flex;
  888. align-items: center;
  889. justify-content: space-between;
  890. padding-bottom: 10px;
  891. .btnAdd {
  892. padding-left: 10px;
  893. }
  894. }
  895. .table {
  896. margin: 10px;
  897. border-radius: 20px;
  898. .ellipsis-container {
  899. position: relative;
  900. width: 100%;
  901. .ellipsis-text {
  902. display: inline-block;
  903. width: 100%;
  904. white-space: nowrap;
  905. overflow: hidden;
  906. text-overflow: ellipsis;
  907. cursor: pointer;
  908. }
  909. .custom-tooltip {
  910. position: fixed;
  911. z-index: 9999;
  912. padding: 8px 12px;
  913. width: 200px;
  914. background-color: #E4F0FC;
  915. color: #333333;
  916. border: 1px solid #e5e7eb;
  917. border-radius: 4px;
  918. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  919. min-height: 30px;
  920. max-height: 300px;
  921. overflow-y: auto;
  922. font-size: 14px;
  923. line-height: 1.5;
  924. }
  925. }
  926. }
  927. .pagination {
  928. margin-top: 10px;
  929. padding: 10px 10px;
  930. }
  931. }
  932. .recallDialog {
  933. height: 392px;
  934. width: 700px;
  935. background-image: url('/src/assets/收款明细撤回背景.png');
  936. position: fixed;
  937. top: 50%;
  938. left: 50%;
  939. transform: translate(-50%, -50%);
  940. z-index: 1000;
  941. .close,
  942. .cancle,
  943. .confirm {
  944. opacity: 0;
  945. .Btn {
  946. height: 100%;
  947. width: 100%;
  948. border-radius: 10px;
  949. }
  950. }
  951. .close {
  952. position: absolute;
  953. left: 625px;
  954. top: 20px;
  955. height: 38px;
  956. width: 38px;
  957. }
  958. .text {
  959. position: absolute;
  960. left: 185px;
  961. top: 190px;
  962. height: 67px;
  963. width: 500px;
  964. .txt {
  965. height: 100%;
  966. width: 100%;
  967. color: #001a42;
  968. font-family: "PingFang SC";
  969. font-size: 48px;
  970. font-style: normal;
  971. font-weight: 900;
  972. line-height: normal;
  973. }
  974. }
  975. .cancle {
  976. position: absolute;
  977. left: 185px;
  978. top: 304px;
  979. height: 55px;
  980. width: 150px;
  981. }
  982. .confirm {
  983. position: absolute;
  984. left: 375px;
  985. top: 304px;
  986. height: 55px;
  987. width: 150px;
  988. }
  989. }
  990. :deep(.adddialog) {
  991. min-width: 500px;
  992. background-color: #F3FAFE !important;
  993. margin-top: 8vh;
  994. border-radius: 8px;
  995. .addForm {
  996. padding: 0 60px 1vh 60px;
  997. .el-date-editor {
  998. display: flex;
  999. flex: 1;
  1000. }
  1001. .pic {
  1002. display: flex;
  1003. align-items: center;
  1004. .uploader {
  1005. height: 80px;
  1006. width: 80px;
  1007. .el-upload {
  1008. height: 100%;
  1009. width: 100%;
  1010. }
  1011. }
  1012. .picText {
  1013. color: #999999;
  1014. font-family: "PingFang SC";
  1015. font-size: 10px;
  1016. font-style: normal;
  1017. font-weight: 400;
  1018. line-height: 20px;
  1019. margin-left: 10px;
  1020. }
  1021. }
  1022. }
  1023. .dialog-footer {
  1024. display: flex;
  1025. justify-content: center;
  1026. padding-bottom: 1.5vh;
  1027. }
  1028. }
  1029. .refundDialog {
  1030. .left {
  1031. width: 50%;
  1032. height: 70vh;
  1033. min-height: 700px;
  1034. padding: 0 2vw;
  1035. .add-item {
  1036. display: flex;
  1037. align-items: center;
  1038. margin-bottom: 1vh;
  1039. }
  1040. .image {
  1041. width: 4vw !important;
  1042. height: 4vw !important;
  1043. }
  1044. }
  1045. .right {
  1046. width: 50%;
  1047. height: 50vh;
  1048. .add-item {
  1049. display: flex;
  1050. align-items: center;
  1051. margin-bottom: 1vh;
  1052. }
  1053. }
  1054. }
  1055. :deep(.adddialog .el-form-item__label) {
  1056. min-width: 80px;
  1057. width: auto;
  1058. font-weight: 800;
  1059. padding-bottom: 15px;
  1060. }
  1061. }
  1062. // 表单卡片样式
  1063. .card2 {
  1064. background: #E7F4FD;
  1065. }
  1066. // 表格样式
  1067. :deep(.el-table__header-wrapper),
  1068. :deep(.el-table__body-wrapper),
  1069. :deep(.el-table__cell),
  1070. :deep(.el-table__body td) {
  1071. background-color: #F3FAFE !important;
  1072. }
  1073. :deep(.el-table__header th) {
  1074. background-color: #F3FAFE !important;
  1075. }
  1076. :deep(.el-table__row:hover > .el-table__cell) {
  1077. background-color: #E5EBFE !important;
  1078. }
  1079. // 驳回理由弹窗样式
  1080. .reject-reason-box {
  1081. --el-message-box-height: 500px;
  1082. }
  1083. .reject-reason-box .el-message-box__content {
  1084. max-height: 350px;
  1085. overflow-y: auto;
  1086. white-space: pre-wrap;
  1087. }
  1088. </style>