提交 7741fea6 作者: 毛细亚

优化礼包发送功能与界面交互

上级 53bba110
......@@ -7,7 +7,8 @@
<div>礼包名称: {{ item.gift_package_name }}</div>
<div>发送时间: {{ item.send_time }}</div>
<div>礼包码: {{ item.code }}</div>
<div>领取角色: {{ item.role_name }}({{ item.rule_id }})</div>
<div>领取角色: <span v-if="item.role_name">{{ item.role_name }}({{ item.rule_id }})</span> <span v-else>-</span>
</div>
<div>W 账号: {{ item.username || '-' }}</div>
<div class="rowFlex spaceBetween columnCenter gift-sender">
<div>发送客服: {{ item.cser_name }}</div>
......@@ -23,7 +24,6 @@
</div>
</div>
</template>
<script>
import Clipboard from 'clipboard'
import { getSendingCodeList } from '@/api/works'
......
......@@ -2,7 +2,7 @@
* @Author: maoxiya 937667504@qq.com
* @Date: 2025-08-28 15:59:46
* @LastEditors: maoxiya 937667504@qq.com
* @LastEditTime: 2025-08-30 11:35:36
* @LastEditTime: 2025-08-30 18:43:01
* @FilePath: /company_wx_frontend/src/views/works/component/chat/giftCodeDialog.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......
......@@ -19,7 +19,7 @@
</div>
<div class="rowFlex columnCenter spaceBetween gameCodeTitle" @click="showGameCode = !showGameCode">
<p class="rowFlex columnCenter spaceBetween">
<svg-icon icon-class="gift" style="font-size:25px;margin-right: 5px;margin-top: -2px;"></svg-icon>
<svg-icon icon-class="gift" style="font-size:20px;margin-right: 5px;margin-top: -2px;"></svg-icon>
<span class="giftCode">礼包码</span>
</p>
<i :class="showGameCode ? 'el-icon-arrow-right' : 'el-icon-arrow-down'"></i>
......@@ -46,7 +46,7 @@
</el-popover>
</p>
<el-button size="mini" type="primary" :loading="loading"
@click="sendGameCode(items)">发送礼包码</el-button>
@click="sendGameCodeCopyDialog(items)">发送礼包码</el-button>
</div>
</div>
</div>
......@@ -58,7 +58,7 @@
</el-collapse>
</el-collapse-transition>
</div>
<giftCodeDialog ref="giftCodeDialog" :dialogVisible="dialogVisible" @result="getGiftCodeSubmit" />
<giftCodeDialog v-if="dialogVisible" :dialogVisible.sync="dialogVisible" @result="getGiftCodeSubmit" />
</div>
</template>
<script>
......@@ -73,12 +73,32 @@ export default {
disabled: true,
showGameCode: false,
giftCodeGame: [],
dialogVisible: false,
giftCodeForm: {
member_id: '',
username: '',
role_name: '',
role_id: '',
gift_package_id: '',
},
loading: false
}
},
components: {
giftCodeDialog
},
mounted() {
this.requestGiftCode()
},
destroyed() {
this.giftCodeForm = {
member_id: '',
username: '',
role_name: '',
role_id: '',
gift_package_id: ''
}
},
computed: {
...mapState('game', ['accountSelect', 'bindGameUserList', 'chatUserInfo']),
...mapState('user', ['userid']),
......@@ -96,6 +116,16 @@ export default {
}
},
methods: {
initGiftCodeForm() {
const username = this.bindGameUserList.find(item => item.member_id === this.accountSelect).username
this.giftCodeForm = {
member_id: this.accountSelect,
username: username,
role_name: '',
role_id: '',
gift_package_id: '',
}
},
sendVipGift() {
if (this.bindGameUserList.length > 0) {
createVipUrl({ member_id: this.accountSelect }).then(res => {
......@@ -109,6 +139,7 @@ export default {
this.$message.warning('请先关联游戏账号')
}
},
sendChatMessage(content, type) {
let message = {}
if (type == 'text') {
......@@ -194,14 +225,35 @@ export default {
item.group_name = item.gift_package_group_name
})
},
// 发送渠道
// 确定提交
getGiftCodeSubmit(form) {
const { member_id, role_id, username, role_name } = form
this.giftCodeForm.username = username
this.giftCodeForm.role_name = role_name
this.giftCodeForm.member_id = member_id
this.giftCodeForm.role_id = role_id
this.sendGameCode()
},
sendGameCodeCopyDialog(items) {
this.initGiftCodeForm()
this.giftCodeForm.gift_package_id = items.id
if (items.package_type == 3) {
this.dialogVisible = true
} else {
this.sendGameCode()
}
},
// 发送礼包码
async sendGameCode(items) {
this.loading = true
const data = {
userid: this.chatUserInfo.userid,
external_userid: this.chatUserInfo.external_userid,
member_id: this.accountSelect,
gift_package_id: items.id,
member_id: this.giftCodeForm.member_id,
username: this.giftCodeForm.username,
role_name: this.giftCodeForm.role_name,
role_id: this.giftCodeForm.role_id,
gift_package_id: this.giftCodeForm.gift_package_id,
user_type: 1
}
const res = await sendGiftCode(data)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论