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.

1479 lines
61 KiB

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