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.

1484 lines
61 KiB

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