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

1 month 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
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
1 month 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
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 }} {{ 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="28vw" :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. 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 @change="ifGold" 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. <div v-show="isGold" style="margin-bottom: 15px; display: flex;">
  226. <div style=" display: flex; ">
  227. <span style="color: #999999; display: flex; white-space: nowrap;align-items: center;">{{
  228. t('common_add.permanentGold') }}</span>
  229. <el-input placeholder="0"
  230. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  231. v-model="addFormData.permanentGold" />
  232. </div>
  233. <div style="padding-right: 5px; display: flex;">
  234. <span style="color: #999999; display: flex; white-space: nowrap;align-items: center;">{{
  235. t('common_add.freeGold') }}</span>
  236. <el-input placeholder="0"
  237. style="padding-right: 10px; padding-left: 10px; height: 30px; width: 110px;"
  238. v-model="addFormData.freeGold" />
  239. </div>
  240. </div>
  241. <el-form-item :label="t('common_add.payCurrency')" required prop="paymentCurrency">
  242. <CurrencySelect v-model="addFormData.paymentCurrency" :items="customOptions"
  243. :placeholder="t('common_add.payCurrencyPlaceholder')" @change="handleCurrencyChange" />
  244. </el-form-item>
  245. <el-form-item :label="t('common_add.payAmount')" required prop="paymentAmount">
  246. <el-input v-model="addFormData.paymentAmount" :placeholder="t('common_add.payAmountPlaceholder')" />
  247. </el-form-item>
  248. <el-form-item :label="t('common_add.payMethod')" required prop="payType">
  249. <CurrencySelect v-model="addFormData.payType" :items="paytypeOptions"
  250. :placeholder="t('common_add.payMethodPlaceholder')" @change="ifGroup">
  251. </CurrencySelect>
  252. </el-form-item>
  253. <el-form-item :label="t('common_add.receiveArea')" prop="receivedMarket">
  254. <CurrencySelect v-model="addFormData.receivedMarket" :items="MoneyAddressOptions"
  255. :disabled="isGroup" :placeholder="t('common_add.receiveAreaPlaceholder')">
  256. </CurrencySelect>
  257. </el-form-item>
  258. <el-form-item :label="t('common_add.payTime')" required prop="payTime">
  259. <el-date-picker type="datetime" placement="right" v-model="addFormData.payTime"
  260. :placeholder="t('common_add.payTimePlaceholder')" />
  261. </el-form-item>
  262. <el-form-item :label="t('common_add.transferVoucher')" prop="voucher">
  263. <div class="pic">
  264. <el-upload ref="uploadRef" class="uploader" :show-file-list="false" list-type="picture-card"
  265. :auto-upload="false" :before-upload="beforeUpload" :on-error="handelImgErr"
  266. :on-change="handleImageChange" :http-request="customUpload">
  267. <img v-if="addFormData.voucher" :src="addFormData.voucher" class="avatar"
  268. style="height: 100%; width: 100%; object-fit: cover;" />
  269. <el-icon v-else class="avatar-uploader-icon">
  270. <Plus />
  271. </el-icon>
  272. </el-upload>
  273. </div>
  274. </el-form-item>
  275. <el-form-item :label="t('common_add.remark')" prop="remark">
  276. <el-input v-model="addFormData.remark" type="textarea" :rows="4" maxlength="100" show-word-limit />
  277. </el-form-item>
  278. </el-form>
  279. <template #footer>
  280. <span class="dialog-footer">
  281. <el-button style="background-color: #7E91FF;" @click="closeAddForm">{{ t('common.cancel')
  282. }}</el-button>
  283. <el-button v-if="addOrEdit == 1" style="background-color: #2741DE; margin-left: 2.5vw;"
  284. type="primary" @click="throttledhandleAddForm" :disabled="ifAddDone">{{ t('common.confirm')
  285. }}</el-button>
  286. <el-button v-else-if="addOrEdit == 2" style="background-color: #2741DE; margin-left: 2.5vw;"
  287. type="primary" @click="throttledhandleEditForm" :disabled="ifReAddDone">{{ t('common.edit')
  288. }}</el-button>
  289. </span>
  290. </template>
  291. </el-dialog>
  292. <!-- 客服新增退款弹窗 -->
  293. <el-dialog v-model="refundDialog" :title="t('common_add.refund')" class="refundDialog" overflow draggable
  294. style="width: 40vw;" :before-close="closeRefundForm">
  295. <div style="display: flex;">
  296. <div class="left">
  297. <div class="add-item">
  298. <el-text style="width:4vw;">{{ t('common_add.jwcode') }}</el-text>
  299. <el-input v-model="refundFormData.jwcode" style="width:10vw;" disabled />
  300. </div>
  301. <div class="add-item">
  302. <el-text style="width:4vw;">{{ t('common_add.customerName') }}</el-text>
  303. <el-input v-model="refundFormData.name" style="width:10vw;" disabled />
  304. </div>
  305. <div class="add-item">
  306. <el-text style="width:4vw;">{{ t('common_add.market') }}</el-text>
  307. <el-input v-model="refundFormData.marketName" style="width:10vw;" disabled />
  308. </div>
  309. <div class="add-item">
  310. <el-text style="width:4vw;">{{ t('common_add.activity') }}</el-text>
  311. <el-input v-model="refundFormData.activity" style="width:10vw;" disabled />
  312. </div>
  313. <div class="add-item">
  314. <el-text style="width:4vw;">{{ t('common_add.productName') }}</el-text>
  315. <el-input v-model="refundFormData.goodsName" style="width:10vw;" disabled />
  316. </div>
  317. <div v-show="!isRefundGold" class="add-item">
  318. <el-text style="width:4vw;">{{ t('common_add.productNum') }}</el-text>
  319. <el-input style="padding-right: 10px; width:6.5vw;" v-model="refundFormData.goodNum"
  320. :placeholder="t('common_add.productNumPlaceholder')" disabled />
  321. <CurrencySelect disabled v-model="refundFormData.numUnit" :items="numUnitList"
  322. style="width: 3.5vw;" :placeholder="t('common_add.numUnit')"
  323. @change="handleCurrencyChange" />
  324. </div>
  325. <div v-show="isRefundGold" style="margin-bottom: 15px; ">
  326. <div style=" display: flex; ">
  327. <span
  328. style="color: #999999; display: flex; white-space: nowrap;align-items: center;width:4vw;">{{
  329. t('common_add.permanentGold') }}</span>
  330. <el-input style="padding-right: 10px; height: 30px; width: 110px; margin-bottom: 10px"
  331. v-model="refundFormData.permanentGold" disabled />
  332. </div>
  333. <div style="padding-right: 5px; display: flex;">
  334. <span
  335. style="color: #999999; display: flex; white-space: nowrap;align-items: center;width:4vw;">{{
  336. t('common_add.freeGold') }}</span>
  337. <el-input style="padding-right: 10px; height: 30px; width: 110px;"
  338. v-model="refundFormData.freeGold" disabled />
  339. </div>
  340. </div>
  341. <div class="add-item">
  342. <el-text style="width:4vw;">{{ t('common_add.payCurrency') }}</el-text>
  343. <el-input v-model="refundFormData.paymentCurrency" style="width:10vw;" disabled />
  344. </div>
  345. <div class="add-item">
  346. <el-text style="width:4vw;">{{ t('common_add.payAmount') }}</el-text>
  347. <el-input v-model="refundFormData.paymentAmount" style="width:10vw;" disabled />
  348. </div>
  349. <div class="add-item">
  350. <el-text style="width:4vw;">{{ t('common_add.payMethod') }}</el-text>
  351. <el-input v-model="refundFormData.payType" style="width:10vw;" disabled />
  352. </div>
  353. <div class="add-item">
  354. <el-text style="width:4vw;">{{ t('common_add.payTime') }}</el-text>
  355. <el-date-picker v-model="refundFormData.payTime" type="datetime" style="width:10vw;" disabled />
  356. </div>
  357. <div class="add-item">
  358. <el-text style="width:4vw;" size="small">{{ t('common_add.transferVoucher') }}</el-text>
  359. <el-form-item
  360. :rules="{ required: true, message: t('common_add.uploadPhoto'), trigger: 'change' }">
  361. <el-upload ref="uploadRef" :auto-upload="false" list-type="picture-card"
  362. :show-file-list="false">
  363. <template #default>
  364. <img v-if="refundFormData.voucher" :src="refundFormData.voucher"
  365. style="width: 100%; height: 100%; object-fit: cover;">
  366. <el-icon v-else>
  367. <Plus />
  368. </el-icon>
  369. </template>
  370. </el-upload>
  371. </el-form-item>
  372. </div>
  373. <div class="add-item">
  374. <el-text style="width:4vw;">{{ t('common_add.remark') }}</el-text>
  375. <el-input v-model="refundFormData.remark" style="width:10vw;" :rows="2" type="textarea"
  376. maxLength="100" disabled show-word-limit />
  377. </div>
  378. </div>
  379. <div class="right">
  380. <div class="add-item">
  381. <el-text style="width:4vw;">{{ t('common_add.refundModel') }}</el-text>
  382. <el-radio-group v-model="refundFormData.refundModel">
  383. <el-radio value="0">{{ t('common_add.refundModelAll') }}</el-radio>
  384. <el-radio value="1">{{ t('common_add.refundModelPart') }}</el-radio>
  385. </el-radio-group>
  386. </div>
  387. <div class="add-item"
  388. v-show="refundFormData.goodsName === t('cash.coinRecharge') && refundFormData.refundModel === '1'">
  389. <el-text style="width:4vw;">{{ t('common_add.permanentGold') }}</el-text>
  390. <el-input v-model="refundFormData.partRefundGold" style="width:5vw;" />&nbsp;&nbsp;
  391. </div>
  392. <div class="add-item"
  393. v-show="refundFormData.goodsName === t('cash.coinRecharge') && refundFormData.refundModel === '1'">
  394. <el-text style="width:4vw;">{{ t('common_add.freeGold') }}</el-text>
  395. <el-input v-model="refundFormData.partRefundFree" style="width:5vw;" />&nbsp;&nbsp;
  396. </div>
  397. <div class="add-item">
  398. <el-text style="width:4vw;">{{ t('common_add.refundReason') }}</el-text>
  399. <el-input v-model="refundFormData.refundReason" style="width:10vw;" :rows="5" maxlength="150"
  400. show-word-limit type="textarea" />
  401. </div>
  402. <div>{{ t('common_add.tip') }}</div>
  403. <div style="display:flex;justify-content: center;margin-top: 5vh;">
  404. <el-button type="default" @click="closeRefundForm">{{ t('common.cancel') }}</el-button>
  405. <el-button type="primary" @click="throttledsubmitRefund">{{ t('common.submit') }}</el-button>
  406. </div>
  407. </div>
  408. </div>
  409. </el-dialog>
  410. <!-- 查看驳回理由 -->
  411. <el-dialog :title="t('common_add.rejectReason')" v-model="rejectReasonVisible" width="50%" top="30vh"
  412. style="min-width: 200px; max-width: 500px;" :before-close="closeRejectForm">
  413. <div class="reject-reason-box">
  414. {{ rejectReason }}
  415. </div>
  416. <div class="rejectBtn">
  417. <el-button type="primary" @click="closeRejectForm">{{ t('common.confirm') }}</el-button>
  418. </div>
  419. </el-dialog>
  420. </div>
  421. </template>
  422. <script setup>
  423. import { ref, watch, onMounted, computed } from 'vue';
  424. import { storeToRefs } from 'pinia';
  425. import { ElMessage, ElMessageBox } from 'element-plus'
  426. import API from '@/util/http.js'
  427. import CurrencySelect from '@/components/MoneyManage/CurrencySelect.vue'
  428. import ProductSelect from '@/components/MoneyManage/ProductSelect.vue'
  429. import { Plus } from '@element-plus/icons-vue'; // 补充图标导入(原代码遗漏)
  430. import request from '@/util/http.js'
  431. import moment from 'moment'
  432. import { useAdminStore } from '@/store/index.js'
  433. import { hasMenuPermission } from '@/utils/menuTreePermission.js'
  434. import _ from 'lodash'
  435. import { isNumber } from 'lodash'
  436. // 导入客服相关规则和静态数据
  437. import { addFormRule as getAddFormRule } from './utils/recriveFormRules.js'
  438. import { productList, MarketNameForId, CurrencyForId, marketList,statusList, normalizeSubmitterMarket, normalizeGoodsName, normalizePayType } from './utils/staticData.js'
  439. // 国际化
  440. import { useI18n } from 'vue-i18n'
  441. const { t } = useI18n()
  442. const addFormRule = computed(() => getAddFormRule(t))
  443. // ===================== 基础状态管理(仅保留客服相关) =====================
  444. const adminStore = useAdminStore();
  445. const { menuTree } = storeToRefs(adminStore);
  446. const adminData = ref({}) // 管理员信息
  447. const tableData = ref([]) // 表格数据
  448. const total = ref(0) // 总条数
  449. const pageInfo = ref({ pageSize: 10, pageNum: 1 }) // 分页信息
  450. const numUnitList = ref([t('cash.year'), t('cash.month')])
  451. // 筛选地区树
  452. const market = ref([])
  453. //防止重复点击状态管理
  454. const ifAddDone = ref(false)
  455. const ifReAddDone = ref(false)
  456. // 角色标识:固定为客服(删除财务、总部财务、超级管理员标识)
  457. const kefu = ref(true)
  458. const caiwu = ref(false)
  459. const HQcaiwu = ref(false)
  460. const superAdmin = ref(false)
  461. // ===================== 查询相关 =====================
  462. const searchData = ref({}) // 搜索参数
  463. const getTime = ref([]) // 时间范围
  464. const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] // 默认时间
  465. // 查询按钮
  466. const search = () => {
  467. getlist()
  468. }
  469. // 重置按钮
  470. const reset = () => {
  471. searchData.value = {}
  472. getTime.value = []
  473. // 重置页码
  474. pageInfo.value.pageNum = 1
  475. getlist()
  476. }
  477. const rejectReasonVisible = ref(false)
  478. const rejectReason = ref('')
  479. const closeRejectForm = () => {
  480. rejectReasonVisible.value = false
  481. }
  482. const openRejectReason = (reason) => {
  483. rejectReason.value = reason
  484. rejectReasonVisible.value = true
  485. }
  486. // 时间选择器变更(原代码声明未实现,保留空函数避免报错)
  487. const handleDatePickerChange = () => { }
  488. // 日期禁用(原代码声明未实现,保留空函数避免报错)
  489. const disabledDate = () => { }
  490. // 表格排序(原代码声明未实现,保留空函数避免报错)
  491. const handleSortChange = () => { }
  492. // 获取表格数据(仅保留客服角色逻辑)
  493. const getlist = async () => {
  494. try {
  495. let payCurrencySelect = ''
  496. let goodsName = ''
  497. // 处理时间范围
  498. if (getTime.value && getTime.value.length === 2) {
  499. searchData.value.startTime = moment(getTime.value[0]).format('YYYY-MM-DD HH:mm:ss')
  500. searchData.value.endTime = moment(getTime.value[1]).format('YYYY-MM-DD HH:mm:ss')
  501. } else {
  502. searchData.value.startTime = ''
  503. searchData.value.endTime = ''
  504. }
  505. // 处理产品名称(级联选择器取最后一级)
  506. if (searchData.value.goodsName) {
  507. goodsName = searchData.value.goodsName[searchData.value.goodsName.length - 1]
  508. }
  509. // 处理付款币种
  510. if (searchData.value.paymentCurrency) {
  511. payCurrencySelect = CurrencyForId(searchData.value.paymentCurrency)
  512. }
  513. // 客服角色固定参数:cashRoleId=0,无到账地区筛选
  514. const cashRoleId = '0'
  515. const receivedMarket = ''
  516. // 地区处理
  517. if (searchData.value.markets) {
  518. searchData.value.market = searchData.value.markets[searchData.value.markets.length - 1]
  519. } else {
  520. searchData.value.market = ''
  521. }
  522. if (searchData.value.jwcode) {
  523. const isPositiveInteger = /^[1-9]\d*$/.test(searchData.value.jwcode);
  524. if (!isPositiveInteger) {
  525. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  526. return;
  527. }
  528. // 添加精网号长度验证
  529. if (searchData.value.jwcode.length > 8) {
  530. ElMessage.error(t('elmessage.limitJwcodeLength'))
  531. return;
  532. }
  533. }
  534. // if (searchData.value.jwcode && !isNumber(searchData.value.jwcode)) {
  535. // ElMessage.error('精网号只能是数字')
  536. // return
  537. // }
  538. const result = await request({
  539. url: '/cashCollection/selectCollection',
  540. data: {
  541. ...pageInfo.value,
  542. cashCollection: {
  543. ...searchData.value,
  544. ...getTime.value,
  545. submitterId: adminData.value.id,
  546. receivedMarket: MarketNameForId(receivedMarket),
  547. cashRoleId: cashRoleId,
  548. paymentCurrency: payCurrencySelect,
  549. submitterMarket: normalizeSubmitterMarket(adminData.value.markets),
  550. goodsName: goodsName,
  551. market: MarketNameForId(searchData.value.market)
  552. }
  553. }
  554. })
  555. if (result.code == 200) {
  556. tableData.value = result.data.list
  557. total.value = result.data.total
  558. } else {
  559. ElMessage.error(t('elmessage.dataException'))
  560. console.log(result.msg);
  561. }
  562. } catch (error) {
  563. console.log(error);
  564. }
  565. }
  566. // ===================== 分页相关 =====================
  567. const handlePagination = (type, val) => {
  568. if (type === 'size') {
  569. pageInfo.value.pageSize = val
  570. } else {
  571. pageInfo.value.pageNum = val
  572. }
  573. getlist()
  574. }
  575. // ===================== 客服新增/编辑收款弹窗 =====================
  576. const addFormisible = ref(false) // 弹窗显隐
  577. const addFormData = ref({ name: '', market: '', goodsName: '' }) // 表单数据
  578. const addFormRef = ref(null) // 表单引用
  579. const addOrEdit = ref(0) // 1=新增,2=编辑
  580. const isGold = ref(false) // 是否为金币充值产品
  581. const productSelectRef = ref(null) // 产品选择器引用
  582. const uploadRef = ref(null) // 上传组件引用
  583. // 产品选择变更:判断是否为金币充值
  584. const ifGold = () => {
  585. if (addFormData.value.goodsName === t('cash.coinRecharge')) {
  586. isGold.value = true
  587. addFormData.value.goodNum = 0
  588. } else {
  589. isGold.value = false
  590. numUnitList.value = [t('cash.unit'), t('cash.year'), t('cash.month')]
  591. const selectItems = ref([
  592. t('cash.aiService.aiTracking'),
  593. t('cash.aiService.aiAttack'),
  594. t('cash.aiService.aiFunds'),
  595. t('cash.aiService.aiActivity'),
  596. t('cash.aiService.superPerspective'),
  597. t('cash.aiService.superAmbush'),
  598. t('cash.aiService.superHunting'),
  599. t('cash.aiService.superPulse'),
  600. t('cash.aiService.superCompass'),
  601. t('cash.aiService.aiDetectionTool'),
  602. t('cash.aiService.superDetectionTool')
  603. ])
  604. if (selectItems.value.includes(addFormData.value.goodsName)) {
  605. if (addOrEdit.value == 1) {
  606. addFormData.value.numUnit = ''
  607. }
  608. numUnitList.value = [t('cash.year'), t('cash.month')]
  609. } else if (addFormData.value.goodsName == t('cash.staticInfoFee')) {
  610. addFormData.value.numUnit = t('cash.year')
  611. numUnitList.value = [t('cash.year')]
  612. } else {
  613. addFormData.value.numUnit = t('cash.unit')
  614. numUnitList.value = [t('cash.unit')]
  615. }
  616. }
  617. }
  618. // 支付方式变更:判断是否为默认归属平台
  619. const isGroup = ref(false)
  620. const ifGroup = () => {
  621. if (addFormData.value.payType === t('cash.payMethods.stripe') || addFormData.value.payType === t('cash.payMethods.paymentAsia')) {
  622. isGroup.value = true
  623. addFormData.value.receivedMarket = t('cash.markets.HongKong')
  624. } else if (addFormData.value.payType === t('cash.payMethods.ipay88')) {
  625. isGroup.value = true
  626. addFormData.value.receivedMarket = t('cash.markets.Malaysia')
  627. } else if (addFormData.value.payType === t('cash.payMethods.transfer')) {
  628. isGroup.value = true
  629. addFormData.value.receivedMarket = t('cash.markets.Canada')
  630. } else if (addFormData.value.payType === t('cash.payMethods.grabpay') || addFormData.value.payType === t('cash.payMethods.nets') || addFormData.value.payType === t('cash.payMethods.paypal')) {
  631. isGroup.value = true
  632. addFormData.value.receivedMarket = t('cash.markets.Singapore')
  633. } else {
  634. isGroup.value = false
  635. }
  636. }
  637. //失焦和回车查询仅选一个
  638. const jwcodeQueriedInFocus = ref(false)
  639. const handleJwcodeFocus = () => {
  640. jwcodeQueriedInFocus.value = false
  641. }
  642. const handleJwcodeEnter = () => {
  643. jwcodeQueriedInFocus.value = true
  644. jwcodeSeachMarket()
  645. }
  646. const handleJwcodeBlur = () => {
  647. if (jwcodeQueriedInFocus.value) return
  648. jwcodeQueriedInFocus.value = true
  649. jwcodeSeachMarket()
  650. }
  651. // 精网号失焦:查询客户姓名和地区
  652. const jwcodeSeachMarket = async () => {
  653. try {
  654. const jwcode = String(addFormData.value.jwcode ?? '').replace(/\s/g, '')
  655. addFormData.value.jwcode = jwcode
  656. if (!jwcode) {
  657. ElMessage.warning(t('elmessage.noEmptyJwcode'))
  658. return
  659. }
  660. if (!/^[1-9]\d*$/.test(jwcode)) {
  661. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  662. return
  663. }
  664. if (jwcode.length > 8) {
  665. ElMessage.error(t('elmessage.limitJwcodeLength'))
  666. return
  667. }
  668. const result = await request({
  669. url: '/cashCollection/getNameAndMarket',
  670. data: jwcode
  671. })
  672. if (result.code == 200 && result.data && Object.keys(result.data).length > 0) {
  673. ElMessage.success(t('elmessage.customerSuccess'))
  674. addFormData.value.market = result.data.market
  675. addFormData.value.marketName = result.data.marketName
  676. addFormData.value.name = result.data.name
  677. } else if (result.code == 0) {
  678. const region = result.data && result.data.market
  679. if (region) {
  680. ElMessage.info({
  681. message: t('elmessage.userRegionHint', { region }),
  682. customClass: 'custom-blue-message'
  683. })
  684. return
  685. }
  686. ElMessage.error(t('elmessage.customerNotExist'))
  687. } else {
  688. ElMessage.error(t('elmessage.customerNotExist'))
  689. }
  690. } catch (error) {
  691. console.log(error);
  692. }
  693. }
  694. // 打开新增/编辑弹窗
  695. const openAddForm = (row) => {
  696. productSelectRef.value?.resetSelect();
  697. if (row?.jwcode) {
  698. // 编辑模式
  699. addOrEdit.value = 2
  700. addFormData.value = {
  701. ...row,
  702. }
  703. jwcodeSeachMarket()
  704. ifGold()
  705. } else {
  706. // 新增模式
  707. addOrEdit.value = 1
  708. addFormData.value = { goodsName: '' }
  709. }
  710. addFormisible.value = true
  711. }
  712. // 关闭新增/编辑弹窗
  713. const closeAddForm = () => {
  714. addFormisible.value = false
  715. addFormData.value = {}
  716. addOrEdit.value = 0
  717. isGold.value = false
  718. addFormRef.value?.resetFields();
  719. }
  720. const testGold = () => {
  721. // 转换为数字(处理字符串类型的数字)
  722. if (addFormData.value.goodsName == t('cash.coinRecharge')) {
  723. if (addFormData.value.permanentGold == null) {
  724. addFormData.value.permanentGold = 0
  725. }
  726. if (addFormData.value.freeGold == null) {
  727. addFormData.value.freeGold = 0
  728. }
  729. const permanentGold = Number(addFormData.value.permanentGold);
  730. const freeNum = Number(addFormData.value.freeGold);
  731. // 正则:仅允许0-999999的正整数(包括0)
  732. const reg = /^[0-9]{1,6}$/;
  733. if (!reg.test(permanentGold) || permanentGold < 0) {
  734. return { valid: false, message: t('elmessage.checkPermanentFormat') };
  735. }
  736. if (!reg.test(freeNum) || freeNum < 0) {
  737. return { valid: false, message: t('elmessage.checkFreeFormat') };
  738. }
  739. if (permanentGold == 0 && freeNum == 0) {
  740. return { valid: false, message: t('elmessage.permanentAndFreeNoZero') };
  741. }
  742. }
  743. return { valid: true };
  744. }
  745. // 客服新增收款
  746. const handleAddForm = async () => {
  747. try {
  748. await addFormRef.value.validate();
  749. if (!testGold().valid) {
  750. ElMessage.error(testGold().message);
  751. return;
  752. }
  753. //单独校验产品数量
  754. if (!isGold.value) {
  755. if (!addFormData.value.goodNum) {
  756. ElMessage.error(t('elmessage.checkProductNum'));
  757. return;
  758. }
  759. const positiveIntReg = /^[1-9]\d*$/;
  760. if (!positiveIntReg.test(addFormData.value.goodNum)) {
  761. ElMessage.error(t('elmessage.productNumError'));
  762. return;
  763. }
  764. }
  765. if (addFormData.value.numUnit == '') {
  766. ElMessage.error(t('elmessage.checkNumUnit'));
  767. return;
  768. }
  769. if (addFormData.value.goodsName == t('cash.coinRecharge')) {
  770. if (addFormData.value.permanentGold == null || addFormData.value.permanentGold == 0) {
  771. ElMessage.error(t('elmessage.checkPermanentGold'));
  772. return;
  773. }
  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: normalizeSubmitterMarket(refundFormData.value.marketName),
  1073. submitterId: adminData.value.id,
  1074. submitterMarket: normalizeSubmitterMarket(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: 42px;
  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>