|
@@ -18,7 +18,6 @@ import {
|
|
orderPointsSubmit,
|
|
orderPointsSubmit,
|
|
updateMessage,
|
|
updateMessage,
|
|
} from '../../core/libs/requests'
|
|
} from '../../core/libs/requests'
|
|
-import dayjs from 'dayjs'
|
|
|
|
import { MessageType } from '../../core/libs/enums'
|
|
import { MessageType } from '../../core/libs/enums'
|
|
import { ComponentExposed } from 'vue-component-type-helpers'
|
|
import { ComponentExposed } from 'vue-component-type-helpers'
|
|
import { Coupon, Message } from '../../core/libs/models'
|
|
import { Coupon, Message } from '../../core/libs/models'
|
|
@@ -26,9 +25,8 @@ import { requestToast } from '../../core/utils/common'
|
|
import { useUserStore } from '../../store'
|
|
import { useUserStore } from '../../store'
|
|
import { storeToRefs } from 'pinia'
|
|
import { storeToRefs } from 'pinia'
|
|
import MessageCard from './components/message-card.vue'
|
|
import MessageCard from './components/message-card.vue'
|
|
-import CouponCard from '../common/components/coupon-card.vue'
|
|
|
|
-import { select } from 'radash'
|
|
|
|
import { useMessage } from 'wot-design-uni'
|
|
import { useMessage } from 'wot-design-uni'
|
|
|
|
+import CouponsSelector from '../common/components/coupons-selector.vue'
|
|
|
|
|
|
const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
|
|
const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
@@ -40,9 +38,10 @@ const tabs = ref([
|
|
{ label: '系统消息', value: MessageType.System },
|
|
{ label: '系统消息', value: MessageType.System },
|
|
{ label: '互动消息', value: MessageType.Interact },
|
|
{ label: '互动消息', value: MessageType.Interact },
|
|
])
|
|
])
|
|
-const selectedCoupon = ref()
|
|
|
|
|
|
+const selectedCoupons = ref<Coupon[]>([])
|
|
const coupons = ref<Coupon[]>([])
|
|
const coupons = ref<Coupon[]>([])
|
|
const cancelReason = ref('')
|
|
const cancelReason = ref('')
|
|
|
|
+const currentMessage = ref<Message>()
|
|
const { confirm } = useMessage('wd-message-box-slot')
|
|
const { confirm } = useMessage('wd-message-box-slot')
|
|
|
|
|
|
const query = computed(() => ({ messageType: tabs.value[tab.value]?.value }))
|
|
const query = computed(() => ({ messageType: tabs.value[tab.value]?.value }))
|
|
@@ -77,7 +76,7 @@ const handleSubmit = async (message: Message) => {
|
|
orderPointsSubmit({
|
|
orderPointsSubmit({
|
|
id: message.businessId,
|
|
id: message.businessId,
|
|
userId: message.designerId,
|
|
userId: message.designerId,
|
|
- couponUserId: selectedCoupon.value?.id,
|
|
|
|
|
|
+ couponUserId: selectedCoupons.value[0]?.id,
|
|
}),
|
|
}),
|
|
{
|
|
{
|
|
success: true,
|
|
success: true,
|
|
@@ -87,24 +86,16 @@ const handleSubmit = async (message: Message) => {
|
|
// await deleteMessage(message.id.toString())
|
|
// await deleteMessage(message.id.toString())
|
|
await updateMessage({ id: message.id, isRead: '1' })
|
|
await updateMessage({ id: message.id, isRead: '1' })
|
|
await pageHelperRef.value?.refresh()
|
|
await pageHelperRef.value?.refresh()
|
|
- selectedCoupon.value = undefined
|
|
|
|
|
|
+ selectedCoupons.value = []
|
|
}
|
|
}
|
|
-const handleQ = async (res) => {
|
|
|
|
- // const { data } = await getPointsCoupons({
|
|
|
|
- // userId: message.designerId,
|
|
|
|
- // businessId: message.businessId,
|
|
|
|
- // })
|
|
|
|
- // console.log(data)
|
|
|
|
|
|
+const handleQ = async (msg, res) => {
|
|
|
|
+ currentMessage.value = msg
|
|
coupons.value = res
|
|
coupons.value = res
|
|
show.value = true
|
|
show.value = true
|
|
}
|
|
}
|
|
-const handleSelect = (coupon: Coupon) => {
|
|
|
|
- selectedCoupon.value = coupon
|
|
|
|
- show.value = false
|
|
|
|
-}
|
|
|
|
onShow(async () => {
|
|
onShow(async () => {
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- pageHelperRef.value?.refresh()
|
|
|
|
|
|
+ pageHelperRef.value?.reload()
|
|
})
|
|
})
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
@@ -148,25 +139,13 @@ onShow(async () => {
|
|
/>
|
|
/>
|
|
</wd-config-provider>
|
|
</wd-config-provider>
|
|
</wd-message-box>
|
|
</wd-message-box>
|
|
- <wd-action-sheet title="优惠券" v-model="show">
|
|
|
|
- <view class="">
|
|
|
|
- <wd-tabs>
|
|
|
|
- <wd-tab title="可用优惠券"></wd-tab>
|
|
|
|
- <wd-tab title="不可用优惠券"></wd-tab>
|
|
|
|
- </wd-tabs>
|
|
|
|
- <div class="bg-[#f6f6f6] py-3.5 flex flex-col gap-4">
|
|
|
|
- <template v-for="(it, i) in coupons" :key="i">
|
|
|
|
- <CouponCard
|
|
|
|
- :options="it"
|
|
|
|
- can-select
|
|
|
|
- :selected="selectedCoupon?.id === it.id"
|
|
|
|
- @select="handleSelect"
|
|
|
|
- ></CouponCard>
|
|
|
|
- </template>
|
|
|
|
- </div>
|
|
|
|
- <!-- <wd-button block :round="false">确认</wd-button> -->
|
|
|
|
- </view>
|
|
|
|
- </wd-action-sheet>
|
|
|
|
|
|
+ <CouponsSelector
|
|
|
|
+ v-model="selectedCoupons"
|
|
|
|
+ type="points"
|
|
|
|
+ :show="show"
|
|
|
|
+ :business-id="currentMessage?.businessId"
|
|
|
|
+ @close="show = false"
|
|
|
|
+ ></CouponsSelector>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|