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.

1176 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. <div class="rowItem">
  24. <el-text style="width: 4vw;">订单状态</el-text>
  25. <el-select v-model="searchData.status" placeholder="请选择订单状态" style="width: 10vw;" clearable>
  26. <el-option v-for="item in statusList" :key="item.name" :label="item.name"
  27. :value="item.value" />
  28. </el-select>
  29. </div>
  30. <div class="rowItem">
  31. <el-text style="width: 4vw;">支付方式</el-text>
  32. <el-select v-model="searchData.payType" placeholder="请选择支付方式" style="width: 10vw;" clearable>
  33. <el-option v-for="item in paytypeList" :key="item" :label="item" :value="item" />
  34. </el-select>
  35. </div>
  36. </div>
  37. <div class="row" style="margin-top: 10px;">
  38. <div class="rowItem">
  39. <el-text style="width: 4vw;">活动名称</el-text>
  40. <el-select v-model="searchData.activity" placeholder="请选择活动方式" style="width: 10vw;" clearable>
  41. <el-option v-for="item in activityList" :key="item.id" :label="item.activityName"
  42. :value="item.id" />
  43. </el-select>
  44. </div>
  45. <div class="rowItem">
  46. <el-text style="width: 4vw;">产品名称</el-text>
  47. <el-cascader v-model="searchData.goodsName" :options="productList" style="width: 10vw;"
  48. clearable />
  49. </div>
  50. <div class="rowItem" style="width: 30vw">
  51. <el-text style="width: 4vw; margin-left: 0.5vw;">付款时间</el-text>
  52. <el-date-picker v-model="getTime" type="datetimerange" range-separator=""
  53. start-placeholder="起始时间" end-placeholder="结束时间" style="width: 22vw; "
  54. @change="handleDatePickerChange" :default-time="defaultTime"
  55. :disabled-date="disabledDate" />
  56. </div>
  57. <div class="buttons">
  58. <el-button type="primary" @click="search">查询</el-button>
  59. <el-button type="success" @click="reset">重置</el-button>
  60. </div>
  61. </div>
  62. </el-card>
  63. </div>
  64. <!-- 表格区域仅保留客服相关列和操作 -->
  65. <div class="div-card2">
  66. <el-card class="card2">
  67. <div class="btns">
  68. <!-- 删除财务专属的标签页切换 -->
  69. <div class="btnAdd">
  70. <el-button @click="openAddForm" type="success">添加收款</el-button>
  71. </div>
  72. </div>
  73. <div class="table">
  74. <el-table :data="tableData" style="width: 80vw;height:54vh;" @sort-change="handleSortChange"
  75. :row-style="{ height: '60px' }" :header-cell-style="{ textAlign: 'center' }"
  76. :cell-style="{ textAlign: 'center' }">
  77. <el-table-column type="index" label="序号" width="100px" fixed="left">
  78. <template #default="scope">
  79. <span>{{ scope.$index + 1 + (pageInfo.pageNum - 1) * pageInfo.pageSize }}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column fixed="left" prop="jwcode" label="Homily ID" width="110px" />
  83. <el-table-column fixed="left" prop="name" label="姓名" width="110px" />
  84. <el-table-column prop="marketName" label="所属地区" width="80px" />
  85. <el-table-column prop="activity" label="活动名称" width="120px" show-overflow-tooltip />
  86. <el-table-column prop="goodsName" label="产品名称" width="120px" />
  87. <el-table-column prop="goodNum" label="产品数量" width="130px">
  88. <template #default="scope">
  89. <span v-if="scope.row.goodsName == '金币充值'">{{ scope.row.permanentGold }}</span>
  90. <span v-else>{{ scope.row.goodNum }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="paymentCurrency" label="付款币种" width="100px" />
  94. <el-table-column prop="paymentAmount" label="付款金额" width="120px" />
  95. <el-table-column prop="payType" label="支付方式" width="130px" />
  96. <el-table-column prop="payTime" label="付款时间" width="180px" />
  97. <el-table-column prop="voucher" label="转账凭证" width="110px">
  98. <template #default="scope">
  99. <div v-if="scope.row.voucher"
  100. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  101. @click="previewImage(scope.row.voucher)">
  102. <img :src="scope.row.voucher" alt="支付凭证" style="width: auto; height: 40px;">
  103. </div>
  104. <div v-else
  105. style="display: flex; justify-content: center; align-items: center; height: 40px;">
  106. </div>
  107. </template>
  108. </el-table-column>
  109. <el-table-column prop="submitterName" label="提交人" width="150px" show-overflow-tooltip />
  110. <el-table-column prop="remark" label="备注" width="150px" show-overflow-tooltip />
  111. <!-- 客服专属的订单状态列 -->
  112. <el-table-column fixed="right" prop="status" label="订单状态" width="100px">
  113. <template #default="scope">
  114. <span v-if="scope.row.status == 0">待审核</span>
  115. <span v-else-if="scope.row.status == 1 || scope.row.status == 4">已通过</span>
  116. <span v-else-if="scope.row.status == 2">已驳回</span>
  117. <span v-else-if="scope.row.status == 5">已撤回</span>
  118. <span v-else-if="scope.row.status == 6">退款</span>
  119. <span v-else></span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column fixed="right" label="操作" width="120px">
  123. <template #default=scope>
  124. <el-link v-if="scope.row.status == 4" style="color: #FA5A1E;"
  125. @click="openConfirm('refund', scope.row)">退款</el-link>
  126. <el-link v-else-if="scope.row.status == 1" style="color: #2741DE;">待填写手续费</el-link>
  127. <el-link v-else-if="scope.row.status == 5" style="color: #2741DE;"
  128. @click="openAddForm(scope.row)">编辑</el-link>
  129. <el-link v-else-if="scope.row.status == 0" style="color: #FA5A1E;"
  130. @click="openConfirm('recall', scope.row)">撤回</el-link>
  131. <el-link v-else-if="scope.row.status == 2" style="color: #FA5A1E;"
  132. @click="openRejectReason(scope.row.rejectReason)">查看驳回理由</el-link>
  133. </template>
  134. </el-table-column>
  135. </el-table>
  136. </div>
  137. <div class="pagination">
  138. <el-pagination background :page-size="pageInfo.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
  139. layout="total, sizes, prev, pager, next, jumper" :total="total"
  140. @size-change="handlePagination('size', $event)"
  141. @current-change="handlePagination('page', $event)"></el-pagination>
  142. </div>
  143. </el-card>
  144. </div>
  145. <!-- 撤回确认弹窗 -->
  146. <div class="recallDialog" v-show="recallDialog">
  147. <div class="close">
  148. <button @click="closeRecall" class="Btn">关闭</button>
  149. </div>
  150. <div class="text">
  151. <text class="txt">{{ textContent }}</text>
  152. </div>
  153. <div class="cancle">
  154. <button @click="closeRecall" class="Btn">取消</button>
  155. </div>
  156. <div class="confirm">
  157. <button @click="handleRecall" class="Btn">确定</button>
  158. </div>
  159. </div>
  160. <!-- 退款确认弹窗 -->
  161. <div class="recallDialog" v-show="refundConfirmDialog">
  162. <div class="close">
  163. <button @click="closeConfirmRefund" class="Btn">关闭</button>
  164. </div>
  165. <div class="text">
  166. <text class="txt">{{ textContent }}</text>
  167. </div>
  168. <div class="cancle">
  169. <button @click="closeConfirmRefund" class="Btn">取消</button>
  170. </div>
  171. <div class="confirm">
  172. <button @click="openRefundDialog" class="Btn">确定</button>
  173. </div>
  174. </div>
  175. <!-- 客服新增/编辑收款弹窗 -->
  176. <el-dialog class="adddialog" v-model="addFormisible" width="20vw" :before-close="closeAddForm">
  177. <el-form class="addForm" ref="addFormRef" :rules="addFormRule" :model="addFormData" label-width="4vw"
  178. label-position="left">
  179. <el-form-item label="精网号" required prop="jwcode">
  180. <el-input v-model="addFormData.jwcode" placeholder="请输入精网号" @blur="jwcodeSeachMarket" />
  181. </el-form-item>
  182. <el-form-item label="客户姓名" required prop="name">
  183. <el-input disabled v-model="addFormData.name" placeholder="请输入客户姓名" />
  184. </el-form-item>
  185. <el-form-item label="所属地区" prop="market">
  186. <el-input disabled v-model="addFormData.marketName" placeholder="请输入所属地区" />
  187. </el-form-item>
  188. <el-form-item label="活动名称" required prop="activity">
  189. <el-select v-model="addFormData.activity" placeholder="请选择活动方式" clearable>
  190. <el-option v-for="item in activityList" :key="item.id" :label="item.activityName"
  191. :value="item.id" />
  192. </el-select>
  193. </el-form-item>
  194. <el-form-item label="产品名称" required @change="ifGold" prop="goodsName">
  195. <ProductSelect ref="productSelectRef" v-model="addFormData.goodsName"></ProductSelect>
  196. </el-form-item>
  197. <el-form-item v-show="!isGold" label="产品数量" required prop="goodNum">
  198. <div style="display: flex;">
  199. <el-input style="padding-right: 30px; flex: 3;" v-model="addFormData.goodNum"
  200. placeholder="请输入产品数量" />
  201. <CurrencySelect v-model="addFormData.numUnit" :items="numUnitList" style="flex: 1.5;"
  202. placeholder="单位" @change="handleCurrencyChange" />
  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="到账地区" 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="转账凭证" 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="备注" 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, numUnitList } 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 productSelectRef = ref(null) // 产品选择器引用
  490. const uploadRef = ref(null) // 上传组件引用
  491. // 产品选择变更:判断是否为金币充值
  492. const ifGold = () => {
  493. if (addFormData.value.goodsName === '金币充值') {
  494. isGold.value = true
  495. addFormData.value.goodNum = 0
  496. } else {
  497. isGold.value = false
  498. const selectItems = ["AI机构追踪", "AI机构出击", "AI机构资金", "AI机活跃度", "超级机构透视", "超级机构伏击", "超级机构猎杀", "超级机构脉搏", "超级机构罗盘", 'HC信息费']
  499. if (selectItems.includes(addFormData.value.goodsName)) {
  500. addFormData.value.numUnit = ''
  501. } else if (addFormData.value.goodsName == '静态信息费') {
  502. addFormData.value.numUnit = '年'
  503. }else{
  504. addFormData.value.numUnit = '个'
  505. }
  506. }
  507. }
  508. // 支付方式变更:判断是否为默认归属平台
  509. const isGroup = ref(false)
  510. const ifGroup = () => {
  511. if (addFormData.value.payType === 'Stripe-链接收款' || addFormData.value.payType === 'PaymentAsia-链接收款') {
  512. isGroup.value = true
  513. addFormData.value.receivedMarket = '香港'
  514. } else if (addFormData.value.payType === 'Ipay88-链接收款') {
  515. isGroup.value = true
  516. addFormData.value.receivedMarket = '马来西亚'
  517. } else {
  518. isGroup.value = false
  519. }
  520. }
  521. // 精网号失焦:查询客户姓名和地区
  522. const jwcodeSeachMarket = async () => {
  523. try {
  524. const result = await request({
  525. url: '/cashCollection/getNameAndMarket',
  526. data: addFormData.value.jwcode
  527. })
  528. addFormData.value.market = result.data.market
  529. addFormData.value.marketName = result.data.marketName
  530. addFormData.value.name = result.data.name
  531. } catch (error) {
  532. console.log(error);
  533. }
  534. }
  535. // 打开新增/编辑弹窗
  536. const openAddForm = (row) => {
  537. productSelectRef.value?.resetSelect();
  538. if (row?.jwcode) {
  539. // 编辑模式
  540. addOrEdit.value = 2
  541. addFormData.value = { ...row }
  542. jwcodeSeachMarket()
  543. ifGold()
  544. } else {
  545. // 新增模式
  546. addOrEdit.value = 1
  547. addFormData.value = { goodsName: '' }
  548. }
  549. addFormisible.value = true
  550. }
  551. // 关闭新增/编辑弹窗
  552. const closeAddForm = () => {
  553. addFormisible.value = false
  554. addFormData.value = {}
  555. addOrEdit.value = 0
  556. isGold.value = false
  557. addFormRef.value?.resetFields();
  558. }
  559. // 客服新增收款
  560. const handleAddForm = async () => {
  561. try {
  562. await addFormRef.value.validate();
  563. // 处理时间格式
  564. if (addFormData.value.payTime) {
  565. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  566. }
  567. const result = await request({
  568. url: '/cashCollection/add',
  569. data: {
  570. ...addFormData.value,
  571. submitterId: adminData.value.id,
  572. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  573. freeGold: (addFormData.value.freeGold || 0) * 100,
  574. goodNum: addFormData.value.goodNum || 0,
  575. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  576. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  577. paymentAmount: (addFormData.value.paymentAmount) * 100,
  578. submitterMarket: adminData.value.markets
  579. }
  580. })
  581. if (result.code == 200) {
  582. ElMessage.success('添加成功')
  583. getlist()
  584. closeAddForm()
  585. }
  586. } catch (error) {
  587. console.log('新增报错:', error);
  588. ElMessage.error('请完善表单信息后提交');
  589. }
  590. }
  591. // 客服编辑收款(撤回后重新提交)
  592. const handleEditForm = async () => {
  593. try {
  594. // 处理时间格式
  595. if (addFormData.value.payTime) {
  596. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  597. }
  598. const result = await request({
  599. url: '/cashCollection/reSubmit',
  600. data: {
  601. ...addFormData.value,
  602. submitterId: adminData.value.id,
  603. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  604. freeGold: (addFormData.value.freeGold || 0) * 100,
  605. goodNum: addFormData.value.goodNum || 0,
  606. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  607. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  608. paymentAmount: (addFormData.value.paymentAmount) * 100
  609. }
  610. })
  611. if (result.code == 200) {
  612. ElMessage.success('编辑成功')
  613. getlist()
  614. closeAddForm()
  615. }
  616. } catch (error) {
  617. console.log(error);
  618. }
  619. }
  620. // 付款币种和支付方式选项(客服专用)
  621. const customOptions = ref(['美元(USD)', '港币(HKD)', '新币(SGD)', '马币(MYR)', '泰铢(THB)', '加币(CAD)', '越南盾(VDN)', '韩元(KRW)'])
  622. const paytypeOptions = ref(["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"])
  623. const MoneyAddressOptions = ref(['马来西亚', '香港', '新加坡', '泰国', '越南HCM', '加拿大'])
  624. const handleCurrencyChange = (option) => {
  625. console.log('选中的币种:', option);
  626. };
  627. // 图片上传相关
  628. const handleImgSuccess = (response) => {
  629. try {
  630. addFormData.value.voucher = response.data.url
  631. } catch (error) {
  632. ElMessage.error(response.msg || '图片上传失败')
  633. }
  634. }
  635. const handelImgErr = (err) => {
  636. console.log(err);
  637. addFormData.value.imageUrl = null
  638. ElMessage.error("图片上传失败")
  639. }
  640. const beforeUpload = (rawFile) => {
  641. if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/png') {
  642. ElMessage.error('图片必须是jpg或png类型!')
  643. return false
  644. } else if (rawFile.size / 1024 / 1024 > 2) {
  645. ElMessage.error('图片大小不能超过 2MB!')
  646. return false
  647. }
  648. return true
  649. }
  650. const handleImageChange = (file) => {
  651. uploadRef.value.submit()
  652. }
  653. const customUpload = async (options) => {
  654. try {
  655. const formData = new FormData()
  656. formData.append('file', options.file)
  657. const response = await API({
  658. url: 'https://api.homilychart.com/hljw/api/aws/upload',
  659. method: 'POST',
  660. data: formData,
  661. headers: { 'Content-Type': 'multipart/form-data' }
  662. })
  663. if (response.code === 200 && response.data) {
  664. handleImgSuccess(response, options.file)
  665. ElMessage.success('上传成功')
  666. } else {
  667. options.onError(response)
  668. ElMessage.error(response.msg || '上传失败')
  669. }
  670. } catch (error) {
  671. console.error('上传错误:', error)
  672. ElMessage.error(`上传失败: ${error.msg || error.message || '网络异常'}`)
  673. }
  674. }
  675. // 图片预览
  676. const previewImage = (imageUrl) => {
  677. const imageElement = document.createElement('img');
  678. imageElement.src = imageUrl;
  679. imageElement.style.maxWidth = '80vw';
  680. imageElement.style.maxHeight = '80vh';
  681. const viewer = document.createElement('div');
  682. viewer.style.position = 'fixed';
  683. viewer.style.top = '0';
  684. viewer.style.left = '0';
  685. viewer.style.width = '100vw';
  686. viewer.style.height = '100vh';
  687. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  688. viewer.style.display = 'flex';
  689. viewer.style.justifyContent = 'center';
  690. viewer.style.alignItems = 'center';
  691. viewer.style.zIndex = '9999';
  692. viewer.style.overflow = 'auto';
  693. viewer.appendChild(imageElement);
  694. document.body.appendChild(viewer);
  695. viewer.addEventListener('click', () => {
  696. document.body.removeChild(viewer);
  697. });
  698. };
  699. // ===================== 客服退款/撤回相关 =====================
  700. // 撤回弹窗
  701. const textContent = ref('')
  702. const recallDialog = ref(false)
  703. const RecallNum = ref('')
  704. // 退款确认弹窗
  705. const refundConfirmDialog = ref(false)
  706. const refundDialog = ref(false) // 退款详情弹窗
  707. const refundFormData = ref({}) // 退款表单数据
  708. const isRefundGold = ref(false) // 退款产品是否为金币
  709. // 判断退款产品类型
  710. const ifRefundGold = () => {
  711. if (refundFormData.value.goodsName === '金币充值') {
  712. isRefundGold.value = true
  713. refundFormData.value.goodNum = 0
  714. } else {
  715. isRefundGold.value = false
  716. }
  717. }
  718. // 打开撤回/退款确认弹窗
  719. const openConfirm = (val, row) => {
  720. if (val === 'refund') {
  721. textContent.value = '将要对该订单退款!'
  722. refundFormData.value = { ...row }
  723. ifRefundGold()
  724. refundConfirmDialog.value = true
  725. } else if (val === 'recall') {
  726. textContent.value = '将要撤回该信息!'
  727. recallDialog.value = true
  728. RecallNum.value = row.orderCode
  729. }
  730. }
  731. // 关闭撤回弹窗
  732. const closeRecall = () => {
  733. recallDialog.value = false
  734. textContent.value = ''
  735. RecallNum.value = ''
  736. }
  737. // 执行撤回
  738. const handleRecall = async () => {
  739. try {
  740. const result = await request({
  741. url: '/cashCollection/cancel',
  742. data: { orderCode: RecallNum.value }
  743. })
  744. if (result.code == 200) {
  745. ElMessage.success('撤回成功')
  746. getlist()
  747. closeRecall()
  748. }
  749. } catch (error) {
  750. console.log(error);
  751. }
  752. }
  753. // 关闭退款确认弹窗
  754. const closeConfirmRefund = () => {
  755. refundConfirmDialog.value = false
  756. textContent.value = ''
  757. }
  758. // 打开退款详情弹窗
  759. const openRefundDialog = () => {
  760. refundDialog.value = true
  761. closeConfirmRefund()
  762. }
  763. // 关闭退款详情弹窗
  764. const closeRefundForm = () => {
  765. refundDialog.value = false
  766. refundFormData.value = {}
  767. }
  768. // 提交退款
  769. const submitRefund = async () => {
  770. try {
  771. const result = await request({
  772. url: '/Money/add',
  773. data: {
  774. jwcode: refundFormData.value.jwcode,
  775. name: refundFormData.value.name,
  776. market: refundFormData.value.marketName,
  777. activity: refundFormData.value.activity,
  778. bankCode: refundFormData.value.bankCode,
  779. goodsName: refundFormData.value.goodsName,
  780. goodNum: refundFormData.value.goodNum,
  781. paymentCurrency: refundFormData.value.paymentCurrency,
  782. paymentAmount: (refundFormData.value.paymentAmount) * 100,
  783. receivedCurrency: refundFormData.value.receivedCurrency,
  784. receivedAmount: (refundFormData.value.receivedAmount) * 100,
  785. handlingCharge: (refundFormData.value.handlingCharge) * 100,
  786. receivedMarket: refundFormData.value.receivedMarket,
  787. payType: refundFormData.value.payType,
  788. payTime: refundFormData.value.payTime,
  789. receivedTime: refundFormData.value.receivedTime,
  790. areaServise: adminData.value.adminName,
  791. submitterId: adminData.value.id,
  792. voucher: refundFormData.value.voucher,
  793. remark: refundFormData.value.remark,
  794. refundReason: refundFormData.value.refundReason,
  795. refundModel: refundFormData.value.refundModel,
  796. id: refundFormData.value.id,
  797. orderCode: refundFormData.value.orderCode,
  798. permanentGold: (refundFormData.value.permanentGold) * 100 || 0,
  799. freeGold: (refundFormData.value.freeGold) * 100 || 0
  800. }
  801. })
  802. if (result.code == 200) {
  803. ElMessage.success('新增退款成功')
  804. getlist()
  805. closeRefundForm()
  806. } else {
  807. ElMessage.error(result.msg)
  808. }
  809. } catch (error) {
  810. console.log(error);
  811. }
  812. }
  813. // 查看驳回理由
  814. const openRejectReason = (reason) => {
  815. ElMessageBox.alert(reason, '驳回理由', {
  816. confirmButtonText: '确认',
  817. customClass: 'reject-reason-box',
  818. })
  819. }
  820. // ===================== 初始化与节流 =====================
  821. // 节流处理(防止重复提交)
  822. const throttledhandleAddForm = _.throttle(handleAddForm, 5000, { trailing: false })
  823. const throttledhandleEditForm = _.throttle(handleEditForm, 5000, { trailing: false })
  824. const throttledsubmitRefund = _.throttle(submitRefund, 5000, { trailing: false })
  825. // 活动列表(客服需要)
  826. const activityList = ref([])
  827. const getActivitys = async () => {
  828. try {
  829. const result = await API({ url: '/cashCollection/getActivityList', data: {} })
  830. if (result.code == 200) {
  831. activityList.value = result.data
  832. } else {
  833. ElMessage.error('活动列表获取失败')
  834. }
  835. } catch (error) {
  836. console.log('活动列表请求失败', error)
  837. }
  838. }
  839. // 获取管理员信息
  840. const getAdminData = async () => {
  841. try {
  842. const result = await API({ url: '/admin/userinfo', data: {} })
  843. adminData.value = result
  844. } catch (error) {
  845. console.log('管理员信息请求失败', error)
  846. }
  847. }
  848. // 支付方式列表(表格筛选用)
  849. const paytypeList = ["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"]
  850. // 初始化
  851. onMounted(async () => {
  852. await getAdminData()
  853. await getActivitys()
  854. // 客服角色默认加载列表
  855. getlist()
  856. })
  857. </script>
  858. <style scoped lang="scss">
  859. .content {
  860. height: 100%;
  861. width: 80vw;
  862. .card1 {
  863. width: 100%;
  864. background: #F3FAFE;
  865. .row {
  866. height: 4vh;
  867. width: 80vw;
  868. display: flex;
  869. min-height: 40px;
  870. .rowItem {
  871. display: flex;
  872. width: 15vw;
  873. align-items: center;
  874. justify-content: center;
  875. margin-right: 0.5vw;
  876. }
  877. .buttons {
  878. display: flex;
  879. justify-content: center;
  880. align-items: center;
  881. margin-left: 10px;
  882. }
  883. }
  884. }
  885. .div-card2 {
  886. width: 100%;
  887. margin-top: 2vh;
  888. .btns {
  889. display: flex;
  890. align-items: center;
  891. justify-content: space-between;
  892. padding-bottom: 10px;
  893. .btnAdd {
  894. padding-left: 10px;
  895. }
  896. }
  897. .table {
  898. margin: 10px;
  899. border-radius: 20px;
  900. .ellipsis-container {
  901. position: relative;
  902. width: 100%;
  903. .ellipsis-text {
  904. display: inline-block;
  905. width: 100%;
  906. white-space: nowrap;
  907. overflow: hidden;
  908. text-overflow: ellipsis;
  909. cursor: pointer;
  910. }
  911. .custom-tooltip {
  912. position: fixed;
  913. z-index: 9999;
  914. padding: 8px 12px;
  915. width: 200px;
  916. background-color: #E4F0FC;
  917. color: #333333;
  918. border: 1px solid #e5e7eb;
  919. border-radius: 4px;
  920. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  921. min-height: 30px;
  922. max-height: 300px;
  923. overflow-y: auto;
  924. font-size: 14px;
  925. line-height: 1.5;
  926. }
  927. }
  928. }
  929. .pagination {
  930. margin-top: 10px;
  931. padding: 10px 10px;
  932. }
  933. }
  934. .recallDialog {
  935. height: 392px;
  936. width: 700px;
  937. background-image: url('/src/assets/收款明细撤回背景.png');
  938. position: fixed;
  939. top: 50%;
  940. left: 50%;
  941. transform: translate(-50%, -50%);
  942. z-index: 1000;
  943. .close,
  944. .cancle,
  945. .confirm {
  946. opacity: 0;
  947. .Btn {
  948. height: 100%;
  949. width: 100%;
  950. border-radius: 10px;
  951. }
  952. }
  953. .close {
  954. position: absolute;
  955. left: 625px;
  956. top: 20px;
  957. height: 38px;
  958. width: 38px;
  959. }
  960. .text {
  961. position: absolute;
  962. left: 185px;
  963. top: 190px;
  964. height: 67px;
  965. width: 500px;
  966. .txt {
  967. height: 100%;
  968. width: 100%;
  969. color: #001a42;
  970. font-family: "PingFang SC";
  971. font-size: 48px;
  972. font-style: normal;
  973. font-weight: 900;
  974. line-height: normal;
  975. }
  976. }
  977. .cancle {
  978. position: absolute;
  979. left: 185px;
  980. top: 304px;
  981. height: 55px;
  982. width: 150px;
  983. }
  984. .confirm {
  985. position: absolute;
  986. left: 375px;
  987. top: 304px;
  988. height: 55px;
  989. width: 150px;
  990. }
  991. }
  992. :deep(.adddialog) {
  993. min-width: 500px;
  994. background-color: #F3FAFE !important;
  995. margin-top: 8vh;
  996. border-radius: 8px;
  997. .addForm {
  998. padding: 0 60px 1vh 60px;
  999. .el-date-editor {
  1000. display: flex;
  1001. flex: 1;
  1002. }
  1003. .pic {
  1004. display: flex;
  1005. align-items: center;
  1006. .uploader {
  1007. height: 80px;
  1008. width: 80px;
  1009. .el-upload {
  1010. height: 100%;
  1011. width: 100%;
  1012. }
  1013. }
  1014. .picText {
  1015. color: #999999;
  1016. font-family: "PingFang SC";
  1017. font-size: 10px;
  1018. font-style: normal;
  1019. font-weight: 400;
  1020. line-height: 20px;
  1021. margin-left: 10px;
  1022. }
  1023. }
  1024. }
  1025. .dialog-footer {
  1026. display: flex;
  1027. justify-content: center;
  1028. padding-bottom: 1.5vh;
  1029. }
  1030. }
  1031. .refundDialog {
  1032. .left {
  1033. width: 50%;
  1034. height: 70vh;
  1035. min-height: 700px;
  1036. padding: 0 2vw;
  1037. .add-item {
  1038. display: flex;
  1039. align-items: center;
  1040. margin-bottom: 1vh;
  1041. }
  1042. .image {
  1043. width: 4vw !important;
  1044. height: 4vw !important;
  1045. }
  1046. }
  1047. .right {
  1048. width: 50%;
  1049. height: 50vh;
  1050. .add-item {
  1051. display: flex;
  1052. align-items: center;
  1053. margin-bottom: 1vh;
  1054. }
  1055. }
  1056. }
  1057. :deep(.adddialog .el-form-item__label) {
  1058. min-width: 80px;
  1059. width: auto;
  1060. font-weight: 800;
  1061. padding-bottom: 15px;
  1062. }
  1063. }
  1064. // 表单卡片样式
  1065. .card2 {
  1066. background: #E7F4FD;
  1067. }
  1068. // 表格样式
  1069. :deep(.el-table__header-wrapper),
  1070. :deep(.el-table__body-wrapper),
  1071. :deep(.el-table__cell),
  1072. :deep(.el-table__body td) {
  1073. background-color: #F3FAFE !important;
  1074. }
  1075. :deep(.el-table__header th) {
  1076. background-color: #F3FAFE !important;
  1077. }
  1078. :deep(.el-table__row:hover > .el-table__cell) {
  1079. background-color: #E5EBFE !important;
  1080. }
  1081. // 驳回理由弹窗样式
  1082. .reject-reason-box {
  1083. --el-message-box-height: 500px;
  1084. }
  1085. .reject-reason-box .el-message-box__content {
  1086. max-height: 350px;
  1087. overflow-y: auto;
  1088. white-space: pre-wrap;
  1089. }
  1090. </style>