Compare commits
	
		
			2 Commits
		
	
	
		
			bc67220ef1
			...
			e2b1573edc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e2b1573edc | |||
| 3da5817404 | 
| @ -44,3 +44,11 @@ export function delTmMemberPlatform(data) { | ||||
|   }) | ||||
| } | ||||
|  | ||||
| //修改TmMemberPlatform的字符 | ||||
| export function tmMemberPlatformChangeChar(data){ | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-member-platform/change-chars', | ||||
|     method: 'post', | ||||
|     data: data | ||||
|   }) | ||||
| } | ||||
| @ -61,14 +61,32 @@ export function getTranslateDataStatistic() { | ||||
| } | ||||
|  | ||||
| // 字符充值 | ||||
| export function tmMemberRecharge(data) { | ||||
| // export function tmMemberRecharge(data) { | ||||
| //   return request({ | ||||
| //     url: '/api/v1/tm-member/recharge', | ||||
| //     method: 'post', | ||||
| //     data: data | ||||
| //   }) | ||||
| // } | ||||
|  | ||||
| // 管理员充值 | ||||
| export function tmMemberManageRecharge(data) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-member/recharge', | ||||
|     url: '/api/v1/tm-member/manager-recharge', | ||||
|     method: 'post', | ||||
|     data: data | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 管理员扣除字符 | ||||
| export function tmMemberManageDeduct(data) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-member/manager-deduct', | ||||
|     method: 'put', | ||||
|     data: data | ||||
|   }) | ||||
| } | ||||
|  | ||||
| export function changeTmMemberStatus(data) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-member/status', | ||||
|  | ||||
| @ -44,3 +44,11 @@ export function delTmPlatformAccount(data) { | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 更新TmPlatformAccount剩余量 | ||||
| export function tmPlatformAccountRemain(id) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-platform-account/query-remain/' + id, | ||||
|     method: 'put' | ||||
|   }) | ||||
| } | ||||
|  | ||||
|  | ||||
							
								
								
									
										46
									
								
								src/api/admin/tm-recharge-package.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/api/admin/tm-recharge-package.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | ||||
| import request from '@/utils/request' | ||||
|  | ||||
| // 查询TmRechargePackage列表 | ||||
| export function listTmRechargePackage(query) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-recharge-package', | ||||
|     method: 'get', | ||||
|     params: query | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 查询TmRechargePackage详细 | ||||
| export function getTmRechargePackage(id) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-recharge-package/' + id, | ||||
|     method: 'get' | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 新增TmRechargePackage | ||||
| export function addTmRechargePackage(data) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-recharge-package', | ||||
|     method: 'post', | ||||
|     data: data | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 修改TmRechargePackage | ||||
| export function updateTmRechargePackage(data) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-recharge-package/' + data.id, | ||||
|     method: 'put', | ||||
|     data: data | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 删除TmRechargePackage | ||||
| export function delTmRechargePackage(data) { | ||||
|   return request({ | ||||
|     url: '/api/v1/tm-recharge-package', | ||||
|     method: 'delete', | ||||
|     data: data | ||||
|   }) | ||||
| } | ||||
|  | ||||
| @ -79,6 +79,9 @@ | ||||
|                       :style="{ width: '100%' }" | ||||
|                     /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="默认赠送字符数"> | ||||
|                     <el-input v-model="form.tm_gift_characters" placeholder="请输入默认赠送字符数"></el-input> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item size="large"> | ||||
|                     <el-button type="primary" @click="submitForm">提交</el-button> | ||||
|                     <el-button @click="resetForm">重置</el-button> | ||||
| @ -121,7 +124,8 @@ export default { | ||||
|         sys_user_initPassword: undefined, | ||||
|         sys_index_skinName: undefined, | ||||
|         sys_index_sideTheme: undefined, | ||||
|         trx_receive_address: undefined | ||||
|         trx_receive_address: undefined, | ||||
|         tm_gift_characters: undefined | ||||
|       }, | ||||
|       rules: { | ||||
|         sys_app_name: [{ | ||||
| @ -144,7 +148,8 @@ export default { | ||||
|           message: '请选择侧栏主题', | ||||
|           trigger: 'change' | ||||
|         }], | ||||
|         trx_receive_address: [{ required: true, message: '请输入TRX收货地址', trigger: 'blur' }] | ||||
|         trx_receive_address: [{ required: true, message: '请输入TRX收货地址', trigger: 'blur' }], | ||||
|         tm_gift_characters: [{ required: true, message: '请输入默认赠送字符数', trigger: 'blur' }] | ||||
|       }, | ||||
|       otherRules: { | ||||
|  | ||||
|  | ||||
| @ -14,12 +14,7 @@ | ||||
|           <el-form-item label="状态" prop="status"> | ||||
|  | ||||
|             <el-select v-model="queryParams.status" clearable placeholder="请选择"> | ||||
|               <el-option | ||||
|                 v-for="dict in statusOptions" | ||||
|                 :key="dict.value" | ||||
|                 :label="dict.label" | ||||
|                 :value="dict.value" | ||||
|               /> | ||||
|               <el-option v-for="dict in statusOptions" :key="dict.value" :label="dict.label" :value="dict.value" /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|  | ||||
| @ -49,15 +44,31 @@ | ||||
|  | ||||
|         <el-table v-loading="loading" :data="tmMemberList" @selection-change="handleSelectionChange"> | ||||
|           <el-table-column type="selection" width="55" align="center" /> | ||||
|           <el-table-column label="Id" align="center" prop="userId" width="80" /> | ||||
|           <el-table-column label="用户昵称" align="center" prop="nickName" :show-overflow-tooltip="true" /> | ||||
|           <el-table-column label="Key" align="center" prop="apiKey" /> | ||||
|           <!-- <el-table-column label="总字符" align="center" prop="totalChars" /> --> | ||||
|           <el-table-column label="剩余字符" align="center" prop="remainChars"> | ||||
|           <el-table-column label="已用字符" align="center"> | ||||
|             <template slot-scope="scope"> | ||||
|               <div v-for="(item,index) in scope.row.platforms" :key="'remains'+index">{{ item.name }}:{{ item.remainChars }}</div> | ||||
|               <div v-for="(item, index) in scope.row.usedPlatform" :key="'used' + index"> | ||||
|                 {{ item.name }}:{{ item.totalChars }} | ||||
|                 <!-- <el-button v-permisaction="['admin:tmMember:changeChars']" | ||||
|                   size="mini" type="text" icon="el-icon-edit" class="char-btn">修改 | ||||
|                 </el-button> --> | ||||
|               </div> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column label="状态" align="center" :show-overflow-tooltip="true"> | ||||
|           <el-table-column label="剩余字符" align="center" prop="remainChars"> | ||||
|             <template slot-scope="scope"> | ||||
|               <div v-for="(item, index) in scope.row.platforms" :key="'remains' + index">{{ item.name }}:{{ | ||||
|                 item.totalChars }} | ||||
|                 <!-- <el-button v-permisaction="['admin:tmMember:changeChars']" size="mini" type="text" | ||||
|                   icon="el-icon-edit" class="char-btn" | ||||
|                   @click="handleChangeChar(item, scope.row.nickName, 1)">修改</el-button> --> | ||||
|               </div> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column label="状态" align="center" width="80px"> | ||||
|             <template slot-scope="scope"> | ||||
|               <el-switch | ||||
|                 v-if="checkPermisAction(['admin:tmMember:changeStatus'])" | ||||
| @ -73,18 +84,18 @@ | ||||
|               <!--  --> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column label="用户状态" align="center"> | ||||
|           <el-table-column label="用户状态" align="center" width="100"> | ||||
|             <template slot-scope="scope"> | ||||
|               <el-tag v-if="scope.row.userStatus === 2" type="success">正常</el-tag> | ||||
|               <el-tag v-else type="danger">禁用</el-tag> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column label="创建时间" prop="createdAt" sortable="custom" width="155"> | ||||
|           <el-table-column label="创建时间" prop="createdAt" sortable="custom" width="150"> | ||||
|             <template slot-scope="scope"> | ||||
|               <span>{{ parseTime(scope.row.createdAt) }}</span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120"> | ||||
|             <template slot-scope="scope"> | ||||
|               <!-- <el-popconfirm class="delete-popconfirm" title="确认要修改吗?" confirm-button-text="修改" | ||||
|                                 @confirm="handleUpdate(scope.row)"> | ||||
| @ -113,7 +124,16 @@ | ||||
|                 >充值 | ||||
|                 </el-button> | ||||
|               </el-popconfirm> | ||||
|  | ||||
|               <el-popconfirm class="delete-popconfirm" title="确认要扣除吗?" confirm-button-text="扣除" @confirm="handleDeduct(scope.row)"> | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
|                   v-permisaction="['admin:tmMember:deduct']" | ||||
|                   size="mini" | ||||
|                   type="text" | ||||
|                   icon="el-icon-delete" | ||||
|                 >扣除 | ||||
|                 </el-button> | ||||
|               </el-popconfirm> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </el-table> | ||||
| @ -166,12 +186,28 @@ | ||||
|                 </el-dialog> --> | ||||
|  | ||||
|         <tm-member-recharge | ||||
|           :id="rechargeId" | ||||
|           v-model="showRecharge" | ||||
|           :api-key="showApiKey" | ||||
|           :nick-name="showNickName" | ||||
|           :user-id="showRechargeData.UserId" | ||||
|           :member-id="showRechargeData.memberId" | ||||
|           :api-key="showRechargeData.showApiKey" | ||||
|           :nick-name="showRechargeData.showNickName" | ||||
|           @close="handleRechargeClose" | ||||
|         /> | ||||
|  | ||||
|         <tm-member-deduct | ||||
|           v-model="showDeduct" | ||||
|           :user-id="showRechargeData.UserId" | ||||
|           :member-id="showRechargeData.memberId" | ||||
|           :api-key="showRechargeData.showApiKey" | ||||
|           :nick-name="showRechargeData.showNickName" | ||||
|           @close="handleRechargeClose" | ||||
|         /> | ||||
|  | ||||
|         <!-- <tm-member-change :visible.sync="showChange" :memberId="showCangeData.memberId" | ||||
|           :userId="showCangeData.userId" | ||||
|           :userName="showCangeData.nickName" :platformName="showCangeData.platformName" | ||||
|           :totalNum="showCangeData.totalNum" :platformId="showCangeData.platformId" | ||||
|            @close="handleChangeCharClose" /> --> | ||||
|       </el-card> | ||||
|     </template> | ||||
|   </BasicLayout> | ||||
| @ -181,11 +217,15 @@ | ||||
| import { addTmMember, delTmMember, getTmMember, listTmMember, updateTmMember, changeTmMemberStatus } from '@/api/admin/tm-member' | ||||
| import TmMemberRecharge from './tm-member-recharge.vue' | ||||
| import checkPermisAction from '@/utils/permisaction' | ||||
| // import TmMemberChange from './tm-member-change.vue' | ||||
| import TmMemberDeduct from './tm-member-deduct.vue' | ||||
|  | ||||
| export default { | ||||
|   name: 'TmMember', | ||||
|   components: { | ||||
|     TmMemberRecharge | ||||
|     TmMemberRecharge, | ||||
|     // TmMemberChange, | ||||
|     TmMemberDeduct | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
| @ -205,8 +245,21 @@ export default { | ||||
|       open: false, | ||||
|       isEdit: false, | ||||
|       showRecharge: false, | ||||
|       showApiKey: undefined, | ||||
|       showNickName: undefined, | ||||
|       showDeduct: false, | ||||
|       showRechargeData: { | ||||
|         showApiKey: undefined, | ||||
|         showNickName: undefined, | ||||
|         memberId: undefined, | ||||
|         userId: undefined | ||||
|       }, | ||||
|       showChange: false, | ||||
|       showCangeData: { | ||||
|         nickName: undefined, | ||||
|         platformId: undefined, | ||||
|         platformName: undefined, | ||||
|         totalNum: undefined, | ||||
|         type: undefined | ||||
|       }, | ||||
|       rechargeId: undefined, | ||||
|       // 类型数据字典 | ||||
|       typeOptions: [], | ||||
| @ -321,7 +374,7 @@ export default { | ||||
|     handleUpdate(row) { | ||||
|       this.reset() | ||||
|       const id = | ||||
|                 row.id || this.ids | ||||
|         row.id || this.ids | ||||
|       getTmMember(id).then(response => { | ||||
|         this.form = response.data | ||||
|         this.open = true | ||||
| @ -379,11 +432,23 @@ export default { | ||||
|       }) | ||||
|     }, | ||||
|     handleRecharge(row) { | ||||
|       this.rechargeId = row.id | ||||
|       this.showApiKey = row.apiKey | ||||
|       this.showNickName = row.nickName | ||||
|       this.showRechargeData = { | ||||
|         UserId: row.userId, | ||||
|         memberId: row.id, | ||||
|         showApiKey: row.apiKey, | ||||
|         showNickName: row.nickName | ||||
|       } | ||||
|       this.showRecharge = true | ||||
|     }, | ||||
|     handleDeduct(row) { | ||||
|       this.showRechargeData = { | ||||
|         UserId: row.userId, | ||||
|         memberId: row.id, | ||||
|         showApiKey: row.apiKey, | ||||
|         showNickName: row.nickName | ||||
|       } | ||||
|       this.showDeduct = true | ||||
|     }, | ||||
|     handleRechargeClose() { | ||||
|       this.getList() | ||||
|     }, | ||||
| @ -404,7 +469,30 @@ export default { | ||||
|         .finally(() => { | ||||
|           this.loading = false | ||||
|         }) | ||||
|     }, | ||||
|     handleChangeChar(row, nickName, type) { | ||||
|       this.showCangeData = { | ||||
|         nickName: nickName, | ||||
|         platformId: row.platformId, | ||||
|         platformName: row.name, | ||||
|         memberId: row.memberId, | ||||
|         userId: row.userId, | ||||
|         totalNum: row.totalChars, | ||||
|         type: type | ||||
|       } | ||||
|  | ||||
|       this.showChange = true | ||||
|     }, | ||||
|     // 修改字符关闭事件 | ||||
|     handleChangeCharClose() { | ||||
|       this.getList() | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style scoped> | ||||
| .char-btn { | ||||
|   margin-left: 5px; | ||||
| } | ||||
| </style> | ||||
|  | ||||
							
								
								
									
										119
									
								
								src/views/admin/tm-member/tm-member-change.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								src/views/admin/tm-member/tm-member-change.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,119 @@ | ||||
| <template> | ||||
|  | ||||
|     <el-dialog title="字符充值" :visible.sync="visible" width="500px" @close="handleClose" @open="handleOpen"> | ||||
|         <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||||
|             <el-form-item label="用户" prop="userName">{{ userName }}</el-form-item> | ||||
|             <el-form-item label="平台名称" prop="platformName"> | ||||
|                 {{ platformName }} | ||||
|             </el-form-item> | ||||
|             <el-form-item label="剩余字符数量" prop="changeNum"> | ||||
|                 <el-input v-model.number="form.changeNum" placeholder="请输入剩余字符数量"></el-input> | ||||
|             </el-form-item> | ||||
|         </el-form> | ||||
|         <div slot="footer" class="dialog-footer"> | ||||
|             <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||
|             <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|     </el-dialog> | ||||
| </template> | ||||
| <script> | ||||
| import { tmMemberPlatformChangeChar } from '@/api/admin/tm-member-platform' | ||||
| export default { | ||||
|     name: 'TmMemberChange', | ||||
|     props: { | ||||
|         type:{ | ||||
|             type:Number, | ||||
|             default:1 | ||||
|         }, | ||||
|         memberId: { | ||||
|             type: Number, | ||||
|             required: true, | ||||
|             default: 0 | ||||
|         }, | ||||
|         userName: { | ||||
|             type: String, | ||||
|             default: '' | ||||
|         }, | ||||
|         platformId:{ | ||||
|             type:Number, | ||||
|             default:0 | ||||
|         }, | ||||
|         platformName: { | ||||
|             type: String, | ||||
|             default: '' | ||||
|         }, | ||||
|         totalNum: { | ||||
|             type: Number, | ||||
|             default: 0 | ||||
|         }, | ||||
|         visible: { | ||||
|             type: Boolean, | ||||
|             default: false | ||||
|         } | ||||
|     }, | ||||
|     data() { | ||||
|         return { | ||||
|             form: { | ||||
|                 memberId: undefined, | ||||
|                 platformId: undefined, | ||||
|                 changeNum: 0 | ||||
|             }, | ||||
|             rules: { | ||||
|                 changeNum: [ | ||||
|                     { required: true, message: '请输入剩余字符数量', trigger: 'blur' }] | ||||
|             }, | ||||
|             loading: false | ||||
|         } | ||||
|     }, | ||||
|     // watch:{ | ||||
|     //     totalNum(newVal,oldVal){ | ||||
|     //         if(newVal!==oldVal){ | ||||
|     //             this.form.changeNum=newVal | ||||
|     //         } | ||||
|     //     } | ||||
|     // }, | ||||
|     methods: { | ||||
|         resetForm() { | ||||
|             this.form = { | ||||
|                 memberId: undefined, | ||||
|                 platformId: undefined, | ||||
|                 changeNum: 0 | ||||
|             } | ||||
|         }, | ||||
|         handleOpen() { | ||||
|             this.form.changeNum = this.totalNum | ||||
|         }, | ||||
|         handleClose() { | ||||
|             this.resetForm() | ||||
|             this.$emit('update:visible', false) | ||||
|             this.$emit('close') | ||||
|         }, | ||||
|         cancel() { | ||||
|             this.loading = false | ||||
|             this.handleClose() | ||||
|         }, | ||||
|         submitForm() { | ||||
|             this.$refs['form'].validate(valid => { | ||||
|                 if (valid) { | ||||
|                     this.loading = true | ||||
|                     this.form.memberId = this.memberId | ||||
|                     this.form.platformId = this.platformId | ||||
|                     this.form.type=this.type | ||||
|  | ||||
|                     tmMemberPlatformChangeChar(this.form).then(response => { | ||||
|                         if (response.code === 200) { | ||||
|                             this.$message.success('修改成功') | ||||
|                             this.handleClose() | ||||
|                         } else { | ||||
|                             this.$message.error(response.message) | ||||
|                         } | ||||
|                     }) | ||||
|                         .finally(() => { | ||||
|                             this.loading = false | ||||
|                         }) | ||||
|                 } | ||||
|             }) | ||||
|         } | ||||
|     } | ||||
| } | ||||
| </script> | ||||
							
								
								
									
										123
									
								
								src/views/admin/tm-member/tm-member-deduct.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/views/admin/tm-member/tm-member-deduct.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,123 @@ | ||||
| <template> | ||||
|   <el-dialog title="字符扣除" :visible.sync="value" width="500px" @close="handleClose" @open="handleOpen"> | ||||
|     <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||||
|       <el-form-item label="用户昵称" prop="nickName"> | ||||
|         {{ nickName }} | ||||
|       </el-form-item> | ||||
|       <el-form-item label="翻译平台" prop="platformId"> | ||||
|         <el-select v-model="form.platformId" placeholder="请选择翻译平台"> | ||||
|           <el-option v-for="item in platformList" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="apiKey"> | ||||
|         {{ apiKey }} | ||||
|       </el-form-item> | ||||
|       <el-form-item label="扣除字符(万)" prop="totalChars"> | ||||
|         <el-input v-model.number="form.totalChars" placeholder="充值字符(万)" /> | ||||
|       </el-form-item> | ||||
|  | ||||
|     </el-form> | ||||
|     <div slot="footer" class="dialog-footer"> | ||||
|       <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||
|       <el-button @click="cancel">取 消</el-button> | ||||
|     </div> | ||||
|   </el-dialog> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { tmMemberManageDeduct } from '@/api/admin/tm-member' | ||||
| import { listTmPlatform } from '@/api/admin/tm-platform' | ||||
|  | ||||
| export default { | ||||
|   name: 'TmMemberRecharge', | ||||
|   props: { | ||||
|     value: { | ||||
|       type: Boolean, | ||||
|       default: false | ||||
|     }, | ||||
|     apiKey: { | ||||
|       type: String, | ||||
|       default: '' | ||||
|     }, | ||||
|     nickName: { | ||||
|       type: String, | ||||
|       default: '' | ||||
|     }, | ||||
|     memberId: { | ||||
|       type: Number, | ||||
|       default: 0 | ||||
|     }, | ||||
|     userId: { | ||||
|       type: Number, | ||||
|       default: 0 | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       loading: false, | ||||
|       form: {}, | ||||
|       remainChars: 0, | ||||
|       rules: { | ||||
|         platformId: [{ required: true, message: '请选择翻译平台', trigger: 'blur' }], | ||||
|         totalChars: [{ required: true, message: '请输入扣除字符(万)', trigger: 'blur' }] | ||||
|       }, | ||||
|       platformList: [] | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   methods: { | ||||
|     handleOpen() { | ||||
|       this.getPlatform() | ||||
|     }, | ||||
|     getPlatform() { | ||||
|       listTmPlatform({ pageIndex: 1, pageSize: 1000 }).then(response => { | ||||
|         if (response.code === 200) { | ||||
|           this.platformList = response.data.list | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     resetForm() { | ||||
|       this.form = { | ||||
|         id: undefined, | ||||
|         apiKey: undefined, | ||||
|         totalChars: undefined, | ||||
|         userId: undefined, | ||||
|         memberId: undefined, | ||||
|         expireDays: undefined | ||||
|       } | ||||
|     }, | ||||
|     handleClose() { | ||||
|       this.resetForm() | ||||
|       this.$emit('input', false) | ||||
|       this.$emit('close') | ||||
|     }, | ||||
|     cancel() { | ||||
|       this.loading = false | ||||
|       this.handleClose() | ||||
|     }, | ||||
|     submitForm() { | ||||
|       this.$refs['form'].validate(valid => { | ||||
|         if (valid) { | ||||
|           this.loading = true | ||||
|           this.form.memberId = this.memberId | ||||
|           this.form.userId = this.userId | ||||
|           const platform = this.platformList.find(item => item.id === this.form.platformId) | ||||
|           this.form.platformCode = platform.code | ||||
|  | ||||
|           tmMemberManageDeduct(this.form).then(response => { | ||||
|             if (response.code === 200) { | ||||
|               this.$message.success('操作成功') | ||||
|               this.handleClose() | ||||
|             } else { | ||||
|               this.$message.error(response.message) | ||||
|             } | ||||
|           }) | ||||
|             .finally(() => { | ||||
|               this.loading = false | ||||
|             }) | ||||
|         } | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
| @ -1,114 +1,141 @@ | ||||
| <template> | ||||
|   <el-dialog title="字符充值" :visible.sync="value" width="500px" @close="handleClose" @open="handleOpen"> | ||||
|     <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||||
|       <el-form-item label="用户昵称" prop="nickName"> | ||||
|         {{ nickName }} | ||||
|       </el-form-item> | ||||
|       <el-form-item label="翻译平台" prop="platformId"> | ||||
|         <el-select v-model="form.platformId" placeholder="请选择翻译平台"> | ||||
|           <el-option v-for="item in platformList" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="apiKey"> | ||||
|         {{ apiKey }} | ||||
|       </el-form-item> | ||||
|       <el-form-item label="充值字符(万)" prop="totalChars"> | ||||
|         <el-input v-model.number="form.totalChars" placeholder="充值字符(万)" /> | ||||
|       </el-form-item> | ||||
|     </el-form> | ||||
|     <div slot="footer" class="dialog-footer"> | ||||
|       <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||
|       <el-button @click="cancel">取 消</el-button> | ||||
|     </div> | ||||
|   </el-dialog> | ||||
|     <el-dialog title="字符充值" :visible.sync="value" width="500px" @close="handleClose" @open="handleOpen"> | ||||
|         <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||||
|             <el-form-item label="用户昵称" prop="nickName"> | ||||
|                 {{ nickName }} | ||||
|             </el-form-item> | ||||
|             <el-form-item label="翻译平台" prop="platformId"> | ||||
|                 <el-select v-model="form.platformId" placeholder="请选择翻译平台"> | ||||
|                     <el-option v-for="item in platformList" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|                 </el-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="apiKey"> | ||||
|                 {{ apiKey }} | ||||
|             </el-form-item> | ||||
|             <el-form-item label="充值金额(U)" prop="amount"> | ||||
|                 <el-input v-model.number="form.amount" placeholder="充值金额(U)" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="充值字符(万)" prop="totalChars"> | ||||
|                 <el-input v-model.number="form.totalChars" placeholder="充值字符(万)" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="过期时间(天)" prop="expireDays"> | ||||
|                 <el-input v-model.number="form.expireDays" placeholder="过期时间(天)" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="收款渠道"> | ||||
|                 <el-select v-model="form.payChannel" clearable placeholder="请选择收款渠道"> | ||||
|                     <el-option label="TRX" value="TRX" /> | ||||
|                 </el-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="收款地址"> | ||||
|                 <el-input v-model="form.payAddress" placeholder="收款地址" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="交易hash"> | ||||
|                 <el-input v-model="form.txHash" placeholder="交易hash" /> | ||||
|             </el-form-item> | ||||
|              | ||||
|         </el-form> | ||||
|         <div slot="footer" class="dialog-footer"> | ||||
|             <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||
|             <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|     </el-dialog> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { tmMemberRecharge } from '@/api/admin/tm-member' | ||||
| import { tmMemberManageRecharge } from '@/api/admin/tm-member' | ||||
| import { listTmPlatform } from '@/api/admin/tm-platform' | ||||
|  | ||||
| export default { | ||||
|   name: 'TmMemberRecharge', | ||||
|   props: { | ||||
|     value: { | ||||
|       type: Boolean, | ||||
|       default: false | ||||
|     }, | ||||
|     apiKey: { | ||||
|       type: String, | ||||
|       default: '' | ||||
|     }, | ||||
|     nickName: { | ||||
|       type: String, | ||||
|       default: '' | ||||
|     }, | ||||
|     id: { | ||||
|       type: Number, | ||||
|       default: 0 | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       loading: false, | ||||
|       form: {}, | ||||
|       remainChars: 0, | ||||
|       rules: { | ||||
|         platformId: [{ required: true, message: '请选择翻译平台', trigger: 'blur' }], | ||||
|         totalChars: [{ required: true, message: '请输入充值字符(万)', trigger: 'blur' }] | ||||
|       }, | ||||
|       platformList: [] | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   methods: { | ||||
|     handleOpen() { | ||||
|       this.getPlatform() | ||||
|     }, | ||||
|     getPlatform() { | ||||
|       listTmPlatform({ pageIndex: 1, pageSize: 1000 }).then(response => { | ||||
|         if (response.code === 200) { | ||||
|           this.platformList = response.data.list | ||||
|     name: 'TmMemberRecharge', | ||||
|     props: { | ||||
|         value: { | ||||
|             type: Boolean, | ||||
|             default: false | ||||
|         }, | ||||
|         apiKey: { | ||||
|             type: String, | ||||
|             default: '' | ||||
|         }, | ||||
|         nickName: { | ||||
|             type: String, | ||||
|             default: '' | ||||
|         }, | ||||
|         memberId: { | ||||
|             type: Number, | ||||
|             default: 0 | ||||
|         }, | ||||
|         userId: { | ||||
|             type: Number, | ||||
|             default: 0 | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     resetForm() { | ||||
|       this.form = { | ||||
|         id: undefined, | ||||
|         apiKey: undefined, | ||||
|         totalChars: undefined | ||||
|       } | ||||
|     data() { | ||||
|         return { | ||||
|             loading: false, | ||||
|             form: {}, | ||||
|             remainChars: 0, | ||||
|             rules: { | ||||
|                 platformId: [{ required: true, message: '请选择翻译平台', trigger: 'blur' }], | ||||
|                 totalChars: [{ required: true, message: '请输入充值字符(万)', trigger: 'blur' }], | ||||
|                 expireDays: [{ required: true, message: '请输入过期时间(天)', trigger: 'blur' }] | ||||
|             }, | ||||
|             platformList: [] | ||||
|         } | ||||
|     }, | ||||
|     handleClose() { | ||||
|       this.resetForm() | ||||
|       this.$emit('input', false) | ||||
|       this.$emit('close') | ||||
|     }, | ||||
|     cancel() { | ||||
|       this.loading = false | ||||
|       this.handleClose() | ||||
|     }, | ||||
|     submitForm() { | ||||
|       this.$refs['form'].validate(valid => { | ||||
|         if (valid) { | ||||
|           this.loading = true | ||||
|           this.form.id = this.id | ||||
|           const platform = this.platformList.find(item => item.id === this.form.platformId) | ||||
|           this.form.platformCode = platform.code | ||||
|  | ||||
|           tmMemberRecharge(this.form).then(response => { | ||||
|             if (response.code === 200) { | ||||
|               this.$message.success('充值成功!') | ||||
|               this.handleClose() | ||||
|             } else { | ||||
|               this.$message.error(response.message) | ||||
|     methods: { | ||||
|         handleOpen() { | ||||
|             this.getPlatform() | ||||
|         }, | ||||
|         getPlatform() { | ||||
|             listTmPlatform({ pageIndex: 1, pageSize: 1000 }).then(response => { | ||||
|                 if (response.code === 200) { | ||||
|                     this.platformList = response.data.list | ||||
|                 } | ||||
|             }) | ||||
|         }, | ||||
|         resetForm() { | ||||
|             this.form = { | ||||
|                 id: undefined, | ||||
|                 apiKey: undefined, | ||||
|                 totalChars: undefined, | ||||
|                 userId:undefined, | ||||
|                 memberId:undefined, | ||||
|                 expireDays: undefined, | ||||
|             } | ||||
|           }) | ||||
|             .finally(() => { | ||||
|               this.loading = false | ||||
|         }, | ||||
|         handleClose() { | ||||
|             this.resetForm() | ||||
|             this.$emit('input', false) | ||||
|             this.$emit('close') | ||||
|         }, | ||||
|         cancel() { | ||||
|             this.loading = false | ||||
|             this.handleClose() | ||||
|         }, | ||||
|         submitForm() { | ||||
|             this.$refs['form'].validate(valid => { | ||||
|                 if (valid) { | ||||
|                     this.loading = true | ||||
|                     this.form.memberId = this.memberId | ||||
|                     this.form.userId = this.userId | ||||
|                     const platform = this.platformList.find(item => item.id === this.form.platformId) | ||||
|                     this.form.platformCode = platform.code | ||||
|  | ||||
|                     tmMemberManageRecharge(this.form).then(response => { | ||||
|                         if (response.code === 200) { | ||||
|                             this.$message.success('充值成功!') | ||||
|                             this.handleClose() | ||||
|                         } else { | ||||
|                             this.$message.error(response.message) | ||||
|                         } | ||||
|                     }) | ||||
|                         .finally(() => { | ||||
|                             this.loading = false | ||||
|                         }) | ||||
|                 } | ||||
|             }) | ||||
|         } | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
| </script> | ||||
|  | ||||
| @ -71,12 +71,21 @@ | ||||
|             align="center" | ||||
|             prop="apiSecret" | ||||
|             :show-overflow-tooltip="true" | ||||
|           /><el-table-column | ||||
|           /> | ||||
|           <el-table-column label="剩余字符" align="center" prop="remainChars" :show-overflow-tooltip="true" /> | ||||
|  | ||||
|           <el-table-column label="状态" align="center" width="80px"> | ||||
|             <template slot-scope="scope"> | ||||
|               <el-tag v-if="scope.row.status === 1" type="success">启用</el-tag> | ||||
|               <el-tag v-else type="danger">禁用</el-tag> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <!-- <el-table-column | ||||
|             label="qps限制" | ||||
|             align="center" | ||||
|             prop="qpsLimit" | ||||
|             :show-overflow-tooltip="true" | ||||
|           /> | ||||
|           /> --> | ||||
|           <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|             <template slot-scope="scope"> | ||||
|               <el-popconfirm | ||||
| @ -109,6 +118,21 @@ | ||||
|                 >删除 | ||||
|                 </el-button> | ||||
|               </el-popconfirm> | ||||
|               <el-popconfirm | ||||
|                 class="delete-popconfirm" | ||||
|                 title="确定要查询剩余字符吗?" | ||||
|                 confirm-button-text="查询" | ||||
|                 @confirm="handleQueryRemainChars(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
|                   v-permisaction="['admin:tmPlatformAccount:query']" | ||||
|                   size="mini" | ||||
|                   type="text" | ||||
|                   icon="el-icon-s-data" | ||||
|                 >查询 | ||||
|                 </el-button> | ||||
|               </el-popconfirm> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </el-table> | ||||
| @ -155,7 +179,7 @@ | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|           <div slot="footer" class="dialog-footer"> | ||||
|             <el-button type="primary" @click="submitForm">确 定</el-button> | ||||
|             <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||
|             <el-button @click="cancel">取 消</el-button> | ||||
|           </div> | ||||
|         </el-dialog> | ||||
| @ -165,7 +189,7 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { addTmPlatformAccount, delTmPlatformAccount, getTmPlatformAccount, listTmPlatformAccount, updateTmPlatformAccount } from '@/api/admin/tm-platform-account' | ||||
| import { addTmPlatformAccount, delTmPlatformAccount, getTmPlatformAccount, listTmPlatformAccount, updateTmPlatformAccount, tmPlatformAccountRemain } from '@/api/admin/tm-platform-account' | ||||
| import { listTmPlatform } from '@/api/admin/tm-platform' | ||||
|  | ||||
| export default { | ||||
| @ -347,6 +371,24 @@ export default { | ||||
|         } | ||||
|       }).catch(function() { | ||||
|       }) | ||||
|     }, | ||||
|     /** | ||||
|      * 查询字符余额 | ||||
|      *  */ | ||||
|     handleQueryRemainChars(row) { | ||||
|       this.loading = true | ||||
|  | ||||
|       tmPlatformAccountRemain(row.id).then(response => { | ||||
|         if (response.code === 200) { | ||||
|           this.msgSuccess(response.msg) | ||||
|           this.getList() | ||||
|         } else { | ||||
|           this.msgError(response.msg) | ||||
|         } | ||||
|       }) | ||||
|         .finally(() => { | ||||
|           this.loading = false | ||||
|         }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -153,7 +153,13 @@ | ||||
|         <el-dialog :title="title" :visible.sync="open" width="600px"> | ||||
|           <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||||
|             <el-form-item label="平台编码" prop="code"> | ||||
|               <el-input v-model="form.code" placeholder="平台编码" show-word-limit maxlength="20" :disabled="isEdit" /> | ||||
|               <el-input | ||||
|                 v-model="form.code" | ||||
|                 placeholder="平台编码" | ||||
|                 show-word-limit | ||||
|                 maxlength="20" | ||||
|                 :disabled="isEdit" | ||||
|               /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="平台名称" prop="name"> | ||||
|               <el-input v-model="form.name" placeholder="平台名称" show-word-limit maxlength="20" /> | ||||
| @ -173,9 +179,22 @@ | ||||
|             <el-form-item label="单价" prop="price"> | ||||
|               <el-input v-model="form.price" placeholder="单价" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="收款链" prop="blockChain"> | ||||
|               <el-select v-model="form.blockChain" placeholder="请选择"> | ||||
|                 <el-option | ||||
|                   v-for="item in blockChainOptions" | ||||
|                   :key="'blockChain'+item.value" | ||||
|                   :label="item.label" | ||||
|                   :value="item.value" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="钱包地址" prop="receiveAddress"> | ||||
|               <el-input v-model="form.receiveAddress" placeholder="钱包地址" show-word-limit maxlength="100" /> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|           <div slot="footer" class="dialog-footer"> | ||||
|             <el-button type="primary" @click="submitForm">确 定</el-button> | ||||
|             <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||
|             <el-button @click="cancel">取 消</el-button> | ||||
|           </div> | ||||
|         </el-dialog> | ||||
| @ -215,7 +234,10 @@ export default { | ||||
|       tmPlatformList: [], | ||||
|       codeOptions: [], | ||||
|       // 关系表类型 | ||||
|  | ||||
|       blockChainOptions: [{ | ||||
|         label: 'TRX', | ||||
|         value: 'trx' | ||||
|       }], | ||||
|       // 查询参数 | ||||
|       queryParams: { | ||||
|         pageIndex: 1, | ||||
| @ -226,6 +248,8 @@ export default { | ||||
|         code: undefined, | ||||
|         character: undefined, | ||||
|         price: undefined, | ||||
|         blockChain: 'trx', | ||||
|         receiveAddress: undefined, | ||||
|         idOrder: 'desc' | ||||
|       }, | ||||
|       // 表单参数 | ||||
| @ -238,7 +262,9 @@ export default { | ||||
|         apiBaseUrl: [{ required: true, message: '平台接口地址不能为空', trigger: 'blur' }], | ||||
|         code: [{ required: true, message: '平台编码(字典 tm_platform)不能为空', trigger: 'blur' }], | ||||
|         character: [{ required: true, message: '字符数不能为空', trigger: 'blur' }], | ||||
|         price: [{ required: true, message: '单价不能为空', trigger: 'blur' }] | ||||
|         price: [{ required: true, message: '单价不能为空', trigger: 'blur' }], | ||||
|         blockChain: [{ required: true, message: '请选择钱包类型', trigger: 'blur' }], | ||||
|         receiveAddress: [{ required: true, message: '钱包地址不能为空', trigger: 'blur' }] | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
| @ -275,7 +301,9 @@ export default { | ||||
|         description: undefined, | ||||
|         code: undefined, | ||||
|         character: undefined, | ||||
|         price: undefined | ||||
|         price: undefined, | ||||
|         blockChain: 'trx', | ||||
|         receiveAddress: undefined | ||||
|       } | ||||
|       this.resetForm('form') | ||||
|     }, | ||||
| @ -331,6 +359,9 @@ export default { | ||||
|     submitForm: function() { | ||||
|       this.$refs['form'].validate(valid => { | ||||
|         if (valid) { | ||||
|           this.form.price = Number(this.form.price) | ||||
|           this.form.character = Number(this.form.character) | ||||
|  | ||||
|           if (this.form.id !== undefined) { | ||||
|             updateTmPlatform(this.form).then(response => { | ||||
|               if (response.code === 200) { | ||||
|  | ||||
							
								
								
									
										390
									
								
								src/views/admin/tm-recharge-package/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										390
									
								
								src/views/admin/tm-recharge-package/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,390 @@ | ||||
|  | ||||
| <template> | ||||
|   <BasicLayout> | ||||
|     <template #wrapper> | ||||
|       <el-card class="box-card"> | ||||
|         <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px"> | ||||
|           <el-form-item label="平台id" prop="platformId"><el-select | ||||
|             v-model="queryParams.platformId" | ||||
|             placeholder="请选择" | ||||
|             clearable | ||||
|             size="small" | ||||
|           > | ||||
|             <el-option | ||||
|               v-for="dict in platformIdOptions" | ||||
|               :key="dict.key" | ||||
|               :label="dict.value" | ||||
|               :value="dict.key" | ||||
|             /> | ||||
|           </el-select> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="状态" prop="status"> | ||||
|             <el-select v-model="queryParams.status" placeholder="请选择" clearable size="small"> | ||||
|               <el-option | ||||
|                 v-for="dict in statusOptions" | ||||
|                 :key="dict.value" | ||||
|                 :label="dict.label" | ||||
|                 :value="dict.value" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item> | ||||
|             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||||
|             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|  | ||||
|         <el-row :gutter="10" class="mb8"> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               v-permisaction="['admin:tmRechargePackage:add']" | ||||
|               type="primary" | ||||
|               icon="el-icon-plus" | ||||
|               size="mini" | ||||
|               @click="handleAdd" | ||||
|             >新增 | ||||
|             </el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               v-permisaction="['admin:tmRechargePackage:edit']" | ||||
|               type="success" | ||||
|               icon="el-icon-edit" | ||||
|               size="mini" | ||||
|               :disabled="single" | ||||
|               @click="handleUpdate" | ||||
|             >修改 | ||||
|             </el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               v-permisaction="['admin:tmRechargePackage:remove']" | ||||
|               type="danger" | ||||
|               icon="el-icon-delete" | ||||
|               size="mini" | ||||
|               :disabled="multiple" | ||||
|               @click="handleDelete" | ||||
|             >删除 | ||||
|             </el-button> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|  | ||||
|         <el-table v-loading="loading" :data="tmRechargePackageList" @selection-change="handleSelectionChange"> | ||||
|           <el-table-column type="selection" width="55" align="center" /> | ||||
|           <el-table-column label="平台" align="center" prop="platformId" :formatter="platformIdFormat"> | ||||
|             <template slot-scope="scope"> | ||||
|               {{ platformIdFormat(scope.row) }} | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column | ||||
|             label="套餐金额(U)" | ||||
|             align="center" | ||||
|             prop="amount" | ||||
|             :show-overflow-tooltip="true" | ||||
|           /> | ||||
|           <el-table-column | ||||
|             label="状态" | ||||
|             align="center" | ||||
|             prop="status" | ||||
|             width="100" | ||||
|           > | ||||
|             <template slot-scope="scope"> | ||||
|               {{ statusFormat(scope.row) }} | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width"> | ||||
|             <template slot-scope="scope"> | ||||
|               <el-popconfirm | ||||
|                 class="delete-popconfirm" | ||||
|                 title="确认要修改吗?" | ||||
|                 confirm-button-text="修改" | ||||
|                 @confirm="handleUpdate(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
|                   v-permisaction="['admin:tmRechargePackage:edit']" | ||||
|                   size="mini" | ||||
|                   type="text" | ||||
|                   icon="el-icon-edit" | ||||
|                 >修改 | ||||
|                 </el-button> | ||||
|               </el-popconfirm> | ||||
|               <el-popconfirm | ||||
|                 class="delete-popconfirm" | ||||
|                 title="确认要删除吗?" | ||||
|                 confirm-button-text="删除" | ||||
|                 @confirm="handleDelete(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
|                   v-permisaction="['admin:tmRechargePackage:remove']" | ||||
|                   size="mini" | ||||
|                   type="text" | ||||
|                   icon="el-icon-delete" | ||||
|                 >删除 | ||||
|                 </el-button> | ||||
|               </el-popconfirm> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </el-table> | ||||
|  | ||||
|         <pagination | ||||
|           v-show="total>0" | ||||
|           :total="total" | ||||
|           :page.sync="queryParams.pageIndex" | ||||
|           :limit.sync="queryParams.pageSize" | ||||
|           @pagination="getList" | ||||
|         /> | ||||
|  | ||||
|         <!-- 添加或修改对话框 --> | ||||
|         <el-dialog :title="title" :visible.sync="open" width="500px"> | ||||
|           <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | ||||
|  | ||||
|             <el-form-item label="平台" prop="platformId"> | ||||
|               <el-select | ||||
|                 v-model="form.platformId" | ||||
|                 placeholder="请选择" | ||||
|               > | ||||
|                 <el-option | ||||
|                   v-for="dict in platformIdOptions" | ||||
|                   :key="dict.key" | ||||
|                   :label="dict.value" | ||||
|                   :value="dict.id" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="套餐金额(U)" prop="amount"> | ||||
|               <el-input | ||||
|                 v-model.number="form.amount" | ||||
|                 placeholder="套餐金额(U)" | ||||
|               /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="状态" prop="status"> | ||||
|               <el-radio-group v-model="form.status"> | ||||
|                 <el-radio | ||||
|                   v-for="dict in statusOptions" | ||||
|                   :key="dict.value" | ||||
|                   :label="dict.value" | ||||
|                 >{{ dict.label }}</el-radio> | ||||
|               </el-radio-group> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|           <div slot="footer" class="dialog-footer"> | ||||
|             <el-button type="primary" @click="submitForm">确 定</el-button> | ||||
|             <el-button @click="cancel">取 消</el-button> | ||||
|           </div> | ||||
|         </el-dialog> | ||||
|       </el-card> | ||||
|     </template> | ||||
|   </BasicLayout> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { addTmRechargePackage, delTmRechargePackage, getTmRechargePackage, listTmRechargePackage, updateTmRechargePackage } from '@/api/admin/tm-recharge-package' | ||||
|  | ||||
| import { listTmPlatform } from '@/api/admin/tm-platform' | ||||
| export default { | ||||
|   name: 'TmRechargePackage', | ||||
|   components: { | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       // 遮罩层 | ||||
|       loading: true, | ||||
|       // 选中数组 | ||||
|       ids: [], | ||||
|       // 非单个禁用 | ||||
|       single: true, | ||||
|       // 非多个禁用 | ||||
|       multiple: true, | ||||
|       // 总条数 | ||||
|       total: 0, | ||||
|       // 弹出层标题 | ||||
|       title: '', | ||||
|       // 是否显示弹出层 | ||||
|       open: false, | ||||
|       isEdit: false, | ||||
|       // 类型数据字典 | ||||
|       typeOptions: [], | ||||
|       tmRechargePackageList: [], | ||||
|       statusOptions: [{ | ||||
|         value: 1, | ||||
|         label: '启用' | ||||
|       }, { | ||||
|         value: 2, | ||||
|         label: '禁用' | ||||
|       }], | ||||
|       // 关系表类型 | ||||
|       platformIdOptions: [], | ||||
|  | ||||
|       // 查询参数 | ||||
|       queryParams: { | ||||
|         pageIndex: 1, | ||||
|         pageSize: 10, | ||||
|         platformId: undefined, | ||||
|         status: undefined | ||||
|  | ||||
|       }, | ||||
|       // 表单参数 | ||||
|       form: { | ||||
|       }, | ||||
|       // 表单校验 | ||||
|       rules: { platformId: [{ required: true, message: '平台不能为空', trigger: 'blur' }], | ||||
|         status: [{ required: true, message: '状态不能为空', trigger: 'blur' }], | ||||
|         amount: [{ required: true, message: '套餐金额不能为空', trigger: 'blur' }] | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.getList() | ||||
|     this.getTmPlatformItems() | ||||
|   }, | ||||
|   methods: { | ||||
|     statusFormat(row) { | ||||
|       const status = this.statusOptions.find(item => item.value === row.status) | ||||
|       return status ? status.label : '' | ||||
|     }, | ||||
|     /** 查询参数列表 */ | ||||
|     getList() { | ||||
|       this.loading = true | ||||
|       listTmRechargePackage(this.addDateRange(this.queryParams, this.dateRange)).then(response => { | ||||
|         this.tmRechargePackageList = response.data.list | ||||
|         this.total = response.data.count | ||||
|         this.loading = false | ||||
|       } | ||||
|       ) | ||||
|     }, | ||||
|     // 取消按钮 | ||||
|     cancel() { | ||||
|       this.open = false | ||||
|       this.reset() | ||||
|     }, | ||||
|     // 表单重置 | ||||
|     reset() { | ||||
|       this.form = { | ||||
|  | ||||
|         id: undefined, | ||||
|         platformId: undefined, | ||||
|         amount: undefined, | ||||
|         status: undefined | ||||
|       } | ||||
|       this.resetForm('form') | ||||
|     }, | ||||
|     getImgList: function() { | ||||
|       this.form[this.fileIndex] = this.$refs['fileChoose'].resultList[0].fullUrl | ||||
|     }, | ||||
|     fileClose: function() { | ||||
|       this.fileOpen = false | ||||
|     }, | ||||
|     platformIdFormat(row) { | ||||
|       return this.selectItemsLabel(this.platformIdOptions, row.platformId) | ||||
|     }, | ||||
|     // 关系 | ||||
|     getTmPlatformItems() { | ||||
|       this.getItems(listTmPlatform, undefined).then(res => { | ||||
|         const items = this.setItems(res, 'id', 'name') | ||||
|         this.platformIdOptions = items.map(item => ({ | ||||
|           ...item, // 复制所有现有属性 | ||||
|           id: parseInt(item.key, 10) // 将 id 属性转换为整数 | ||||
|         })) | ||||
|       }) | ||||
|     }, | ||||
|     // 文件 | ||||
|     /** 搜索按钮操作 */ | ||||
|     handleQuery() { | ||||
|       this.queryParams.pageIndex = 1 | ||||
|       this.getList() | ||||
|     }, | ||||
|     /** 重置按钮操作 */ | ||||
|     resetQuery() { | ||||
|       this.dateRange = [] | ||||
|       this.resetForm('queryForm') | ||||
|       this.handleQuery() | ||||
|     }, | ||||
|     /** 新增按钮操作 */ | ||||
|     handleAdd() { | ||||
|       this.reset() | ||||
|       this.open = true | ||||
|       this.title = '添加充值套餐' | ||||
|       this.isEdit = false | ||||
|     }, | ||||
|     // 多选框选中数据 | ||||
|     handleSelectionChange(selection) { | ||||
|       this.ids = selection.map(item => item.id) | ||||
|       this.single = selection.length !== 1 | ||||
|       this.multiple = !selection.length | ||||
|     }, | ||||
|     /** 修改按钮操作 */ | ||||
|     handleUpdate(row) { | ||||
|       this.reset() | ||||
|       const id = | ||||
|                 row.id || this.ids | ||||
|       getTmRechargePackage(id).then(response => { | ||||
|         this.form = response.data | ||||
|         this.open = true | ||||
|         this.title = '修改tm_recharge_package' | ||||
|         this.isEdit = true | ||||
|       }) | ||||
|     }, | ||||
|     /** 提交按钮 */ | ||||
|     submitForm: function() { | ||||
|       this.$refs['form'].validate(valid => { | ||||
|         if (valid) { | ||||
|           this.loading = true | ||||
|           this.form.platformId = Number(this.form.platformId) | ||||
|  | ||||
|           if (this.form.id !== undefined) { | ||||
|             updateTmRechargePackage(this.form).then(response => { | ||||
|               if (response.code === 200) { | ||||
|                 this.msgSuccess(response.msg) | ||||
|                 this.open = false | ||||
|                 this.getList() | ||||
|               } else { | ||||
|                 this.msgError(response.msg) | ||||
|               } | ||||
|             }) | ||||
|               .finally(() => { | ||||
|                 this.loading = false | ||||
|               }) | ||||
|           } else { | ||||
|             addTmRechargePackage(this.form).then(response => { | ||||
|               if (response.code === 200) { | ||||
|                 this.msgSuccess(response.msg) | ||||
|                 this.open = false | ||||
|                 this.getList() | ||||
|               } else { | ||||
|                 this.msgError(response.msg) | ||||
|               } | ||||
|             }) | ||||
|               .finally(() => { | ||||
|                 this.loading = false | ||||
|               }) | ||||
|           } | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     /** 删除按钮操作 */ | ||||
|     handleDelete(row) { | ||||
|       var Ids = (row.id && [row.id]) || this.ids | ||||
|  | ||||
|       this.$confirm('是否确认删除编号为"' + Ids + '"的数据项?', '警告', { | ||||
|         confirmButtonText: '确定', | ||||
|         cancelButtonText: '取消', | ||||
|         type: 'warning' | ||||
|       }).then(function() { | ||||
|         return delTmRechargePackage({ 'ids': Ids }) | ||||
|       }).then((response) => { | ||||
|         if (response.code === 200) { | ||||
|           this.msgSuccess(response.msg) | ||||
|           this.open = false | ||||
|           this.getList() | ||||
|         } else { | ||||
|           this.msgError(response.msg) | ||||
|         } | ||||
|       }).catch(function() { | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
| @ -109,11 +109,13 @@ | ||||
|                 icon="el-icon-view" | ||||
|                 @click="handlePreview(scope.row)" | ||||
|               >预览</el-button> | ||||
|  | ||||
|  | ||||
|               <el-popconfirm | ||||
|                 class="delete-popconfirm" | ||||
|                 title="正在使用代码生成请确认?" | ||||
|                 confirm-button-text="生成" | ||||
|                 @onConfirm="handleToProject(scope.row)" | ||||
|                 @confirm="handleToProject(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
| @ -127,7 +129,7 @@ | ||||
|                 class="delete-popconfirm" | ||||
|                 title="正在使用【菜单以及API生成到数据库】请确认?" | ||||
|                 confirm-button-text="写入DB" | ||||
|                 @onConfirm="handleToDB(scope.row)" | ||||
|                 @confirm="handleToDB(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
| @ -141,7 +143,7 @@ | ||||
|                 class="delete-popconfirm" | ||||
|                 title="正在使用代码生成配置迁移脚本请确认?" | ||||
|                 confirm-button-text="生成" | ||||
|                 @onConfirm="handleToApiFile(scope.row)" | ||||
|                 @confirm="handleToApiFile(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
| @ -154,7 +156,7 @@ | ||||
|               <el-popconfirm | ||||
|                 class="delete-popconfirm" | ||||
|                 title="确认删除数据项?" | ||||
|                 @onConfirm="handleSingleDelete(scope.row)" | ||||
|                 @confirm="handleSingleDelete(scope.row)" | ||||
|               > | ||||
|                 <el-button | ||||
|                   slot="reference" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user