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.

1651 lines
68 KiB

3 months ago
5 months ago
2 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
1 month ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
1 month ago
1 month ago
5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
1 month ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
1 month ago
5 months ago
1 month ago
5 months ago
5 months ago
4 months ago
  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;">{{ t('common.jwcode') }}</el-text>
  9. <el-input v-model="searchData.jwcode" :placeholder="t('common.jwcodePlaceholder')"
  10. style="width:10vw;" clearable></el-input>
  11. </div>
  12. <div class="rowItem">
  13. <el-text style="width: 4vw;">{{ t('common.customerName') }}</el-text>
  14. <el-input v-model="searchData.name" :placeholder="t('common.customerNamePlaceholder')"
  15. style="width:10vw;" clearable></el-input>
  16. </div>
  17. <div class="rowItem">
  18. <el-text style="width: 4vw;">{{ t('common.orderStatus') }}</el-text>
  19. <el-select v-model="searchData.status" :placeholder="t('common.orderStatusPlaceholder')"
  20. style="width: 10vw;" clearable>
  21. <el-option v-for="item in statusList" :key="item.name" :label="item.name"
  22. :value="item.value" />
  23. </el-select>
  24. </div>
  25. <div class="rowItem">
  26. <el-text style="width: 4vw;">{{ t('common.payModel') }}</el-text>
  27. <el-select v-model="searchData.payType" :placeholder="t('common.payModelPlaceholder')"
  28. style="width: 10vw;" clearable>
  29. <el-option v-for="item in paytypeList" :key="item" :label="item" :value="item" />
  30. </el-select>
  31. </div>
  32. </div>
  33. <div class="row" style="margin-top: 10px;">
  34. <div class="rowItem">
  35. <el-text style="width: 4vw;">{{ t('common.activityName') }}</el-text>
  36. <el-select v-model="searchData.activity" :placeholder="t('common.activityNameChoose')"
  37. style="width: 10vw;" clearable>
  38. <el-option v-for="item in activityList" :key="item.id" :label="item.activityName"
  39. :value="item.id" />
  40. </el-select>
  41. </div>
  42. <div class="rowItem">
  43. <el-text style="width: 4vw;">{{ t('common.productName') }}</el-text>
  44. <el-cascader v-model="searchData.goodsName" :options="productList" style="width: 10vw;"
  45. clearable />
  46. </div>
  47. <div class="rowItem" style="width: 30vw">
  48. <el-text style="width: 4vw; margin-left: 0.5vw;">{{ t('common.payTime') }}</el-text>
  49. <el-date-picker v-model="getTime" type="datetimerange" :range-separator="t('common.to')"
  50. :start-placeholder="t('common.startTime')" :end-placeholder="t('common.endTime')"
  51. style="width: 22vw; " @change="handleDatePickerChange" :default-time="defaultTime"
  52. :disabled-date="disabledDate" />
  53. </div>
  54. <div class="buttons">
  55. <el-button type="primary" @click="search">{{ t('common.search') }}</el-button>
  56. <el-button type="success" @click="reset">{{ t('common.reset') }}</el-button>
  57. </div>
  58. </div>
  59. </el-card>
  60. </div>
  61. <!-- 表格区域仅保留客服相关列和操作 -->
  62. <div class="div-card2">
  63. <el-card class="card2">
  64. <div class="btns">
  65. <div class="btnAdd">
  66. <el-button @click="openAddForm" type="success">{{ t('common.addReceive') }}</el-button>
  67. </div>
  68. <div class="info-tooltip">
  69. <el-popover placement="top" :title="t('cash.receiveCashDataTitle')" :width="260" trigger="hover"
  70. :content="t('cash.receiveCashDataContent')" popper-class="custom-popover"
  71. :show-arrow="false">
  72. <template #reference>
  73. <el-icon class="service-icon">
  74. <Warning />
  75. </el-icon>
  76. </template>
  77. </el-popover>
  78. </div>
  79. </div>
  80. <div class="table">
  81. <el-table ref="tableRef" :data="tableData" style="width: 80vw;height:64vh;" @sort-change="handleSortChange"
  82. :row-style="{ height: '60px' }" :header-cell-style="{ textAlign: 'center' }"
  83. :cell-style="{ textAlign: 'center' }">
  84. <el-table-column type="index" :label="t('common_list.id')" width="100px" fixed="left">
  85. <template #default="scope">
  86. <span>{{ scope.$index + 1 + (pageInfo.pageNum - 1) * pageInfo.pageSize }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column fixed="left" prop="jwcode" label="Homily ID" width="110px" />
  90. <el-table-column fixed="left" prop="name" :label="t('common_list.name')" width="110px" />
  91. <el-table-column prop="marketName" :label="t('common_list.market')" width="120px" />
  92. <el-table-column prop="activity" :label="t('common_list.activity')" width="120px"
  93. show-overflow-tooltip />
  94. <el-table-column prop="goodsName" :label="t('common_list.productName')" width="150px" />
  95. <el-table-column prop="goodNum" :label="t('common_list.productNum')" width="130px">
  96. <template #default="scope">
  97. <span v-if="scope.row.goodsName == t('common_list.goldRecharge')">{{
  98. scope.row.permanentGold }} {{ t('cash.unit') }}</span>
  99. <span v-else>{{ scope.row.goodNum }} {{ scope.row.numUnit }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="paymentCurrency" :label="t('common_list.payCurrency')" width="120px" />
  103. <el-table-column prop="paymentAmount" :label="t('common_list.payAmount')" width="120px" />
  104. <el-table-column prop="payType" :label="t('common_list.payModel')" width="130px" />
  105. <el-table-column prop="payTime" :label="t('common_list.payTime')" width="180px" />
  106. <el-table-column prop="voucher" :label="t('common_list.transferVoucher')" width="110px">
  107. <template #default="scope">
  108. <div v-if="scope.row.voucher"
  109. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  110. @click="previewImage(scope.row.voucher)">
  111. <img :src="scope.row.voucher" :alt="t('common_list.payVoucher')"
  112. style="width: auto; height: 40px;">
  113. </div>
  114. <div v-else
  115. style="display: flex; justify-content: center; align-items: center; height: 40px;">
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="submitterName" :label="t('common_list.submitter')" width="150px"
  120. show-overflow-tooltip />
  121. <el-table-column prop="remark" :label="t('common_list.remark')" width="150px"
  122. show-overflow-tooltip />
  123. <!-- 客服专属的订单状态列 -->
  124. <el-table-column fixed="right" prop="status" :label="t('common_list.orderStatus')"
  125. width="100px">
  126. <template #default="scope">
  127. <span v-if="scope.row.status == 0">{{ t('common.pendingAudit') }}</span>
  128. <span v-else-if="scope.row.status == 1 || scope.row.status == 4">{{ t('common.passed')
  129. }}</span>
  130. <span v-else-if="scope.row.status == 2">{{ t('common.rejected') }}</span>
  131. <span v-else-if="scope.row.status == 5">{{ t('common.withdrawn') }}</span>
  132. <span v-else-if="scope.row.status == 6">{{ t('common.refunded') }}</span>
  133. <span v-else></span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column fixed="right" :label="t('common_list.operation')" width="120px">
  137. <template #default=scope>
  138. <el-link v-if="scope.row.status == 4" style="color: #FA5A1E;"
  139. @click="openConfirm('refund', scope.row)">{{ t('common.refund') }}</el-link>
  140. <el-link v-else-if="scope.row.status == 1" style="color: #2741DE;">{{
  141. t('common.pendingFee') }}</el-link>
  142. <el-link v-else-if="scope.row.status == 5" style="color: #2741DE;"
  143. @click="openAddForm(scope.row)">{{ t('common.edit') }}</el-link>
  144. <el-link v-else-if="scope.row.status == 0" style="color: #FA5A1E;"
  145. @click="openConfirm('recall', scope.row)">{{ t('common.withdraw') }}</el-link>
  146. <el-link v-else-if="scope.row.status == 2" style="color: #FA5A1E;"
  147. @click="openRejectReason(scope.row.rejectReason)">{{ t('common.viewRejectReason')
  148. }}</el-link>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. </div>
  153. <div class="pagination">
  154. <el-pagination background :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize"
  155. :page-sizes="[5, 10, 20, 50, 100]" layout="total, sizes, prev, pager, next, jumper"
  156. :total="total" @size-change="handlePagination('size', $event)"
  157. @current-change="handlePagination('page', $event)"></el-pagination>
  158. </div>
  159. </el-card>
  160. </div>
  161. <!-- 撤回确认弹窗 -->
  162. <div class="recallDialog" v-show="recallDialog">
  163. <div class="close">
  164. <button @click="closeRecall" class="Btn">{{ t('common.close') }}</button>
  165. </div>
  166. <div class="text">
  167. <text class="txt">{{ textContent }}</text>
  168. </div>
  169. <div class="cancle">
  170. <button @click="closeRecall" class="Btn">{{ t('common.cancel') }}</button>
  171. </div>
  172. <div class="confirm">
  173. <button @click="handleRecall" class="Btn">{{ t('common.confirm') }}</button>
  174. </div>
  175. </div>
  176. <!-- 退款确认弹窗 -->
  177. <div class="recallDialog" v-show="refundConfirmDialog">
  178. <div class="close">
  179. <button @click="closeConfirmRefund" class="Btn">{{ t('common.close') }}</button>
  180. </div>
  181. <div class="text">
  182. <text class="txt">{{ textContent }}</text>
  183. </div>
  184. <div class="cancle">
  185. <button @click="closeConfirmRefund" class="Btn">{{ t('common.cancel') }}</button>
  186. </div>
  187. <div class="confirm">
  188. <button @click="openRefundDialog" class="Btn">{{ t('common.confirm') }}</button>
  189. </div>
  190. </div>
  191. <!-- 客服新增/编辑收款弹窗 -->
  192. <el-dialog class="adddialog" v-model="addFormisible" width="35vw" :before-close="closeAddForm">
  193. <el-form class="addForm" ref="addFormRef" :rules="addFormRule" :model="addFormData" label-width="6vw"
  194. label-position="left">
  195. <el-form-item :label="t('common_add.jwcode')" required prop="jwcode">
  196. <el-input v-model="addFormData.jwcode" :placeholder="t('common_add.jwcodePlaceholder')"
  197. @focus="handleJwcodeFocus" @blur="handleJwcodeBlur" @keyup.enter="handleJwcodeEnter" />
  198. </el-form-item>
  199. <el-form-item :label="t('common_add.customerName')" required prop="name">
  200. <el-input disabled v-model="addFormData.name"
  201. :placeholder="t('common_add.customerNamePlaceholder')" />
  202. </el-form-item>
  203. <el-form-item :label="t('common_add.market')" prop="market">
  204. <el-input disabled v-model="addFormData.marketName"
  205. :placeholder="t('common_add.marketPlaceholder')" />
  206. </el-form-item>
  207. <el-form-item :label="t('common_add.activity')" required prop="activity">
  208. <el-select v-model="addFormData.activity" :placeholder="t('common_add.activityPlaceholder')"
  209. filterable clearable>
  210. <el-option v-for="item in activityList" :key="item.id" :label="item.activityName"
  211. :value="item.id" />
  212. </el-select>
  213. </el-form-item>
  214. <el-form-item :label="t('common_add.productName')" required prop="goodsName">
  215. <ProductSelect ref="productSelectRef" v-model="addFormData.goodsName"></ProductSelect>
  216. </el-form-item>
  217. <el-form-item v-show="!isGold" :label="t('common_add.productNum')" required>
  218. <div style="display: flex;">
  219. <el-input style="padding-right: 30px; flex: 3;" v-model="addFormData.goodNum"
  220. :placeholder="t('common_add.productNumPlaceholder')" />
  221. <CurrencySelect v-model="addFormData.numUnit" :items="numUnitList" style="flex: 1.5;"
  222. :placeholder="t('common_add.numUnit')" @change="handleCurrencyChange" />
  223. </div>
  224. </el-form-item>
  225. <el-form-item v-show="isGold" label="金币数量" required>
  226. <div v-show="isGold" style="display: flex;">
  227. <div style=" display: flex; ">
  228. <span style="color: #999999; display: flex; white-space: nowrap;align-items: center;">{{
  229. t('common_add.permanentGold') }}</span>
  230. <el-input placeholder="0"
  231. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  232. v-model="addFormData.permanentGold" />
  233. </div>
  234. <div style="padding-right: 5px; display: flex;">
  235. <span style="color: #999999; display: flex; white-space: nowrap;align-items: center;">{{
  236. t('common_add.freeGold') }}</span>
  237. <el-input placeholder="0"
  238. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  239. v-model="addFormData.freeGold" />
  240. </div>
  241. </div>
  242. </el-form-item>
  243. <el-form-item :label="t('common_add.payCurrency')" required prop="paymentCurrency">
  244. <CurrencySelect v-model="addFormData.paymentCurrency" :items="customOptions"
  245. :placeholder="t('common_add.payCurrencyPlaceholder')" @change="handleCurrencyChange" />
  246. </el-form-item>
  247. <el-form-item :label="t('common_add.payAmount')" required prop="paymentAmount">
  248. <el-input v-model="addFormData.paymentAmount" :placeholder="t('common_add.payAmountPlaceholder')" />
  249. </el-form-item>
  250. <el-form-item :label="t('common_add.payMethod')" required prop="payType">
  251. <CurrencySelect v-model="addFormData.payType" :items="paytypeOptions"
  252. :placeholder="t('common_add.payMethodPlaceholder')" @change="ifGroup">
  253. </CurrencySelect>
  254. </el-form-item>
  255. <el-form-item :label="t('common_add.receiveArea')" prop="receivedMarket" v-show="!isGold">
  256. <CurrencySelect v-model="addFormData.receivedMarket" :items="MoneyAddressOptions"
  257. :disabled="isGroup" :placeholder="t('common_add.receiveAreaPlaceholder')">
  258. </CurrencySelect>
  259. </el-form-item>
  260. <el-form-item :label="t('common_add.receiveArea')" prop="receivedMarket" v-show="isGold">
  261. <div style="display: flex;">
  262. <CurrencySelect v-model="addFormData.receivedMarket" :items="MoneyAddressOptions"
  263. :placeholder="t('common_add.receiveAreaPlaceholder')"
  264. style="flex: 1; min-width: 100px;"
  265. :disabled="isGroup"
  266. @change="showWallet">
  267. </CurrencySelect>
  268. <CurrencySelect v-model="addFormData.receivedWallet" :items="MoneyWalletOptions"
  269. :placeholder="t('common_add.receiveWalletPlaceholder')"
  270. :disabled=" !selectWallet || isGroup "
  271. style="flex: 1; min-width: 100px; margin-left: 0.5vw;">
  272. </CurrencySelect>
  273. </div>
  274. </el-form-item>
  275. <el-form-item :label="t('common_add.payTime')" required prop="payTime">
  276. <el-date-picker type="datetime" placement="right" v-model="addFormData.payTime"
  277. :placeholder="t('common_add.payTimePlaceholder')" />
  278. </el-form-item>
  279. <el-form-item :label="t('common_add.transferVoucher')" prop="voucher">
  280. <div class="pic">
  281. <el-upload ref="uploadRef" class="uploader" :show-file-list="false" list-type="picture-card"
  282. :auto-upload="false" :before-upload="beforeUpload" :on-error="handelImgErr"
  283. :on-change="handleImageChange" :http-request="customUpload">
  284. <img v-if="addFormData.voucher" :src="addFormData.voucher" class="avatar"
  285. style="height: 100%; width: 100%; object-fit: cover;" />
  286. <el-icon v-else class="avatar-uploader-icon">
  287. <Plus />
  288. </el-icon>
  289. </el-upload>
  290. </div>
  291. </el-form-item>
  292. <el-form-item :label="t('common_add.remark')" prop="remark">
  293. <el-input v-model="addFormData.remark" type="textarea" :rows="4" maxlength="100" show-word-limit />
  294. </el-form-item>
  295. </el-form>
  296. <template #footer>
  297. <span class="dialog-footer">
  298. <el-button style="background-color: #7E91FF;" @click="closeAddForm">{{ t('common.cancel')
  299. }}</el-button>
  300. <el-button v-if="addOrEdit == 1" style="background-color: #2741DE; margin-left: 2.5vw;"
  301. type="primary" @click="throttledhandleAddForm" :disabled="ifAddDone">{{ t('common.confirm')
  302. }}</el-button>
  303. <el-button v-else-if="addOrEdit == 2" style="background-color: #2741DE; margin-left: 2.5vw;"
  304. type="primary" @click="throttledhandleEditForm" :disabled="ifReAddDone">{{ t('common.edit')
  305. }}</el-button>
  306. </span>
  307. </template>
  308. </el-dialog>
  309. <!-- 客服新增退款弹窗 -->
  310. <el-dialog v-model="refundDialog" :title="t('common_add.refund')" class="refundDialog" overflow draggable
  311. style="width: 40vw;" :before-close="closeRefundForm">
  312. <div style="display: flex;">
  313. <div class="left">
  314. <div class="add-item">
  315. <el-text style="width:4vw;">{{ t('common_add.jwcode') }}</el-text>
  316. <el-input v-model="refundFormData.jwcode" style="width:10vw;" disabled />
  317. </div>
  318. <div class="add-item">
  319. <el-text style="width:4vw;">{{ t('common_add.customerName') }}</el-text>
  320. <el-input v-model="refundFormData.name" style="width:10vw;" disabled />
  321. </div>
  322. <div class="add-item">
  323. <el-text style="width:4vw;">{{ t('common_add.market') }}</el-text>
  324. <el-input v-model="refundFormData.marketName" style="width:10vw;" disabled />
  325. </div>
  326. <div class="add-item">
  327. <el-text style="width:4vw;">{{ t('common_add.activity') }}</el-text>
  328. <el-input v-model="refundFormData.activity" style="width:10vw;" disabled />
  329. </div>
  330. <div class="add-item">
  331. <el-text style="width:4vw;">{{ t('common_add.productName') }}</el-text>
  332. <el-input v-model="refundFormData.goodsName" style="width:10vw;" disabled />
  333. </div>
  334. <div v-show="!isRefundGold" class="add-item">
  335. <el-text style="width:4vw;">{{ t('common_add.productNum') }}</el-text>
  336. <el-input style="padding-right: 10px; width:6.5vw;" v-model="refundFormData.goodNum"
  337. :placeholder="t('common_add.productNumPlaceholder')" disabled />
  338. <CurrencySelect disabled v-model="refundFormData.numUnit" :items="numUnitList"
  339. style="width: 3.5vw;" :placeholder="t('common_add.numUnit')"
  340. @change="handleCurrencyChange" />
  341. </div>
  342. <div v-show="isRefundGold" style="margin-bottom: 15px; ">
  343. <div style=" display: flex; ">
  344. <span
  345. style="color: #999999; display: flex; white-space: nowrap;align-items: center;width:4vw;">{{
  346. t('common_add.permanentGold') }}</span>
  347. <el-input style="padding-right: 10px; height: 30px; width: 110px; margin-bottom: 10px"
  348. v-model="refundFormData.permanentGold" disabled />
  349. </div>
  350. <div style="padding-right: 5px; display: flex;">
  351. <span
  352. style="color: #999999; display: flex; white-space: nowrap;align-items: center;width:4vw;">{{
  353. t('common_add.freeGold') }}</span>
  354. <el-input style="padding-right: 10px; height: 30px; width: 110px;"
  355. v-model="refundFormData.freeGold" disabled />
  356. </div>
  357. </div>
  358. <div class="add-item">
  359. <el-text style="width:4vw;">{{ t('common_add.payCurrency') }}</el-text>
  360. <el-input v-model="refundFormData.paymentCurrency" style="width:10vw;" disabled />
  361. </div>
  362. <div class="add-item">
  363. <el-text style="width:4vw;">{{ t('common_add.payAmount') }}</el-text>
  364. <el-input v-model="refundFormData.paymentAmount" style="width:10vw;" disabled />
  365. </div>
  366. <div class="add-item">
  367. <el-text style="width:4vw;">{{ t('common_add.payMethod') }}</el-text>
  368. <el-input v-model="refundFormData.payType" style="width:10vw;" disabled />
  369. </div>
  370. <div class="add-item">
  371. <el-text style="width:4vw;">{{ t('common_add.payTime') }}</el-text>
  372. <el-date-picker v-model="refundFormData.payTime" type="datetime" style="width:10vw;" disabled />
  373. </div>
  374. <div class="add-item">
  375. <el-text style="width:4vw;" size="small">{{ t('common_add.transferVoucher') }}</el-text>
  376. <el-form-item
  377. :rules="{ required: true, message: t('common_add.uploadPhoto'), trigger: 'change' }">
  378. <el-upload ref="uploadRef" :auto-upload="false" list-type="picture-card"
  379. :show-file-list="false">
  380. <template #default>
  381. <img v-if="refundFormData.voucher" :src="refundFormData.voucher"
  382. style="width: 100%; height: 100%; object-fit: cover;">
  383. <el-icon v-else>
  384. <Plus />
  385. </el-icon>
  386. </template>
  387. </el-upload>
  388. </el-form-item>
  389. </div>
  390. <div class="add-item">
  391. <el-text style="width:4vw;">{{ t('common_add.remark') }}</el-text>
  392. <el-input v-model="refundFormData.remark" style="width:10vw;" :rows="2" type="textarea"
  393. maxLength="100" disabled show-word-limit />
  394. </div>
  395. </div>
  396. <div class="right">
  397. <div class="add-item">
  398. <el-text style="width:4vw;">{{ t('common_add.refundModel') }}</el-text>
  399. <el-radio-group v-model="refundFormData.refundModel">
  400. <el-radio value="0">{{ t('common_add.refundModelAll') }}</el-radio>
  401. <el-radio value="1">{{ t('common_add.refundModelPart') }}</el-radio>
  402. </el-radio-group>
  403. </div>
  404. <div class="add-item"
  405. v-show="refundFormData.goodsName === t('cash.coinRecharge') && refundFormData.refundModel === '1'">
  406. <el-text style="width:4vw;">{{ t('common_add.permanentGold') }}</el-text>
  407. <el-input v-model="refundFormData.partRefundGold" style="width:5vw;" />&nbsp;&nbsp;
  408. </div>
  409. <div class="add-item"
  410. v-show="refundFormData.goodsName === t('cash.coinRecharge') && refundFormData.refundModel === '1'">
  411. <el-text style="width:4vw;">{{ t('common_add.freeGold') }}</el-text>
  412. <el-input v-model="refundFormData.partRefundFree" style="width:5vw;" />&nbsp;&nbsp;
  413. </div>
  414. <div class="add-item">
  415. <el-text style="width:4vw;">{{ t('common_add.refundReason') }}</el-text>
  416. <el-input v-model="refundFormData.refundReason" style="width:10vw;" :rows="5" maxlength="150"
  417. show-word-limit type="textarea" />
  418. </div>
  419. <div>{{ t('common_add.tip') }}</div>
  420. <div style="display:flex;justify-content: center;margin-top: 5vh;">
  421. <el-button type="default" @click="closeRefundForm">{{ t('common.cancel') }}</el-button>
  422. <el-button type="primary" @click="throttledsubmitRefund">{{ t('common.submit') }}</el-button>
  423. </div>
  424. </div>
  425. </div>
  426. </el-dialog>
  427. <!-- 查看驳回理由 -->
  428. <el-dialog :title="t('common_add.rejectReason')" v-model="rejectReasonVisible" width="50%" top="30vh"
  429. style="min-width: 200px; max-width: 500px;" :before-close="closeRejectForm">
  430. <div class="reject-reason-box">
  431. {{ rejectReason }}
  432. </div>
  433. <div class="rejectBtn">
  434. <el-button type="primary" @click="closeRejectForm">{{ t('common.confirm') }}</el-button>
  435. </div>
  436. </el-dialog>
  437. </div>
  438. </template>
  439. <script setup>
  440. import { ref, watch, onMounted, computed, nextTick } from 'vue';
  441. import { storeToRefs } from 'pinia';
  442. import { ElMessage, ElMessageBox } from 'element-plus'
  443. import API from '@/util/http.js'
  444. import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue'
  445. import ProductSelect from '@/components/MoneyManage/ProductSelect.vue'
  446. import { Plus } from '@element-plus/icons-vue'; // 补充图标导入(原代码遗漏)
  447. import request from '@/util/http.js'
  448. import moment from 'moment'
  449. import { useAdminStore } from '@/store/index.js'
  450. import { hasMenuPermission } from '@/utils/menuTreePermission.js'
  451. import _ from 'lodash'
  452. import { isNumber } from 'lodash'
  453. // 导入客服相关规则和静态数据
  454. import { addFormRule as getAddFormRule } from './utils/recriveFormRules.js'
  455. import { productList, MarketNameForId, CurrencyForId, marketList,statusList, normalizeSubmitterMarket, normalizeGoodsName, normalizePayType ,WalletForId } from './utils/staticData.js'
  456. import { selectAllWallets } from '@/api/common/common.js'
  457. // 国际化
  458. import { useI18n } from 'vue-i18n'
  459. const { t } = useI18n()
  460. const addFormRule = computed(() => getAddFormRule(t))
  461. // ===================== 基础状态管理(仅保留客服相关) =====================
  462. const adminStore = useAdminStore();
  463. const { menuTree } = storeToRefs(adminStore);
  464. const adminData = ref({}) // 管理员信息
  465. const tableData = ref([]) // 表格数据
  466. const tableRef = ref(null)
  467. const scrollTableTop = () => {
  468. tableRef.value?.setScrollTop?.(0)
  469. }
  470. const total = ref(0) // 总条数
  471. const pageInfo = ref({ pageSize: 10, pageNum: 1 }) // 分页信息
  472. const numUnitList = ref([t('cash.year'), t('cash.month')])
  473. // 筛选地区树
  474. const market = ref([])
  475. //防止重复点击状态管理
  476. const ifAddDone = ref(false)
  477. const ifReAddDone = ref(false)
  478. // 角色标识:固定为客服(删除财务、总部财务、超级管理员标识)
  479. const kefu = ref(true)
  480. const caiwu = ref(false)
  481. const HQcaiwu = ref(false)
  482. const superAdmin = ref(false)
  483. // ===================== 查询相关 =====================
  484. const searchData = ref({}) // 搜索参数
  485. const getTime = ref([]) // 时间范围
  486. const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] // 默认时间
  487. // 查询按钮
  488. const search = () => {
  489. getlist()
  490. }
  491. // 重置按钮
  492. const reset = () => {
  493. searchData.value = {}
  494. getTime.value = []
  495. // 重置页码
  496. pageInfo.value.pageNum = 1
  497. getlist()
  498. }
  499. const rejectReasonVisible = ref(false)
  500. const rejectReason = ref('')
  501. const closeRejectForm = () => {
  502. rejectReasonVisible.value = false
  503. }
  504. const openRejectReason = (reason) => {
  505. rejectReason.value = reason
  506. rejectReasonVisible.value = true
  507. }
  508. // 时间选择器变更(原代码声明未实现,保留空函数避免报错)
  509. const handleDatePickerChange = () => { }
  510. // 日期禁用(原代码声明未实现,保留空函数避免报错)
  511. const disabledDate = () => { }
  512. // 表格排序(原代码声明未实现,保留空函数避免报错)
  513. const handleSortChange = () => { }
  514. // 获取表格数据(仅保留客服角色逻辑)
  515. const getlist = async () => {
  516. try {
  517. let payCurrencySelect = ''
  518. let goodsName = ''
  519. // 处理时间范围
  520. if (getTime.value && getTime.value.length === 2) {
  521. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss')
  522. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss')
  523. } else {
  524. searchData.value.startTime = ''
  525. searchData.value.endTime = ''
  526. }
  527. // 处理产品名称(级联选择器取最后一级)
  528. if (searchData.value.goodsName) {
  529. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1]
  530. }
  531. // 处理付款币种
  532. if (searchData.value.paymentCurrency) {
  533. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency)
  534. }
  535. // 客服角色固定参数:cashRoleId=0,无到账地区筛选
  536. const cashRoleId = '0'
  537. const receivedMarket = ''
  538. // 地区处理
  539. if (searchData.value.markets) {
  540. searchData.value.market = searchData.value.markets[searchData.value.markets.length - 1]
  541. } else {
  542. searchData.value.market = ''
  543. }
  544. if (searchData.value.jwcode) {
  545. const isPositiveInteger = /^[1-9]\d*$/.test(searchData.value.jwcode);
  546. if (!isPositiveInteger) {
  547. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  548. return;
  549. }
  550. // 添加精网号长度验证
  551. if (searchData.value.jwcode.length > 8) {
  552. ElMessage.error(t('elmessage.limitJwcodeLength'))
  553. return;
  554. }
  555. }
  556. // if (searchData.value.jwcode && !isNumber(searchData.value.jwcode)) {
  557. // ElMessage.error('精网号只能是数字')
  558. // return
  559. // }
  560. const result = await request({
  561. url: '/cashCollection/selectCollection',
  562. data: {
  563. ...pageInfo.value,
  564. cashCollection: {
  565. ...searchData.value,
  566. ...getTime.value,
  567. submitterId: adminData.value.id,
  568. receivedMarket: MarketNameForId(receivedMarket),
  569. cashRoleId: cashRoleId,
  570. paymentCurrency: payCurrencySelect,
  571. submitterMarket: normalizeSubmitterMarket(adminData.value.markets),
  572. goodsName: goodsName,
  573. market: MarketNameForId(searchData.value.market)
  574. }
  575. }
  576. })
  577. if (result.code == 200) {
  578. tableData.value = result.data.list
  579. await nextTick()
  580. scrollTableTop()
  581. total.value = result.data.total
  582. } else {
  583. ElMessage.error(t('elmessage.dataException'))
  584. console.log(result.msg);
  585. }
  586. } catch (error) {
  587. console.log(error);
  588. }
  589. }
  590. // ===================== 分页相关 =====================
  591. const handlePagination = (type, val) => {
  592. if (type === 'size') {
  593. pageInfo.value.pageSize = val
  594. } else {
  595. pageInfo.value.pageNum = val
  596. }
  597. getlist()
  598. }
  599. // ===================== 客服新增/编辑收款弹窗 =====================
  600. const addFormisible = ref(false) // 弹窗显隐
  601. const addFormData = ref({ name: '', market: '', goodsName: '' , receivedWallet:'' }) // 表单数据
  602. const addFormRef = ref(null) // 表单引用
  603. const addOrEdit = ref(0) // 1=新增,2=编辑
  604. const isGold = ref(false) // 是否为金币充值产品
  605. const productSelectRef = ref(null) // 产品选择器引用
  606. const uploadRef = ref(null) // 上传组件引用
  607. // 产品选择变更:判断是否为金币充值
  608. const ifGold = () => {
  609. if (addFormData.value.goodsName === t('cash.coinRecharge')) {
  610. isGold.value = true
  611. addFormData.value.goodNum = 0
  612. } else {
  613. isGold.value = false
  614. console.log('12312312',addFormData.value.goodsName);
  615. numUnitList.value = [t('cash.unit'), t('cash.year'), t('cash.month')]
  616. const selectItems = ref([
  617. t('cash.aiService.aiTracking'),
  618. t('cash.aiService.aiAttack'),
  619. t('cash.aiService.aiFunds'),
  620. t('cash.aiService.aiActivity'),
  621. t('cash.aiService.superPerspective'),
  622. t('cash.aiService.superAmbush'),
  623. t('cash.aiService.superHunting'),
  624. t('cash.aiService.superPulse'),
  625. t('cash.aiService.superCompass'),
  626. t('cash.aiService.aiDetectionTool'),
  627. t('cash.aiService.superDetectionTool'),
  628. t('cash.aiService.HCInfoFeeDelayUS'),
  629. t('cash.aiService.HCInfoFeeDelayHK'),
  630. t('cash.aiService.HCInfoFeeDelayAStock'),
  631. t('cash.aiService.HCInfoFeeDelaySingaporeStock'),
  632. t('cash.aiService.HCInfoFeeDelayJapanStock'),
  633. t('cash.aiService.HCInfoFeeDelayThailandStock'),
  634. t('cash.aiService.HCInfoFeeDelayIndonesiaStock'),
  635. t('cash.aiService.HCInfoFeeDelayVietnamStock'),
  636. t('cash.aiService.HCInfoFeeDelayKoreaStock'),
  637. t('cash.aiService.HCInfoFeeDelayTaiwanStock'),
  638. t('cash.aiService.HCInfoFeeRealTimeUS'),
  639. t('cash.aiService.HCInfoFeeRealTimeHK'),
  640. t('cash.aiService.HCInfoFeeRealTimeAStock'),
  641. t('cash.aiService.HCInfoFeeRealTimeSingaporeStock'),
  642. t('cash.aiService.HCInfoFeeRealTimeJapanStock'),
  643. t('cash.aiService.HCInfoFeeRealTimeThailandStock'),
  644. t('cash.aiService.HCInfoFeeRealTimeIndonesiaStock'),
  645. t('cash.aiService.HCInfoFeeRealTimeVietnamStock'),
  646. t('cash.aiService.HCInfoFeeRealTimeKoreaStock'),
  647. t('cash.aiService.HCInfoFeeRealTimeTaiwanStock'),
  648. ])
  649. if (selectItems.value.includes(addFormData.value.goodsName)) {
  650. if (addOrEdit.value == 1) {
  651. addFormData.value.numUnit = ''
  652. }
  653. numUnitList.value = [t('cash.year'), t('cash.month')]
  654. } else if (addFormData.value.goodsName == t('cash.staticInfoFee')) {
  655. addFormData.value.numUnit = t('cash.year')
  656. numUnitList.value = [t('cash.year')]
  657. } else {
  658. addFormData.value.numUnit = t('cash.unit')
  659. numUnitList.value = [t('cash.unit')]
  660. }
  661. }
  662. }
  663. watch(() => addFormData.value.goodsName, () => {
  664. ifGold()
  665. })
  666. // 支付方式变更:判断是否为默认归属平台
  667. const isGroup = ref(false)
  668. const selectWallet=ref(false)
  669. const ifGroup = () => {
  670. addFormData.value.receivedMarket=''
  671. addFormData.value.receivedWallet=''
  672. if (addFormData.value.payType === t('cash.payMethods.stripe') || addFormData.value.payType === t('cash.payMethods.paymentAsia')) {
  673. isGroup.value = true
  674. addFormData.value.receivedMarket = t('cash.markets.HongKong')
  675. addFormData.value.receivedWallet=t('cash.wallet.HongKongWallet')
  676. } else if (addFormData.value.payType === t('cash.payMethods.ipay88')) {
  677. isGroup.value = true
  678. addFormData.value.receivedMarket = t('cash.markets.Malaysia')
  679. addFormData.value.receivedWallet=t('cash.wallet.MalaysiaWallet')
  680. } else if (addFormData.value.payType === t('cash.payMethods.transfer')) {
  681. isGroup.value = true
  682. addFormData.value.receivedMarket = t('cash.markets.Canada')
  683. addFormData.value.receivedWallet=t('cash.wallet.CanadaWallet')
  684. } else if (addFormData.value.payType === t('cash.payMethods.grabpay') || addFormData.value.payType === t('cash.payMethods.nets') || addFormData.value.payType === t('cash.payMethods.paypal')) {
  685. isGroup.value = true
  686. addFormData.value.receivedMarket = t('cash.markets.Singapore')
  687. addFormData.value.receivedWallet=t('cash.wallet.SingaporeCMWallet')
  688. }else if (addFormData.value.payType === t('cash.payMethods.paysolution')) {
  689. isGroup.value = true
  690. addFormData.value.receivedMarket = t('cash.markets.Thailand')
  691. addFormData.value.receivedWallet=t('cash.wallet.ThailandHAWallet')
  692. } else if (addFormData.value.payType === t('cash.payMethods.stripe2')) {
  693. isGroup.value = true
  694. addFormData.value.receivedMarket = t('cash.markets.Singapore')
  695. addFormData.value.receivedWallet=t('cash.wallet.SingaporeHCWallet')
  696. } else {
  697. isGroup.value = false
  698. selectWallet.value = true
  699. }
  700. }
  701. //选择地区之后 钱包下拉框显示对应地区的钱包
  702. const MoneyWalletOptions=ref([])
  703. const showWallet =(receivedMarket)=>{
  704. MoneyWalletOptions.value=[]
  705. addFormData.value.receivedWallet=''
  706. if(receivedMarket===t('cash.markets.HongKong')){
  707. selectWallet.value=false
  708. addFormData.value.receivedWallet=t('cash.wallet.HongKongWallet')
  709. }else if(receivedMarket===t('cash.markets.Malaysia')){
  710. selectWallet.value=false
  711. addFormData.value.receivedWallet=t('cash.wallet.MalaysiaWallet')
  712. }else if(receivedMarket===t('cash.markets.Singapore')){
  713. selectWallet.value=true
  714. MoneyWalletOptions.value.push(t('cash.wallet.SingaporeCMWallet'))
  715. MoneyWalletOptions.value.push(t('cash.wallet.SingaporeHCWallet'))
  716. }else if(receivedMarket===t('cash.markets.Thailand')){
  717. selectWallet.value=true
  718. MoneyWalletOptions.value.push(t('cash.wallet.ThailandHSWallet'))
  719. MoneyWalletOptions.value.push(t('cash.wallet.ThailandHAWallet'))
  720. }else if(receivedMarket===t('cash.markets.VietnamHCM')){
  721. selectWallet.value=false
  722. addFormData.value.receivedWallet=t('cash.wallet.VietnamHCMWallet')
  723. }else if(receivedMarket===t('cash.markets.Canada') ){
  724. selectWallet.value=false
  725. addFormData.value.receivedWallet=t('cash.wallet.CanadaWallet')
  726. }else if(receivedMarket===t('cash.markets.Beijing')){
  727. selectWallet.value=false
  728. addFormData.value.receivedWallet=t('cash.wallet.BeijingWallet')
  729. }
  730. }
  731. //失焦和回车查询仅选一个
  732. const jwcodeQueriedInFocus = ref(false)
  733. const handleJwcodeFocus = () => {
  734. jwcodeQueriedInFocus.value = false
  735. }
  736. const handleJwcodeEnter = () => {
  737. jwcodeQueriedInFocus.value = true
  738. jwcodeSeachMarket()
  739. }
  740. const handleJwcodeBlur = () => {
  741. if (jwcodeQueriedInFocus.value) return
  742. jwcodeQueriedInFocus.value = true
  743. jwcodeSeachMarket()
  744. }
  745. // 精网号失焦:查询客户姓名和地区
  746. const jwcodeSeachMarket = async () => {
  747. try {
  748. const jwcode = String(addFormData.value.jwcode ?? '').replace(/\s/g, '')
  749. addFormData.value.jwcode = jwcode
  750. if (!jwcode) {
  751. ElMessage.warning(t('elmessage.noEmptyJwcode'))
  752. return
  753. }
  754. if (!/^[1-9]\d*$/.test(jwcode)) {
  755. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  756. return
  757. }
  758. if (jwcode.length > 8) {
  759. ElMessage.error(t('elmessage.limitJwcodeLength'))
  760. return
  761. }
  762. const result = await request({
  763. url: '/cashCollection/getNameAndMarket',
  764. data: jwcode
  765. })
  766. if (result.code == 200 && result.data && Object.keys(result.data).length > 0) {
  767. ElMessage.success(t('elmessage.customerSuccess'))
  768. addFormData.value.market = result.data.market
  769. addFormData.value.marketName = result.data.marketName
  770. addFormData.value.name = result.data.name
  771. } else if (result.code == 0) {
  772. const region = result.data && result.data.market
  773. if (region) {
  774. ElMessage.info({
  775. message: t('elmessage.userRegionHint', { region }),
  776. customClass: 'custom-blue-message'
  777. })
  778. return
  779. }
  780. ElMessage.error(t('elmessage.customerNotExist'))
  781. } else {
  782. ElMessage.error(t('elmessage.customerNotExist'))
  783. }
  784. } catch (error) {
  785. console.log(error);
  786. }
  787. }
  788. // 打开新增/编辑弹窗
  789. const openAddForm = (row) => {
  790. productSelectRef.value?.resetSelect();
  791. if (row?.jwcode) {
  792. // 编辑模式
  793. addOrEdit.value = 2
  794. addFormData.value = {
  795. ...row,
  796. receivedWallet: walletList.value.find(item => item.id == row.walletId)?.walletName || ''
  797. }
  798. console.log('这是编辑数据:', addFormData.value);
  799. jwcodeSeachMarket()
  800. ifGold()
  801. } else {
  802. // 新增模式
  803. addOrEdit.value = 1
  804. addFormData.value = { goodsName: '' }
  805. }
  806. addFormisible.value = true
  807. }
  808. // 关闭新增/编辑弹窗
  809. const closeAddForm = () => {
  810. addFormisible.value = false
  811. addFormData.value = {}
  812. addOrEdit.value = 0
  813. isGold.value = false
  814. addFormRef.value?.resetFields();
  815. }
  816. const testGold = () => {
  817. // 转换为数字(处理字符串类型的数字)
  818. if (addFormData.value.goodsName == t('cash.coinRecharge')) {
  819. if (addFormData.value.permanentGold == null) {
  820. addFormData.value.permanentGold = 0
  821. }
  822. if (addFormData.value.freeGold == null) {
  823. addFormData.value.freeGold = 0
  824. }
  825. const permanentGold = Number(addFormData.value.permanentGold);
  826. const freeNum = Number(addFormData.value.freeGold);
  827. // 正则:仅允许0-999999的正整数(包括0)
  828. const reg = /^[0-9]{1,6}$/;
  829. if (!reg.test(permanentGold) || permanentGold < 0) {
  830. return { valid: false, message: t('elmessage.checkPermanentFormat') };
  831. }
  832. if (!reg.test(freeNum) || freeNum < 0) {
  833. return { valid: false, message: t('elmessage.checkFreeFormat') };
  834. }
  835. if (permanentGold == 0 && freeNum == 0) {
  836. return { valid: false, message: t('elmessage.permanentAndFreeNoZero') };
  837. }
  838. }
  839. return { valid: true };
  840. }
  841. // 客服新增收款
  842. const handleAddForm = async () => {
  843. try {
  844. await addFormRef.value.validate();
  845. if (!testGold().valid) {
  846. ElMessage.error(testGold().message);
  847. return;
  848. }
  849. //单独校验产品数量
  850. if (!isGold.value) {
  851. if (!addFormData.value.goodNum) {
  852. ElMessage.error(t('elmessage.checkProductNum'));
  853. return;
  854. }
  855. const positiveIntReg = /^[1-9]\d*$/;
  856. if (!positiveIntReg.test(addFormData.value.goodNum)) {
  857. ElMessage.error(t('elmessage.productNumError'));
  858. return;
  859. }
  860. }
  861. if ( !isGold.value && addFormData.value.numUnit == '') {
  862. ElMessage.error(t('elmessage.checkNumUnit'));
  863. return;
  864. }
  865. if (addFormData.value.goodsName == t('cash.coinRecharge')) {
  866. if (addFormData.value.permanentGold == null || addFormData.value.permanentGold == 0) {
  867. ElMessage.error(t('elmessage.checkPermanentGold'));
  868. return;
  869. }
  870. }
  871. // 处理时间格式
  872. if (addFormData.value.payTime) {
  873. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  874. }
  875. ifAddDone.value = true
  876. const result = await request({
  877. url: '/cashCollection/add',
  878. data: {
  879. ...addFormData.value,
  880. goodsName: normalizeGoodsName(addFormData.value.goodsName),
  881. payType: normalizePayType(addFormData.value.payType),
  882. submitterId: adminData.value.id,
  883. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  884. freeGold: (addFormData.value.freeGold || 0) * 100,
  885. goodNum: addFormData.value.goodNum || addFormData.value.permanentGold || 0,
  886. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  887. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  888. paymentAmount: (addFormData.value.paymentAmount) * 100,
  889. submitterMarket: normalizeSubmitterMarket(adminData.value.markets),
  890. ...(isGold. value ? {
  891. walletId:WalletForId(addFormData.value.receivedWallet)
  892. } : {})
  893. }
  894. })
  895. if (result.code == 200) {
  896. ElMessage.success(t('elmessage.addSuccess'))
  897. getlist()
  898. closeAddForm()
  899. }
  900. ifAddDone.value = false
  901. } catch (error) {
  902. console.log('新增报错:', error);
  903. ElMessage.error(t('elmessage.checkFormInfoSubmit'));
  904. ifAddDone.value = false
  905. }
  906. }
  907. // 客服编辑收款(撤回后重新提交)
  908. const handleEditForm = async () => {
  909. try {
  910. await addFormRef.value.validate();
  911. if (!testGold().valid) {
  912. ElMessage.error(testGold().message);
  913. return;
  914. }
  915. if (typeof addFormData.value.activity == 'string') {
  916. console.log('转换前:', addFormData.value.activity);
  917. addFormData.value.activity = activityList.value.find(item => item.activityName === addFormData.value.activity).id
  918. }
  919. //单独校验产品数量
  920. if (!isGold.value) {
  921. if (!addFormData.value.goodNum) {
  922. ElMessage.error(t('elmessage.checkProductNum'));
  923. return;
  924. }
  925. const positiveIntReg = /^[1-9]\d*$/;
  926. if (!positiveIntReg.test(addFormData.value.goodNum)) {
  927. ElMessage.error(t('elmessage.productNumError'));
  928. return;
  929. }
  930. }
  931. if (!isGold.value && addFormData.value.numUnit == '') {
  932. ElMessage.error(t('elmessage.checkNumUnit'));
  933. return;
  934. }
  935. // 时间格式
  936. if (addFormData.value.payTime) {
  937. addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss')
  938. }
  939. ifReAddDone.value = true
  940. const result = await request({
  941. url: '/cashCollection/reSubmit',
  942. data: {
  943. ...addFormData.value,
  944. submitterId: adminData.value.id,
  945. permanentGold: (addFormData.value.permanentGold || 0) * 100,
  946. freeGold: (addFormData.value.freeGold || 0) * 100,
  947. goodNum: addFormData.value.goodNum || 0,
  948. paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '',
  949. receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '',
  950. paymentAmount: (addFormData.value.paymentAmount) * 100,
  951. }
  952. })
  953. if (result.code == 200) {
  954. ElMessage.success(t('elmessage.editSuccess'))
  955. getlist()
  956. closeAddForm()
  957. }
  958. ifReAddDone.value = false
  959. } catch (error) {
  960. console.log(error);
  961. ifReAddDone.value = false
  962. }
  963. }
  964. // 付款币种和支付方式选项(客服专用)
  965. const customOptions = ref([
  966. t('cash.currency.usd'), // 美元(USD)
  967. t('cash.currency.hkd'), // 港币(HKD)
  968. t('cash.currency.sgd'), // 新币(SGD)
  969. t('cash.currency.myr'), // 马币(MYR)
  970. t('cash.currency.thb'), // 泰铢(THB)
  971. t('cash.currency.cad'), // 加币(CAD)
  972. t('cash.currency.vnd'), // 越南盾(VND)
  973. t('cash.currency.krw'), // 韩元(KRW)
  974. t('cash.currency.rmb'), // 人民币(CNY)
  975. ])
  976. // 支付类型选项 - 使用cash.payMethods下的键名
  977. const paytypeOptions = ref([
  978. t('cash.payMethods.stripe'), // Stripe
  979. t('cash.payMethods.paymentAsia'), // PaymentAsia
  980. t('cash.payMethods.stripe2'), // Stripe2
  981. t('cash.payMethods.ipay88'), // Ipay88
  982. t('cash.payMethods.grabpay'), // Grabpay
  983. t('cash.payMethods.nets'), // Nets
  984. t('cash.payMethods.transfer'), // E-Transfer
  985. t('cash.payMethods.paypal'), // PayPal
  986. t('cash.payMethods.paysolution'), // Paysolution
  987. t('cash.payMethods.bankTransfer'),// 银行转账
  988. t('cash.payMethods.card'), // 刷卡
  989. t('cash.payMethods.cash'), // 现金
  990. t('cash.payMethods.check'), // 支票
  991. ])
  992. const MoneyAddressOptions = ref([
  993. t('cash.markets.Malaysia'), // 马来西亚
  994. t('cash.markets.HongKong'), // 香港
  995. t('cash.markets.Singapore'), // 新加坡
  996. t('cash.markets.Thailand'), // 泰国
  997. t('cash.markets.VietnamHCM'), // 越南HCM
  998. t('cash.markets.Canada'), // 加拿大
  999. // t('cash.markets.Beijing') // 北京
  1000. ])
  1001. const handleCurrencyChange = (option) => {
  1002. console.log('选中的币种:', option);
  1003. };
  1004. // 图片上传相关
  1005. const handleImgSuccess = (response) => {
  1006. try {
  1007. addFormData.value.voucher = response.data.url
  1008. } catch (error) {
  1009. ElMessage.error(response.msg || t('elmessage.uploadFailed'))
  1010. }
  1011. }
  1012. const handelImgErr = (err) => {
  1013. console.log(err);
  1014. addFormData.value.imageUrl = null
  1015. ElMessage.error(t('elmessage.uploadFailed'))
  1016. }
  1017. const beforeUpload = (rawFile) => {
  1018. if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/png') {
  1019. ElMessage.error(t('elmessage.photoFormatError'))
  1020. return false
  1021. } else if (rawFile.size / 1024 / 1024 > 2) {
  1022. ElMessage.error(t('elmessage.limitImageSize2MB'))
  1023. return false
  1024. }
  1025. return true
  1026. }
  1027. const handleImageChange = (file) => {
  1028. uploadRef.value.submit()
  1029. }
  1030. const customUpload = async (options) => {
  1031. try {
  1032. const formData = new FormData()
  1033. formData.append('file', options.file)
  1034. const response = await API({
  1035. url: 'https://api.homilychart.com/hljw/api/aws/upload',
  1036. method: 'POST',
  1037. data: formData,
  1038. headers: { 'Content-Type': 'multipart/form-data' }
  1039. })
  1040. if (response.code === 200 && response.data) {
  1041. handleImgSuccess(response, options.file)
  1042. ElMessage.success(t('elmessage.uploadSuccess'))
  1043. } else {
  1044. options.onError(response)
  1045. ElMessage.error(response.msg || t('elmessage.uploadFailed'))
  1046. }
  1047. } catch (error) {
  1048. console.error('上传错误:', error)
  1049. ElMessage.error(t('elmessage.uploadFailed') + `: ${error.msg || error.message || t('elmessage.inNetworkError')}`)
  1050. }
  1051. }
  1052. // 图片预览
  1053. const previewImage = (imageUrl) => {
  1054. const imageElement = document.createElement('img');
  1055. imageElement.src = imageUrl;
  1056. imageElement.style.maxWidth = '80vw';
  1057. imageElement.style.maxHeight = '80vh';
  1058. const viewer = document.createElement('div');
  1059. viewer.style.position = 'fixed';
  1060. viewer.style.top = '0';
  1061. viewer.style.left = '0';
  1062. viewer.style.width = '100vw';
  1063. viewer.style.height = '100vh';
  1064. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  1065. viewer.style.display = 'flex';
  1066. viewer.style.justifyContent = 'center';
  1067. viewer.style.alignItems = 'center';
  1068. viewer.style.zIndex = '9999';
  1069. viewer.style.overflow = 'auto';
  1070. viewer.appendChild(imageElement);
  1071. document.body.appendChild(viewer);
  1072. viewer.addEventListener('click', () => {
  1073. document.body.removeChild(viewer);
  1074. });
  1075. };
  1076. // ===================== 客服退款/撤回相关 =====================
  1077. // 撤回弹窗
  1078. const textContent = ref('')
  1079. const recallDialog = ref(false)
  1080. const RecallNum = ref('')
  1081. // 退款确认弹窗
  1082. const refundConfirmDialog = ref(false)
  1083. const refundDialog = ref(false) // 退款详情弹窗
  1084. const refundFormData = ref({}) // 退款表单数据
  1085. const isRefundGold = ref(false) // 退款产品是否为金币
  1086. // 判断退款产品类型
  1087. const ifRefundGold = () => {
  1088. if (refundFormData.value.goodsName === t('cash.coinRecharge')) {
  1089. isRefundGold.value = true
  1090. refundFormData.value.goodNum = 0
  1091. } else {
  1092. isRefundGold.value = false
  1093. }
  1094. }
  1095. // 打开撤回/退款确认弹窗
  1096. const openConfirm = (val, row) => {
  1097. if (val === 'refund') {
  1098. textContent.value = t('common.willRefundOrder')
  1099. refundFormData.value = { ...row }
  1100. console.log('退款表单数据:', refundFormData.value);
  1101. ifRefundGold()
  1102. refundConfirmDialog.value = true
  1103. } else if (val === 'recall') {
  1104. textContent.value = t('common.willRecallOrder')
  1105. recallDialog.value = true
  1106. RecallNum.value = row.orderCode
  1107. }
  1108. }
  1109. // 关闭撤回弹窗
  1110. const closeRecall = () => {
  1111. recallDialog.value = false
  1112. textContent.value = ''
  1113. RecallNum.value = ''
  1114. }
  1115. // 执行撤回
  1116. const handleRecall = async () => {
  1117. try {
  1118. const result = await request({
  1119. url: '/cashCollection/cancel',
  1120. data: { orderCode: RecallNum.value }
  1121. })
  1122. if (result.code == 200) {
  1123. ElMessage.success(t('elmessage.withdrawSuccess'))
  1124. getlist()
  1125. closeRecall()
  1126. }
  1127. } catch (error) {
  1128. console.log(error);
  1129. }
  1130. }
  1131. // 关闭退款确认弹窗
  1132. const closeConfirmRefund = () => {
  1133. refundConfirmDialog.value = false
  1134. textContent.value = ''
  1135. }
  1136. // 打开退款详情弹窗
  1137. const openRefundDialog = () => {
  1138. refundDialog.value = true
  1139. closeConfirmRefund()
  1140. }
  1141. // 关闭退款详情弹窗
  1142. const closeRefundForm = () => {
  1143. refundDialog.value = false
  1144. refundFormData.value = {}
  1145. }
  1146. // 提交退款
  1147. const submitRefund = async () => {
  1148. try {
  1149. if (refundFormData.value.refundModel == 0) {
  1150. refundFormData.value.partRefundGold = refundFormData.value.permanentGold,
  1151. refundFormData.value.partRefundFree = refundFormData.value.freeGold
  1152. } else if (refundFormData.value.refundModel == 1) {
  1153. if (refundFormData.value.partRefundGold > refundFormData.value.permanentGold || refundFormData.value.partRefundFree > refundFormData.value.freeGold) {
  1154. ElMessage.error(t('elmessage.limitRefundAmount'))
  1155. return
  1156. }
  1157. }
  1158. // 添加精网号验证
  1159. if (refundFormData.value.jwcode) {
  1160. const isPositiveInteger = /^[1-9]\d*$/.test(refundFormData.value.jwcode);
  1161. if (!isPositiveInteger) {
  1162. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  1163. return;
  1164. }
  1165. if (refundFormData.value.jwcode.length > 8) {
  1166. ElMessage.error(t('elmessage.limitJwcodeLength'))
  1167. return;
  1168. }
  1169. }
  1170. const result = await request({
  1171. url: '/Money/add',
  1172. data: {
  1173. jwcode: refundFormData.value.jwcode,
  1174. name: refundFormData.value.name,
  1175. market: normalizeSubmitterMarket(refundFormData.value.marketName),
  1176. submitterId: adminData.value.id,
  1177. submitterMarket: normalizeSubmitterMarket(adminData.value.markets),
  1178. remark: refundFormData.value.remark,
  1179. refundReason: refundFormData.value.refundReason,
  1180. refundModel: refundFormData.value.refundModel,
  1181. receivedMarket: normalizeSubmitterMarket(refundFormData.value.receivedMarket),
  1182. originalOrderId: refundFormData.value.id,
  1183. orderCode: refundFormData.value.orderCode,
  1184. permanentGold: (refundFormData.value.permanentGold) * 100 || 0,
  1185. freeGold: (refundFormData.value.freeGold) * 100 || 0,
  1186. partRefundGold: (refundFormData.value.partRefundGold) * 100 || 0,
  1187. partRefundFree: (refundFormData.value.partRefundFree) * 100 || 0,
  1188. handlingCharge: (refundFormData.value.handlingCharge) * 100 || 0,
  1189. payType: refundFormData.value.payType,
  1190. walletId: refundFormData.value.walletId
  1191. }
  1192. })
  1193. if (result.code == 200) {
  1194. ElMessage.success(t('elmessage.addRefundSuccess'))
  1195. getlist()
  1196. closeRefundForm()
  1197. } else {
  1198. ElMessage.error(result.msg)
  1199. }
  1200. } catch (error) {
  1201. console.log(error);
  1202. }
  1203. }
  1204. // ===================== 初始化与节流 =====================
  1205. // 节流处理(防止重复提交)
  1206. const throttledhandleAddForm = _.throttle(handleAddForm, 5000, { trailing: false })
  1207. const throttledhandleEditForm = _.throttle(handleEditForm, 5000, { trailing: false })
  1208. const throttledsubmitRefund = _.throttle(submitRefund, 5000, { trailing: false })
  1209. // 活动列表(客服需要)
  1210. const activityList = ref([])
  1211. const getActivitys = async () => {
  1212. try {
  1213. const result = await API({ url: '/cashCollection/getActivityList', data: {} })
  1214. if (result.code == 200) {
  1215. activityList.value = result.data
  1216. } else {
  1217. ElMessage.error(t('elmessage.activityLoadFailed'))
  1218. }
  1219. } catch (error) {
  1220. console.log('活动列表请求失败', error)
  1221. }
  1222. }
  1223. // 获取管理员信息
  1224. const getAdminData = async () => {
  1225. try {
  1226. const result = await API({ url: '/admin/userinfo', data: {} })
  1227. adminData.value = result
  1228. } catch (error) {
  1229. console.log('管理员信息请求失败', error)
  1230. }
  1231. }
  1232. // 支付方式列表(表格筛选用)
  1233. // 支付类型列表 - 使用cash.payMethods下的键名,保持与原始数组完全一致的顺序
  1234. const paytypeList = ref([
  1235. t('cash.payMethods.stripe'), // Stripe
  1236. t('cash.payMethods.paymentAsia'), // PaymentAsia
  1237. t('cash.payMethods.stripe2'), // Stripe2
  1238. t('cash.payMethods.ipay88'), // Ipay88
  1239. t('cash.payMethods.grabpay'), // Grabpay
  1240. t('cash.payMethods.nets'), // Nets
  1241. t('cash.payMethods.transfer'), // E-Transfer
  1242. t('cash.payMethods.paypal'), // PayPal
  1243. t('cash.payMethods.paysolution'), // Paysolution
  1244. t('cash.payMethods.bankTransfer'),// 银行转账
  1245. t('cash.payMethods.card'), // 刷卡
  1246. t('cash.payMethods.cash'), // 现金
  1247. t('cash.payMethods.check'), // 支票
  1248. ])
  1249. const getMarket = async function () {
  1250. try {
  1251. const result = await API({
  1252. url: '/market/selectMarket',
  1253. })
  1254. console.log('看看地区树', result)
  1255. const transformTree = (nodes) => {
  1256. const allChildren = nodes.flatMap(node => node.children || []);
  1257. return allChildren.map(child => {
  1258. const grandchildren = child.children && child.children.length
  1259. ? transformTree([child])
  1260. : null;
  1261. return {
  1262. value: child.id,
  1263. label: child.name,
  1264. children: grandchildren
  1265. };
  1266. });
  1267. };
  1268. market.value = transformTree(result.data)
  1269. console.log('转换后的地区树==============', market.value)
  1270. } catch (error) {
  1271. console.log('请求失败', error)
  1272. }
  1273. }
  1274. const walletList = ref([])
  1275. const getWalletList = async () => {
  1276. try {
  1277. const result = await selectAllWallets()
  1278. if (result.code == 200) {
  1279. walletList.value = result.data
  1280. }
  1281. } catch (error) {
  1282. console.log('钱包列表请求失败', error)
  1283. }
  1284. }
  1285. // 初始化
  1286. onMounted(async () => {
  1287. await getAdminData()
  1288. await getActivitys()
  1289. // 客服角色默认加载列表
  1290. getlist()
  1291. await getMarket()
  1292. await getWalletList()
  1293. })
  1294. </script>
  1295. <style scoped lang="scss">
  1296. .content {
  1297. height: 100%;
  1298. width: 80vw;
  1299. .card1 {
  1300. width: 100%;
  1301. background: #F3FAFE;
  1302. .row {
  1303. height: 4vh;
  1304. width: 80vw;
  1305. display: flex;
  1306. min-height: 40px;
  1307. .rowItem {
  1308. display: flex;
  1309. width: 15vw;
  1310. align-items: center;
  1311. justify-content: center;
  1312. margin-right: 0.5vw;
  1313. }
  1314. .buttons {
  1315. display: flex;
  1316. justify-content: center;
  1317. align-items: center;
  1318. margin-left: 10px;
  1319. }
  1320. }
  1321. }
  1322. .div-card2 {
  1323. width: 100%;
  1324. margin-top: 2vh;
  1325. .btns {
  1326. display: flex;
  1327. align-items: center;
  1328. justify-content: space-between;
  1329. padding-bottom: 10px;
  1330. .btnAdd {
  1331. padding-left: 10px;
  1332. }
  1333. .info-tooltip {
  1334. display: flex;
  1335. align-items: center;
  1336. }
  1337. .service-icon {
  1338. color: #666;
  1339. cursor: pointer;
  1340. font-size: 18px;
  1341. transition: all 0.3s ease;
  1342. padding: 4px;
  1343. border-radius: 50%;
  1344. }
  1345. }
  1346. .table {
  1347. margin: 10px;
  1348. border-radius: 20px;
  1349. .ellipsis-container {
  1350. position: relative;
  1351. width: 100%;
  1352. .ellipsis-text {
  1353. display: inline-block;
  1354. width: 100%;
  1355. white-space: nowrap;
  1356. overflow: hidden;
  1357. text-overflow: ellipsis;
  1358. cursor: pointer;
  1359. }
  1360. .custom-tooltip {
  1361. position: fixed;
  1362. z-index: 9999;
  1363. padding: 8px 12px;
  1364. width: 200px;
  1365. background-color: #E4F0FC;
  1366. color: #333333;
  1367. border: 1px solid #e5e7eb;
  1368. border-radius: 4px;
  1369. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  1370. min-height: 30px;
  1371. max-height: 300px;
  1372. overflow-y: auto;
  1373. font-size: 14px;
  1374. line-height: 1.5;
  1375. }
  1376. }
  1377. }
  1378. .pagination {
  1379. margin-top: 10px;
  1380. padding: 10px 10px;
  1381. }
  1382. }
  1383. .recallDialog {
  1384. height: 392px;
  1385. width: 700px;
  1386. background-image: url('/src/assets/receive-recall.png');
  1387. position: fixed;
  1388. top: 50%;
  1389. left: 50%;
  1390. transform: translate(-50%, -50%);
  1391. z-index: 1000;
  1392. .close,
  1393. .cancle,
  1394. .confirm {
  1395. opacity: 0;
  1396. .Btn {
  1397. height: 100%;
  1398. width: 100%;
  1399. border-radius: 10px;
  1400. }
  1401. }
  1402. .close {
  1403. position: absolute;
  1404. left: 625px;
  1405. top: 20px;
  1406. height: 38px;
  1407. width: 38px;
  1408. }
  1409. .text {
  1410. position: absolute;
  1411. left: 185px;
  1412. top: 190px;
  1413. height: 67px;
  1414. width: 500px;
  1415. .txt {
  1416. height: 100%;
  1417. width: 100%;
  1418. color: #001a42;
  1419. font-family: "PingFang SC";
  1420. font-size: 42px;
  1421. font-style: normal;
  1422. font-weight: 900;
  1423. line-height: normal;
  1424. }
  1425. }
  1426. .cancle {
  1427. position: absolute;
  1428. left: 185px;
  1429. top: 304px;
  1430. height: 55px;
  1431. width: 150px;
  1432. }
  1433. .confirm {
  1434. position: absolute;
  1435. left: 375px;
  1436. top: 304px;
  1437. height: 55px;
  1438. width: 150px;
  1439. }
  1440. }
  1441. :deep(.adddialog) {
  1442. min-width: 500px;
  1443. background-color: #F3FAFE !important;
  1444. margin-top: 8vh;
  1445. border-radius: 8px;
  1446. /* height: 85vh; */
  1447. /* overflow: auto; */
  1448. .addForm {
  1449. padding: 0 60px 1vh 60px;
  1450. .el-date-editor {
  1451. display: flex;
  1452. flex: 1;
  1453. }
  1454. .pic {
  1455. display: flex;
  1456. align-items: center;
  1457. .uploader {
  1458. height: 80px;
  1459. width: 80px;
  1460. .el-upload {
  1461. height: 100%;
  1462. width: 100%;
  1463. }
  1464. }
  1465. .picText {
  1466. color: #999999;
  1467. font-family: "PingFang SC";
  1468. font-size: 10px;
  1469. font-style: normal;
  1470. font-weight: 400;
  1471. line-height: 20px;
  1472. margin-left: 10px;
  1473. }
  1474. }
  1475. }
  1476. .dialog-footer {
  1477. display: flex;
  1478. justify-content: center;
  1479. padding-bottom: 1.5vh;
  1480. }
  1481. }
  1482. :deep(.refundDialog) {
  1483. background: #F3FAFE !important;
  1484. .left {
  1485. width: 50%;
  1486. height: 70vh;
  1487. min-height: 700px;
  1488. padding: 0 2vw;
  1489. .add-item {
  1490. display: flex;
  1491. align-items: center;
  1492. margin-bottom: 1vh;
  1493. }
  1494. .image {
  1495. width: 4vw !important;
  1496. height: 4vw !important;
  1497. }
  1498. }
  1499. .right {
  1500. width: 50%;
  1501. height: 50vh;
  1502. .add-item {
  1503. display: flex;
  1504. align-items: center;
  1505. margin-bottom: 1vh;
  1506. }
  1507. }
  1508. }
  1509. :deep(.adddialog .el-form-item__label) {
  1510. min-width: 120px;
  1511. width: auto;
  1512. font-weight: 800;
  1513. padding-bottom: 15px;
  1514. }
  1515. }
  1516. // 表单卡片样式
  1517. .card2 {
  1518. background: #E7F4FD;
  1519. }
  1520. // 表格样式
  1521. :deep(.el-table__header-wrapper),
  1522. :deep(.el-table__body-wrapper),
  1523. :deep(.el-table__cell),
  1524. :deep(.el-table__body td) {
  1525. background-color: #F3FAFE !important;
  1526. }
  1527. :deep(.el-table__header th) {
  1528. background-color: #F3FAFE !important;
  1529. }
  1530. :deep(.el-table__row:hover > .el-table__cell) {
  1531. background-color: #E5EBFE !important;
  1532. }
  1533. .reject-reason-box {
  1534. width: 80%;
  1535. padding: 20px;
  1536. }
  1537. .rejectBtn {
  1538. margin-top: 20px;
  1539. display: flex;
  1540. justify-content: flex-end;
  1541. }
  1542. </style>