consumerm模块完成度90%,完善消费者和商家端数据库表,商品、聊天、订单数据对接好了supabase,和商家端对接了聊天功能,安卓端编译通过了css样式,剩余几个页面在处理函数规范问题
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
<view class="section-title">退款类型</view>
|
||||
<radio-group @change="handleTypeChange" class="type-group">
|
||||
<label class="type-item">
|
||||
<radio value="1" :checked="refundType === 1" color="#ff4444" />
|
||||
<radio value="1" :checked="refundType === 1" color="#ff4444" class="type-radio" />
|
||||
<text>仅退款</text>
|
||||
</label>
|
||||
<label class="type-item">
|
||||
<radio value="2" :checked="refundType === 2" color="#ff4444" />
|
||||
<radio value="2" :checked="refundType === 2" color="#ff4444" class="type-radio" />
|
||||
<text>退货退款</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
@@ -56,7 +56,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { supabaseService } from '@/utils/supabaseService.uts'
|
||||
|
||||
const orderId = ref('')
|
||||
@@ -79,24 +80,15 @@ const reasonList = [
|
||||
'其他'
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const options = currentPage.options as any
|
||||
|
||||
if (options.orderId) {
|
||||
orderId.value = options.orderId
|
||||
loadOrderInfo()
|
||||
}
|
||||
})
|
||||
|
||||
const loadOrderInfo = async () => {
|
||||
try {
|
||||
const orderData = await supabaseService.getOrderDetail(orderId.value)
|
||||
|
||||
if (orderData != null) {
|
||||
const total = Number(orderData['total_amount'] ?? 0)
|
||||
const shipping = Number(orderData['shipping_fee'] ?? 0)
|
||||
// Cast to UTSJSONObject to access properties safely
|
||||
const order = orderData as UTSJSONObject
|
||||
const total = order.getNumber('total_amount') ?? 0
|
||||
const shipping = order.getNumber('shipping_fee') ?? 0
|
||||
|
||||
maxAmount.value = total
|
||||
deliveryFee.value = shipping
|
||||
@@ -111,17 +103,37 @@ const loadOrderInfo = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options['orderId'] != null) {
|
||||
orderId.value = options['orderId'] as string
|
||||
loadOrderInfo()
|
||||
}
|
||||
})
|
||||
|
||||
const handleTypeChange = (e: any) => {
|
||||
refundType.value = parseInt(e.detail.value)
|
||||
// Use bracket notation to access detail property safely on 'any' type in UTS
|
||||
// The structure is e -> detail -> value
|
||||
// We need to cast e to UTSJSONObject first if we want to use bracket notation,
|
||||
// OR we can use JSON.parse/stringify trick if simple casting fails,
|
||||
// BUT the most standard way for UTS 'any' which is actually a Map/JSONObject at runtime:
|
||||
|
||||
const target = e as UTSJSONObject
|
||||
const detail = target['detail'] as UTSJSONObject
|
||||
const value = detail['value'] as string
|
||||
refundType.value = parseInt(value)
|
||||
}
|
||||
|
||||
const handleReasonChange = (e: any) => {
|
||||
const index = e.detail.value as number
|
||||
// Use bracket notation to access detail property safely on 'any' type in UTS
|
||||
const target = e as UTSJSONObject
|
||||
const detail = target['detail'] as UTSJSONObject
|
||||
const value = detail['value'] as number
|
||||
const index = value
|
||||
refundReason.value = reasonList[index]
|
||||
}
|
||||
|
||||
const submitRefund = async () => {
|
||||
if (!refundReason.value) {
|
||||
if (refundReason.value == '') {
|
||||
uni.showToast({ title: '请选择退款原因', icon: 'none' })
|
||||
return
|
||||
}
|
||||
@@ -166,7 +178,7 @@ const submitRefund = async () => {
|
||||
|
||||
<style scoped>
|
||||
.apply-refund-page {
|
||||
min-height: 100vh;
|
||||
flex: 1;
|
||||
background-color: #f5f5f5;
|
||||
padding: 15px;
|
||||
padding-bottom: 80px;
|
||||
@@ -189,16 +201,19 @@ const submitRefund = async () => {
|
||||
.type-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.type-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.type-radio {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.picker-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
Reference in New Issue
Block a user