Branch_ccc #10

Merged
root merged 22 commits from Branch_ccc into master 2024-11-13 11:11:55 +08:00
5 changed files with 195 additions and 53 deletions
Showing only changes of commit 954275129d - Show all commits

View File

@ -34,7 +34,7 @@
{{item.properties.map((property) => property.valueName).join(' ')}}
</view>
<view class="b">
10积分待对接接口
{{state.orderInfo.usePoint}}积分
</view>
</view>
</view>
@ -74,7 +74,7 @@
支付积分
</view>
<view class="r">
10待接口对接
{{state.orderInfo.usePoint}}
</view>
</view>
</view>

View File

@ -24,7 +24,7 @@
<!-- <text class="card-c">×</text> -->
<view class="card-r">-{{item.usePoint}} 积分</view>
</view>
<view class="r-cart" @click="sheep.$router.go('/pages/activity/point/exchange_detail', { id: '1' })">查看详情</view>
<view class="r-cart" @click="sheep.$router.go('/pages/activity/point/exchange_detail', { id: item.id })">查看详情</view>
</view>
</view>

View File

@ -10,7 +10,7 @@
订单编号
</view>
<view class="r">
wx23556151561321321351213
{{ state.orderInfo.no }}
</view>
</view>
<view class="ddxx">
@ -18,7 +18,7 @@
兑换时间
</view>
<view class="r">
2024-10-18 15:46:03
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
<view class="ddxx">
@ -31,18 +31,18 @@
</view>
<view class="ddxx">
<view class="l">
支付方式
支付积分
</view>
<view class="r">
10
{{state.orderInfo.usePoint}}
</view>
</view>
<view class="fgx"></view>
<view class="ck-detail">
<view class="ck-detail" @click="sheep.$router.redirect('/pages/activity/point/exchange_detail',{id:state.id})">
查看详情
</view>
<view class="bk-home">
<view class="bk-home" @click="sheep.$router.redirect('/pages/index/index');">
返回首页
</view>
</view>
@ -50,51 +50,192 @@
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import PointApi from '@/sheep/api/promotion/point';
import SLayout from '@/sheep/components/s-layout/s-layout.vue';
import {
onLoad
} from '@dcloudio/uni-app';
import {
reactive,
ref
} from 'vue';
import {
isEmpty
} from 'lodash-es';
import {
fen2yuan,
formatOrderStatus,
formatOrderStatusDescription,
handleOrderButtons,
} from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
import DeliveryApi from '@/sheep/api/trade/delivery';
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
//
const { safeAreaInsets, safeArea } = sheep.$platform.device;
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const pageHeight =
(safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep.$platform.navbar - 350;
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
const sPointCardRef = ref();
//
const activityPageParams = reactive({
pageNo: 1, //
pageSize: 5, //
const state = reactive({
orderInfo: {},
merchantTradeNo: '', //
comeinType: '', //
id:0
});
const activityTotal = ref(0); //
const activityCount = ref(0); //
const loadStatus = ref(''); //
async function getActivityList() {
loadStatus.value = 'loading';
const { data } = await PointApi.getPointActivityPage(activityPageParams);
await sPointCardRef.value.concatActivity(data.list);
activityCount.value = sPointCardRef.value.getActivityCount();
activityTotal.value = data.total;
// ========== ==========
const systemStore = ref({}); //
loadStatus.value = activityCount.value < activityTotal.value ? 'more' : 'noMore';
}
//
const onCopy = () => {
sheep.$helper.copyText(state.orderInfo.no);
};
//
function loadMore() {
if (state.loadStatus !== 'noMore') {
activityPageParams.pageNo += 1;
getActivityList();
}
}
//
onReachBottom(() => {
loadMore();
//
function onPay(payOrderId) {
sheep.$router.go('/pages/pay/index', {
id: payOrderId,
});
onLoad(() => {
getActivityList();
}
//
function onGoodsDetail(id) {
sheep.$router.go('/pages/goods/index', {
id,
});
}
//
async function onCancel(orderId) {
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
success: async function(res) {
if (!res.confirm) {
return;
}
const {
code
} = await OrderApi.cancelOrder(orderId);
if (code === 0) {
await getOrderDetail(orderId);
}
},
});
}
//
async function onExpress(id) {
sheep.$router.go('/pages/order/express/log', {
id,
});
}
// TODO
async function onConfirm(orderId, ignore = false) {
//
// todo:
// 1.return
// 2.mpConfirm,App.vueshow
let isOpenBusinessView = true;
if (
sheep.$platform.name === 'WechatMiniProgram' &&
!isEmpty(state.orderInfo.wechat_extra_data) &&
isOpenBusinessView &&
!ignore
) {
mpConfirm(orderId);
return;
}
//
const {
code
} = await OrderApi.receiveOrder(orderId);
if (code === 0) {
await getOrderDetail(orderId);
}
}
// #ifdef MP-WEIXIN
//
function mpConfirm(orderId) {
if (!wx.openBusinessView) {
sheep.$helper.toast(`请升级微信版本`);
return;
}
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
merchant_trade_no: state.orderInfo.wechat_extra_data.merchant_trade_no,
transaction_id: state.orderInfo.wechat_extra_data.transaction_id,
},
success(response) {
console.log('success:', response);
if (response.errMsg === 'openBusinessView:ok') {
if (response.extraData.status === 'success') {
onConfirm(orderId, true);
}
}
},
fail(error) {
console.log('error:', error);
},
complete(result) {
console.log('result:', result);
},
});
}
// #endif
//
function onComment(id) {
sheep.$router.go('/pages/goods/comment/add', {
id,
});
}
const pickUpVerifyRef = ref();
async function getOrderDetail(id) {
//
let res;
if (state.comeinType === 'wechat') {
// TODO
res = await OrderApi.getOrder(id, {
merchant_trade_no: state.merchantTradeNo,
});
} else {
res = await OrderApi.getOrder(id);
}
if (res.code === 0) {
state.orderInfo = res.data;
handleOrderButtons(state.orderInfo);
//
if (res.data.pickUpStoreId) {
const {
data
} = await DeliveryApi.getDeliveryPickUpStore(res.data.pickUpStoreId);
systemStore.value = data || {};
}
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
}
} else {
sheep.$router.back();
}
}
onLoad(async (options) => {
let id = 0;
if (options.id) {
id = options.id;
state.id = options.id;
}
// TODO
state.comeinType = options.comein_type;
if (state.comeinType === 'wechat') {
state.merchantTradeNo = options.merchant_trade_no;
}
await getOrderDetail(id);
});
</script>

View File

@ -229,8 +229,8 @@
} = await SeckillApi.getSeckillActivity(id);
activity.value = data;
// console.log(activity.value,"activity.value")
timeStatusEnum.value = getTimeStatusEnum(activity.startTime, activity.endTime);
timeStatusEnum.value = getTimeStatusEnum(activity.value.startTime, activity.value.endTime);
// console.log("",activity.value.startTime,activity.value.endTime)
//
await getSpu(data.spuId);
};

View File

@ -277,9 +277,10 @@
id: data.id,
});
}else{
sheep.$router.redirect('/pages/activity/point/exchange_detail', {
sheep.$router.redirect('/pages/activity/point/exchange_success', {
id: data.id,
});
// sheep.$helper.toast('');
}
}