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.

1188 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 :current-page="pageInfo.pageNum" :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;width:4vw;">永久金币</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;width:4vw;">免费金币</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" v-show="refundFormData.goodsName === '金币充值' && refundFormData.refundModel === '1'">
  359. <el-text style="width:4vw;">永久金币</el-text>
  360. <el-input v-model="refundFormData.partRefundGold" style="width:5vw;" />&nbsp;&nbsp;
  361. </div>
  362. <div class="add-item" v-show="refundFormData.goodsName === '金币充值' && refundFormData.refundModel === '1'">
  363. <el-text style="width:4vw;">免费金币</el-text>
  364. <el-input v-model="refundFormData.partRefundFree" style="width:5vw;" />&nbsp;&nbsp;
  365. </div>
  366. <div class="add-item">
  367. <el-text style="width:4vw;">退款理由</el-text>
  368. <el-input v-model="refundFormData.refundReason" style="width:10vw;" :rows="5" maxlength="150"
  369. show-word-limit type="textarea" />
  370. </div>
  371. <div>ps:请在退款理由表明用户的退款需求</div>
  372. <div style="display:flex;justify-content: center;margin-top: 5vh;">
  373. <el-button type="default" @click="">重置</el-button>
  374. <el-button type="primary" @click="throttledsubmitRefund">提交</el-button>
  375. </div>
  376. </div>
  377. </div>
  378. </el-dialog>
  379. </div>
  380. </template>
  381. <script setup>
  382. import { ref, watch, onMounted } from 'vue';
  383. import { storeToRefs } from 'pinia';
  384. import { ElMessage, ElMessageBox } from 'element-plus'
  385. import API from '@/util/http.js'
  386. import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue'
  387. import ProductSelect from '@/components/MoneyManage/ProductSelect.vue'
  388. import { Plus } from '@element-plus/icons-vue'; // 补充图标导入(原代码遗漏)
  389. import request from '@/util/http.js'
  390. import moment from 'moment'
  391. import { useAdminStore } from '@/store/index.js'
  392. import { hasMenuPermission } from '@/utils/menuTreePermission.js'
  393. import _ from 'lodash'
  394. // 导入客服相关规则和静态数据
  395. import { addFormRule } from './utils/recriveFormRules.js'
  396. import { productList, MarketNameForId, CurrencyForId, marketList, statusList, numUnitList } from './utils/staticData.js'
  397. // ===================== 基础状态管理(仅保留客服相关) =====================
  398. const adminStore = useAdminStore();
  399. const { menuTree } = storeToRefs(adminStore);
  400. const adminData = ref({}) // 管理员信息
  401. const tableData = ref([]) // 表格数据
  402. const total = ref(0) // 总条数
  403. const pageInfo = ref({ pageSize: 10, pageNum: 1 }) // 分页信息
  404. // 角色标识:固定为客服(删除财务、总部财务、超级管理员标识)
  405. const kefu = ref(true)
  406. const caiwu = ref(false)
  407. const HQcaiwu = ref(false)
  408. const superAdmin = ref(false)
  409. // ===================== 查询相关 =====================
  410. const searchData = ref({}) // 搜索参数
  411. const getTime = ref([]) // 时间范围
  412. const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] // 默认时间
  413. // 查询按钮
  414. const search = () => {
  415. getlist()
  416. ElMessage.success('查询成功')
  417. }
  418. // 重置按钮
  419. const reset = () => {
  420. searchData.value = {}
  421. getTime.value = []
  422. // 重置页码
  423. pageInfo.value.pageNum = 1
  424. getlist()
  425. }
  426. // 时间选择器变更(原代码声明未实现,保留空函数避免报错)
  427. const handleDatePickerChange = () => { }
  428. // 日期禁用(原代码声明未实现,保留空函数避免报错)
  429. const disabledDate = () => { }
  430. // 表格排序(原代码声明未实现,保留空函数避免报错)
  431. const handleSortChange = () => { }
  432. // 获取表格数据(仅保留客服角色逻辑)
  433. const getlist = async () => {
  434. try {
  435. let payCurrencySelect = ''
  436. let goodsName = ''
  437. // 处理时间范围
  438. if (getTime.value && getTime.value.length === 2) {
  439. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss')
  440. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss')
  441. } else {
  442. searchData.value.startTime = ''
  443. searchData.value.endTime = ''
  444. }
  445. // 处理产品名称(级联选择器取最后一级)
  446. if (searchData.value.goodsName) {
  447. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1]
  448. }
  449. // 处理付款币种
  450. if (searchData.value.paymentCurrency) {
  451. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency)
  452. }
  453. // 客服角色固定参数:cashRoleId=0,无到账地区筛选
  454. const cashRoleId = '0'
  455. const receivedMarket = ''
  456. const result = await request({
  457. url: '/cashCollection/selectCollection',
  458. data: {
  459. ...pageInfo.value,
  460. cashCollection: {
  461. ...searchData.value,
  462. ...getTime.value,
  463. submitterId: adminData.value.id,
  464. receivedMarket: MarketNameForId(receivedMarket),
  465. cashRoleId: cashRoleId,
  466. paymentCurrency: payCurrencySelect,
  467. submitterMarket: adminData.value.markets,
  468. goodsName: goodsName,
  469. market: MarketNameForId(searchData.value.market)
  470. }
  471. }
  472. })
  473. if (result.code == 200) {
  474. tableData.value = result.data.list
  475. total.value = result.data.total
  476. } else {
  477. ElMessage.error('数据异常')
  478. console.log(result.msg);
  479. }
  480. } catch (error) {
  481. console.log(error);
  482. }
  483. }
  484. // ===================== 分页相关 =====================
  485. const handlePagination = (type, val) => {
  486. if (type === 'size') {
  487. pageInfo.value.pageSize = val
  488. } else {
  489. pageInfo.value.pageNum = val
  490. }
  491. getlist()
  492. }
  493. // ===================== 客服新增/编辑收款弹窗 =====================
  494. const addFormisible = ref(false) // 弹窗显隐
  495. const addFormData = ref({ name: '', market: '', permanentGold: 0, freeGold: 0, goodsName: '' }) // 表单数据
  496. const addFormRef = ref(null) // 表单引用
  497. const addOrEdit = ref(0) // 1=新增,2=编辑
  498. const isGold = ref(false) // 是否为金币充值产品
  499. const productSelectRef = ref(null) // 产品选择器引用
  500. const uploadRef = ref(null) // 上传组件引用
  501. // 产品选择变更:判断是否为金币充值
  502. const ifGold = () => {
  503. if (addFormData.value.goodsName === '金币充值') {
  504. isGold.value = true
  505. addFormData.value.goodNum = 0
  506. } else {
  507. isGold.value = false
  508. const selectItems = ["AI机构追踪", "AI机构出击", "AI机构资金", "AI机活跃度", "超级机构透视", "超级机构伏击", "超级机构猎杀", "超级机构脉搏", "超级机构罗盘", 'HC信息费']
  509. if (selectItems.includes(addFormData.value.goodsName)) {
  510. addFormData.value.numUnit = ''
  511. } else if (addFormData.value.goodsName == '静态信息费') {
  512. addFormData.value.numUnit = '年'
  513. }else{
  514. addFormData.value.numUnit = '个'
  515. }
  516. }
  517. }
  518. // 支付方式变更:判断是否为默认归属平台
  519. const isGroup = ref(false)
  520. const ifGroup = () => {
  521. if (addFormData.value.payType === 'Stripe-链接收款' || addFormData.value.payType === 'PaymentAsia-链接收款') {
  522. isGroup.value = true
  523. addFormData.value.receivedMarket = '香港'
  524. } else if (addFormData.value.payType === 'Ipay88-链接收款') {
  525. isGroup.value = true
  526. addFormData.value.receivedMarket = '马来西亚'
  527. } else {
  528. isGroup.value = false
  529. }
  530. }
  531. // 精网号失焦:查询客户姓名和地区
  532. const jwcodeSeachMarket = async () => {
  533. try {
  534. const result = await request({
  535. url: '/cashCollection/getNameAndMarket',
  536. data: addFormData.value.jwcode
  537. })
  538. addFormData.value.market = result.data.market
  539. addFormData.value.marketName = result.data.marketName
  540. addFormData.value.name = result.data.name
  541. } catch (error) {
  542. console.log(error);
  543. }
  544. }
  545. // 打开新增/编辑弹窗
  546. const openAddForm = (row) => {
  547. productSelectRef.value?.resetSelect();
  548. if (row?.jwcode) {
  549. // 编辑模式
  550. addOrEdit.value = 2
  551. addFormData.value = { ...row }
  552. jwcodeSeachMarket()
  553. ifGold()
  554. } else {
  555. // 新增模式
  556. addOrEdit.value = 1
  557. addFormData.value = { goodsName: '' }
  558. }
  559. addFormisible.value = true
  560. }
  561. // 关闭新增/编辑弹窗
  562. const closeAddForm = () => {
  563. addFormisible.value = false
  564. addFormData.value = {}
  565. addOrEdit.value = 0
  566. isGold.value = false
  567. addFormRef.value?.resetFields();
  568. }
  569. // 客服新增收款
  570. const handleAddForm = async () => {
  571. try {
  572. await addFormRef.value.validate();
  573. // 处理时间格式
  574. if (addFormData.value.payTime) {
  575. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  576. }
  577. const result = await request({
  578. url: '/cashCollection/add',
  579. data: {
  580. ...addFormData.value,
  581. submitterId: adminData.value.id,
  582. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  583. freeGold: (addFormData.value.freeGold || 0) * 100,
  584. goodNum: addFormData.value.goodNum || 0,
  585. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  586. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  587. paymentAmount: (addFormData.value.paymentAmount) * 100,
  588. submitterMarket: adminData.value.markets
  589. }
  590. })
  591. if (result.code == 200) {
  592. ElMessage.success('添加成功')
  593. getlist()
  594. closeAddForm()
  595. }
  596. } catch (error) {
  597. console.log('新增报错:', error);
  598. ElMessage.error('请完善表单信息后提交');
  599. }
  600. }
  601. // 客服编辑收款(撤回后重新提交)
  602. const handleEditForm = async () => {
  603. try {
  604. // 处理时间格式
  605. if (addFormData.value.payTime) {
  606. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  607. }
  608. const result = await request({
  609. url: '/cashCollection/reSubmit',
  610. data: {
  611. ...addFormData.value,
  612. submitterId: adminData.value.id,
  613. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  614. freeGold: (addFormData.value.freeGold || 0) * 100,
  615. goodNum: addFormData.value.goodNum || 0,
  616. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  617. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  618. paymentAmount: (addFormData.value.paymentAmount) * 100
  619. }
  620. })
  621. if (result.code == 200) {
  622. ElMessage.success('编辑成功')
  623. getlist()
  624. closeAddForm()
  625. }
  626. } catch (error) {
  627. console.log(error);
  628. }
  629. }
  630. // 付款币种和支付方式选项(客服专用)
  631. const customOptions = ref(['美元(USD)', '港币(HKD)', '新币(SGD)', '马币(MYR)', '泰铢(THB)', '加币(CAD)', '越南盾(VDN)', '韩元(KRW)'])
  632. const paytypeOptions = ref(["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"])
  633. const MoneyAddressOptions = ref(['马来西亚', '香港', '新加坡', '泰国', '越南HCM', '加拿大'])
  634. const handleCurrencyChange = (option) => {
  635. console.log('选中的币种:', option);
  636. };
  637. // 图片上传相关
  638. const handleImgSuccess = (response) => {
  639. try {
  640. addFormData.value.voucher = response.data.url
  641. } catch (error) {
  642. ElMessage.error(response.msg || '图片上传失败')
  643. }
  644. }
  645. const handelImgErr = (err) => {
  646. console.log(err);
  647. addFormData.value.imageUrl = null
  648. ElMessage.error("图片上传失败")
  649. }
  650. const beforeUpload = (rawFile) => {
  651. if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/png') {
  652. ElMessage.error('图片必须是jpg或png类型!')
  653. return false
  654. } else if (rawFile.size / 1024 / 1024 > 2) {
  655. ElMessage.error('图片大小不能超过 2MB!')
  656. return false
  657. }
  658. return true
  659. }
  660. const handleImageChange = (file) => {
  661. uploadRef.value.submit()
  662. }
  663. const customUpload = async (options) => {
  664. try {
  665. const formData = new FormData()
  666. formData.append('file', options.file)
  667. const response = await API({
  668. url: 'https://api.homilychart.com/hljw/api/aws/upload',
  669. method: 'POST',
  670. data: formData,
  671. headers: { 'Content-Type': 'multipart/form-data' }
  672. })
  673. if (response.code === 200 && response.data) {
  674. handleImgSuccess(response, options.file)
  675. ElMessage.success('上传成功')
  676. } else {
  677. options.onError(response)
  678. ElMessage.error(response.msg || '上传失败')
  679. }
  680. } catch (error) {
  681. console.error('上传错误:', error)
  682. ElMessage.error(`上传失败: ${error.msg || error.message || '网络异常'}`)
  683. }
  684. }
  685. // 图片预览
  686. const previewImage = (imageUrl) => {
  687. const imageElement = document.createElement('img');
  688. imageElement.src = imageUrl;
  689. imageElement.style.maxWidth = '80vw';
  690. imageElement.style.maxHeight = '80vh';
  691. const viewer = document.createElement('div');
  692. viewer.style.position = 'fixed';
  693. viewer.style.top = '0';
  694. viewer.style.left = '0';
  695. viewer.style.width = '100vw';
  696. viewer.style.height = '100vh';
  697. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  698. viewer.style.display = 'flex';
  699. viewer.style.justifyContent = 'center';
  700. viewer.style.alignItems = 'center';
  701. viewer.style.zIndex = '9999';
  702. viewer.style.overflow = 'auto';
  703. viewer.appendChild(imageElement);
  704. document.body.appendChild(viewer);
  705. viewer.addEventListener('click', () => {
  706. document.body.removeChild(viewer);
  707. });
  708. };
  709. // ===================== 客服退款/撤回相关 =====================
  710. // 撤回弹窗
  711. const textContent = ref('')
  712. const recallDialog = ref(false)
  713. const RecallNum = ref('')
  714. // 退款确认弹窗
  715. const refundConfirmDialog = ref(false)
  716. const refundDialog = ref(false) // 退款详情弹窗
  717. const refundFormData = ref({}) // 退款表单数据
  718. const isRefundGold = ref(false) // 退款产品是否为金币
  719. // 判断退款产品类型
  720. const ifRefundGold = () => {
  721. if (refundFormData.value.goodsName === '金币充值') {
  722. isRefundGold.value = true
  723. refundFormData.value.goodNum = 0
  724. } else {
  725. isRefundGold.value = false
  726. }
  727. }
  728. // 打开撤回/退款确认弹窗
  729. const openConfirm = (val, row) => {
  730. if (val === 'refund') {
  731. textContent.value = '将要对该订单退款!'
  732. refundFormData.value = { ...row }
  733. ifRefundGold()
  734. refundConfirmDialog.value = true
  735. } else if (val === 'recall') {
  736. textContent.value = '将要撤回该信息!'
  737. recallDialog.value = true
  738. RecallNum.value = row.orderCode
  739. }
  740. }
  741. // 关闭撤回弹窗
  742. const closeRecall = () => {
  743. recallDialog.value = false
  744. textContent.value = ''
  745. RecallNum.value = ''
  746. }
  747. // 执行撤回
  748. const handleRecall = async () => {
  749. try {
  750. const result = await request({
  751. url: '/cashCollection/cancel',
  752. data: { orderCode: RecallNum.value }
  753. })
  754. if (result.code == 200) {
  755. ElMessage.success('撤回成功')
  756. getlist()
  757. closeRecall()
  758. }
  759. } catch (error) {
  760. console.log(error);
  761. }
  762. }
  763. // 关闭退款确认弹窗
  764. const closeConfirmRefund = () => {
  765. refundConfirmDialog.value = false
  766. textContent.value = ''
  767. }
  768. // 打开退款详情弹窗
  769. const openRefundDialog = () => {
  770. refundDialog.value = true
  771. closeConfirmRefund()
  772. }
  773. // 关闭退款详情弹窗
  774. const closeRefundForm = () => {
  775. refundDialog.value = false
  776. refundFormData.value = {}
  777. }
  778. // 提交退款
  779. const submitRefund = async () => {
  780. try {
  781. const result = await request({
  782. url: '/Money/add',
  783. data: {
  784. jwcode: refundFormData.value.jwcode,
  785. name: refundFormData.value.name,
  786. market: refundFormData.value.marketName,
  787. activity: refundFormData.value.activity,
  788. bankCode: refundFormData.value.bankCode,
  789. goodsName: refundFormData.value.goodsName,
  790. goodNum: refundFormData.value.goodNum,
  791. paymentCurrency: refundFormData.value.paymentCurrency,
  792. paymentAmount: (refundFormData.value.paymentAmount) * 100,
  793. receivedCurrency: refundFormData.value.receivedCurrency,
  794. receivedAmount: (refundFormData.value.receivedAmount) * 100,
  795. handlingCharge: (refundFormData.value.handlingCharge) * 100,
  796. receivedMarket: refundFormData.value.receivedMarket,
  797. payType: refundFormData.value.payType,
  798. payTime: refundFormData.value.payTime,
  799. receivedTime: refundFormData.value.receivedTime,
  800. areaServise: adminData.value.adminName,
  801. submitterId: adminData.value.id,
  802. voucher: refundFormData.value.voucher,
  803. remark: refundFormData.value.remark,
  804. refundReason: refundFormData.value.refundReason,
  805. refundModel: refundFormData.value.refundModel,
  806. id: refundFormData.value.id,
  807. orderCode: refundFormData.value.orderCode,
  808. permanentGold: (refundFormData.value.permanentGold) * 100 || 0,
  809. freeGold: (refundFormData.value.freeGold) * 100 || 0,
  810. partRefundGold: (refundFormData.value.partRefundGold) * 100 || 0,
  811. partRefundFree: (refundFormData.value.partRefundFree) * 100 || 0,
  812. }
  813. })
  814. if (result.code == 200) {
  815. ElMessage.success('新增退款成功')
  816. getlist()
  817. closeRefundForm()
  818. } else {
  819. ElMessage.error(result.msg)
  820. }
  821. } catch (error) {
  822. console.log(error);
  823. }
  824. }
  825. // 查看驳回理由
  826. const openRejectReason = (reason) => {
  827. ElMessageBox.alert(reason, '驳回理由', {
  828. confirmButtonText: '确认',
  829. customClass: 'reject-reason-box',
  830. })
  831. }
  832. // ===================== 初始化与节流 =====================
  833. // 节流处理(防止重复提交)
  834. const throttledhandleAddForm = _.throttle(handleAddForm, 5000, { trailing: false })
  835. const throttledhandleEditForm = _.throttle(handleEditForm, 5000, { trailing: false })
  836. const throttledsubmitRefund = _.throttle(submitRefund, 5000, { trailing: false })
  837. // 活动列表(客服需要)
  838. const activityList = ref([])
  839. const getActivitys = async () => {
  840. try {
  841. const result = await API({ url: '/cashCollection/getActivityList', data: {} })
  842. if (result.code == 200) {
  843. activityList.value = result.data
  844. } else {
  845. ElMessage.error('活动列表获取失败')
  846. }
  847. } catch (error) {
  848. console.log('活动列表请求失败', error)
  849. }
  850. }
  851. // 获取管理员信息
  852. const getAdminData = async () => {
  853. try {
  854. const result = await API({ url: '/admin/userinfo', data: {} })
  855. adminData.value = result
  856. } catch (error) {
  857. console.log('管理员信息请求失败', error)
  858. }
  859. }
  860. // 支付方式列表(表格筛选用)
  861. const paytypeList = ["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"]
  862. // 初始化
  863. onMounted(async () => {
  864. await getAdminData()
  865. await getActivitys()
  866. // 客服角色默认加载列表
  867. getlist()
  868. })
  869. </script>
  870. <style scoped lang="scss">
  871. .content {
  872. height: 100%;
  873. width: 80vw;
  874. .card1 {
  875. width: 100%;
  876. background: #F3FAFE;
  877. .row {
  878. height: 4vh;
  879. width: 80vw;
  880. display: flex;
  881. min-height: 40px;
  882. .rowItem {
  883. display: flex;
  884. width: 15vw;
  885. align-items: center;
  886. justify-content: center;
  887. margin-right: 0.5vw;
  888. }
  889. .buttons {
  890. display: flex;
  891. justify-content: center;
  892. align-items: center;
  893. margin-left: 10px;
  894. }
  895. }
  896. }
  897. .div-card2 {
  898. width: 100%;
  899. margin-top: 2vh;
  900. .btns {
  901. display: flex;
  902. align-items: center;
  903. justify-content: space-between;
  904. padding-bottom: 10px;
  905. .btnAdd {
  906. padding-left: 10px;
  907. }
  908. }
  909. .table {
  910. margin: 10px;
  911. border-radius: 20px;
  912. .ellipsis-container {
  913. position: relative;
  914. width: 100%;
  915. .ellipsis-text {
  916. display: inline-block;
  917. width: 100%;
  918. white-space: nowrap;
  919. overflow: hidden;
  920. text-overflow: ellipsis;
  921. cursor: pointer;
  922. }
  923. .custom-tooltip {
  924. position: fixed;
  925. z-index: 9999;
  926. padding: 8px 12px;
  927. width: 200px;
  928. background-color: #E4F0FC;
  929. color: #333333;
  930. border: 1px solid #e5e7eb;
  931. border-radius: 4px;
  932. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  933. min-height: 30px;
  934. max-height: 300px;
  935. overflow-y: auto;
  936. font-size: 14px;
  937. line-height: 1.5;
  938. }
  939. }
  940. }
  941. .pagination {
  942. margin-top: 10px;
  943. padding: 10px 10px;
  944. }
  945. }
  946. .recallDialog {
  947. height: 392px;
  948. width: 700px;
  949. background-image: url('/src/assets/receive-recall.png');
  950. position: fixed;
  951. top: 50%;
  952. left: 50%;
  953. transform: translate(-50%, -50%);
  954. z-index: 1000;
  955. .close,
  956. .cancle,
  957. .confirm {
  958. opacity: 0;
  959. .Btn {
  960. height: 100%;
  961. width: 100%;
  962. border-radius: 10px;
  963. }
  964. }
  965. .close {
  966. position: absolute;
  967. left: 625px;
  968. top: 20px;
  969. height: 38px;
  970. width: 38px;
  971. }
  972. .text {
  973. position: absolute;
  974. left: 185px;
  975. top: 190px;
  976. height: 67px;
  977. width: 500px;
  978. .txt {
  979. height: 100%;
  980. width: 100%;
  981. color: #001a42;
  982. font-family: "PingFang SC";
  983. font-size: 48px;
  984. font-style: normal;
  985. font-weight: 900;
  986. line-height: normal;
  987. }
  988. }
  989. .cancle {
  990. position: absolute;
  991. left: 185px;
  992. top: 304px;
  993. height: 55px;
  994. width: 150px;
  995. }
  996. .confirm {
  997. position: absolute;
  998. left: 375px;
  999. top: 304px;
  1000. height: 55px;
  1001. width: 150px;
  1002. }
  1003. }
  1004. :deep(.adddialog) {
  1005. min-width: 500px;
  1006. background-color: #F3FAFE !important;
  1007. margin-top: 8vh;
  1008. border-radius: 8px;
  1009. .addForm {
  1010. padding: 0 60px 1vh 60px;
  1011. .el-date-editor {
  1012. display: flex;
  1013. flex: 1;
  1014. }
  1015. .pic {
  1016. display: flex;
  1017. align-items: center;
  1018. .uploader {
  1019. height: 80px;
  1020. width: 80px;
  1021. .el-upload {
  1022. height: 100%;
  1023. width: 100%;
  1024. }
  1025. }
  1026. .picText {
  1027. color: #999999;
  1028. font-family: "PingFang SC";
  1029. font-size: 10px;
  1030. font-style: normal;
  1031. font-weight: 400;
  1032. line-height: 20px;
  1033. margin-left: 10px;
  1034. }
  1035. }
  1036. }
  1037. .dialog-footer {
  1038. display: flex;
  1039. justify-content: center;
  1040. padding-bottom: 1.5vh;
  1041. }
  1042. }
  1043. .refundDialog {
  1044. .left {
  1045. width: 50%;
  1046. height: 70vh;
  1047. min-height: 700px;
  1048. padding: 0 2vw;
  1049. .add-item {
  1050. display: flex;
  1051. align-items: center;
  1052. margin-bottom: 1vh;
  1053. }
  1054. .image {
  1055. width: 4vw !important;
  1056. height: 4vw !important;
  1057. }
  1058. }
  1059. .right {
  1060. width: 50%;
  1061. height: 50vh;
  1062. .add-item {
  1063. display: flex;
  1064. align-items: center;
  1065. margin-bottom: 1vh;
  1066. }
  1067. }
  1068. }
  1069. :deep(.adddialog .el-form-item__label) {
  1070. min-width: 80px;
  1071. width: auto;
  1072. font-weight: 800;
  1073. padding-bottom: 15px;
  1074. }
  1075. }
  1076. // 表单卡片样式
  1077. .card2 {
  1078. background: #E7F4FD;
  1079. }
  1080. // 表格样式
  1081. :deep(.el-table__header-wrapper),
  1082. :deep(.el-table__body-wrapper),
  1083. :deep(.el-table__cell),
  1084. :deep(.el-table__body td) {
  1085. background-color: #F3FAFE !important;
  1086. }
  1087. :deep(.el-table__header th) {
  1088. background-color: #F3FAFE !important;
  1089. }
  1090. :deep(.el-table__row:hover > .el-table__cell) {
  1091. background-color: #E5EBFE !important;
  1092. }
  1093. // 驳回理由弹窗样式
  1094. .reject-reason-box {
  1095. --el-message-box-height: 500px;
  1096. }
  1097. .reject-reason-box .el-message-box__content {
  1098. max-height: 350px;
  1099. overflow-y: auto;
  1100. white-space: pre-wrap;
  1101. }
  1102. </style>