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.

1522 lines
62 KiB

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