增加分享优惠券功能
This commit is contained in:
@@ -72,6 +72,13 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16 u-flex u-row-right" style="gap: 16rpx">
|
||||
<view
|
||||
class="btn share"
|
||||
@click="toShare(item)"
|
||||
v-if="item.status == 1"
|
||||
>
|
||||
分享</view
|
||||
>
|
||||
<view class="btn cancel" @click="cancel(item)">失效</view>
|
||||
<view class="btn primary" @click="toDetail(item)"> 查看</view>
|
||||
</view>
|
||||
@@ -84,13 +91,22 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onReachBottom } from "@dcloudio/uni-app";
|
||||
import * as chatApi from "@/http/php/chat";
|
||||
|
||||
import { onReachBottom, onLoad } from "@dcloudio/uni-app";
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import * as chatCouponApi from "@/http/api/market/chat";
|
||||
|
||||
import { useChatStore } from "@/store/chat";
|
||||
|
||||
const chatStore = useChatStore();
|
||||
chatStore.onReceiveMsg = (msg) => {};
|
||||
chatStore.connectSocket();
|
||||
|
||||
function toDetail(item) {
|
||||
uni.setStorageSync("cach_couponActivity", item);
|
||||
uni.setStorageSync("cach_couponActivity", item);
|
||||
go.to("PAGES_CHAT_COUPON_ACTIVITY_DETAIL", {
|
||||
id: item.id,
|
||||
});
|
||||
@@ -133,6 +149,43 @@ function cancelChatCoupon(item) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function sendMsg(msg) {
|
||||
chatStore.sendMessage({
|
||||
to_id: groupInfo.value.id,
|
||||
to_user_type: groupInfo.value.id,
|
||||
chat_type: 2,
|
||||
content: msg.value,
|
||||
image_url: "",
|
||||
order_id: "",
|
||||
session_id: options.session_id,
|
||||
...msg,
|
||||
});
|
||||
}
|
||||
function toShare(item) {
|
||||
sendMsg({
|
||||
coupon: { ...item.couponJson, title: item.title },
|
||||
msg_type: 4,
|
||||
});
|
||||
|
||||
uni.navigateBack({
|
||||
delta: 2,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const options = reactive({});
|
||||
const groupInfo = ref({});
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt);
|
||||
chatApi
|
||||
.groupInfo({
|
||||
group_id: options.group_id,
|
||||
})
|
||||
.then((res) => {
|
||||
groupInfo.value = res || {};
|
||||
});
|
||||
});
|
||||
function cancel(item) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
@@ -248,5 +301,10 @@ onShow(init);
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
&.share {
|
||||
background-color: #ecf5ff;
|
||||
color: $my-main-color;
|
||||
border: 1px solid $my-main-color;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user