init
This commit is contained in:
211
pages/order/detail.vue
Normal file
211
pages/order/detail.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<view class="page-content">
|
||||
<nut-steps :current="detail.progress">
|
||||
<nut-step title="待付款">1</nut-step>
|
||||
<nut-step title="待发货">2</nut-step>
|
||||
<nut-step title="待收货">3</nut-step>
|
||||
<nut-step title="已完成">4</nut-step>
|
||||
</nut-steps>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<view class="address-inner" v-if="detail.address_info">
|
||||
<text>{{detail.address_info.user_name}} - {{detail.address_info.tel_number}}</text>
|
||||
<text>{{detail.address_info.province_name + detail.address_info.city_name + detail.address_info.county_name + detail.address_info.street_name + detail.address_info.detail_info_new}}</text>
|
||||
</view>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
|
||||
<nut-cell-group>
|
||||
<!-- <nut-cell is-link v-for="(goods,idx) in detail.goods" :key="idx"
|
||||
@click="navigateTo('/pages/mall/item/index?id=' + goods.goods_id)">
|
||||
<template #title>
|
||||
<view class="detail">
|
||||
<view class="name">
|
||||
<nut-tag custom-color="#1a1a1a">{{goods.snapshot_info.degree.degree_name}}</nut-tag>
|
||||
<text>{{goods.goods_name}}</text>
|
||||
</view>
|
||||
<view class="sku">{{goods.content}}</view>
|
||||
</view>
|
||||
</template>
|
||||
</nut-cell> -->
|
||||
|
||||
<nut-cell v-for="(goods,index) in detail.goods" :key="index" center
|
||||
@click="navigateTo('/pages/mall/detail?id=' + goods.goods_id)">
|
||||
<template #title>
|
||||
<view class="goods-info-row">
|
||||
<view class="left-text">
|
||||
<view class="goods-name">
|
||||
<nut-tag custom-color="#1a1a1a">{{goods.snapshot_info.degree.degree_name}}</nut-tag>
|
||||
<text style="margin-left: 10rpx;">{{goods.goods_name}}</text>
|
||||
</view>
|
||||
<text class="goods-no">串号:{{goods.goods_no}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #link>
|
||||
<nut-price :price="goods.goods_price" size="small" :need-symbol="true" />
|
||||
</template>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<text>商品总额</text>
|
||||
<nut-price :price="detail.pay_price" size="normal" :need-symbol="true" />
|
||||
</view>
|
||||
</nut-cell>
|
||||
<!-- <nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<view>
|
||||
<text>邮费</text>
|
||||
</view>
|
||||
<view>
|
||||
<nut-price :price="0" size="normal" :need-symbol="true" />
|
||||
</view>
|
||||
</view>
|
||||
</nut-cell> -->
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell title="订单编号" :desc="detail.order_no" />
|
||||
<nut-cell title="下单时间" :desc="detail.create_time" />
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group v-if="detail.progress >= 3">
|
||||
<nut-cell title="物流公司" :desc="detail.express_company" />
|
||||
<nut-cell title="物流单号" :desc="detail.express_no" />
|
||||
</nut-cell-group>
|
||||
|
||||
|
||||
<view v-if="detail.progress === 1 && !audit" class="wechat-img-inner">
|
||||
<nut-button type="primary" block @click="showPayImgs()">
|
||||
点我付款
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
fetchOrderDetail
|
||||
} from '@/api/order';
|
||||
import {
|
||||
navigateTo,
|
||||
} from '@/utils/helper';
|
||||
|
||||
|
||||
import {
|
||||
fetchGetConfig
|
||||
} from '@/api/config';
|
||||
|
||||
// 审核模式 默认开启 true
|
||||
const audit = ref(true);
|
||||
|
||||
// 订单ID
|
||||
const id = ref(0)
|
||||
// 订单详情
|
||||
const detail = reactive({})
|
||||
// 支付码
|
||||
const images = ref([]);
|
||||
|
||||
onLoad((options) => {
|
||||
id.value = options.id
|
||||
})
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 页面显示生命周期钩子
|
||||
* 每次页面显示时都会执行
|
||||
*/
|
||||
onShow(() => {
|
||||
// 获取配置
|
||||
getConfig()
|
||||
// 获取订单详情
|
||||
fetchOrderDetail(id.value).then(res => {
|
||||
Object.assign(detail, res)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// 获取配置
|
||||
const getConfig = () => {
|
||||
fetchGetConfig().then(res => {
|
||||
console.log('getConfig=====>', res)
|
||||
audit.value = res.appConfig.is_audit == 1
|
||||
console.log(res.appConfig.pay_imgs);
|
||||
let pay_imgs = JSON.parse(res.appConfig.pay_imgs) || [];
|
||||
let wechat_imgs = JSON.parse(res.appConfig.wechat_imgs) || [];
|
||||
let pay_imgs_arr = pay_imgs.map(item => item.file_path) || [];
|
||||
let wechat_imgs_arr = wechat_imgs.map(item => item.file_path) || [];
|
||||
const merged_imgs_arr = pay_imgs_arr.concat(wechat_imgs_arr);
|
||||
images.value = merged_imgs_arr;
|
||||
})
|
||||
}
|
||||
|
||||
// 显示支付码
|
||||
const showPayImgs = () => {
|
||||
if (images.value.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无图片',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log('preview images:', images);
|
||||
uni.previewImage({
|
||||
urls: images.value
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.page-content {
|
||||
min-height: 100vh;
|
||||
background-color: #f2f3f5;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.address-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.total-price-inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
// flex-direction: row;
|
||||
view:nth-child(2) {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
|
||||
.wechat-img-inner {
|
||||
margin-top: 60rpx;
|
||||
padding: 0rpx 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
// gap: 5px;
|
||||
}
|
||||
</style>
|
||||
155
pages/order/detail/index copy.vue
Normal file
155
pages/order/detail/index copy.vue
Normal file
@@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<view class="page-content">
|
||||
<nut-steps :current="detail.progress">
|
||||
<nut-step title="待付款">1</nut-step>
|
||||
<nut-step title="待发货">2</nut-step>
|
||||
<nut-step title="待收货">3</nut-step>
|
||||
<nut-step title="已完成">4</nut-step>
|
||||
</nut-steps>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<view class="address-inner" v-if="detail.address_info">
|
||||
<text>{{detail.address_info.user_name}} - {{detail.address_info.tel_number}}</text>
|
||||
<text>{{detail.address_info.province_name + detail.address_info.city_name + detail.address_info.county_name + detail.address_info.street_name + detail.address_info.detail_info_new}}</text>
|
||||
</view>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
|
||||
<nut-cell-group>
|
||||
<!-- <nut-cell is-link v-for="(goods,idx) in detail.goods" :key="idx"
|
||||
@click="navigateTo('/pages/mall/item/index?id=' + goods.goods_id)">
|
||||
<template #title>
|
||||
<view class="detail">
|
||||
<view class="name">
|
||||
<nut-tag custom-color="#1a1a1a">{{goods.snapshot_info.degree.degree_name}}</nut-tag>
|
||||
<text>{{goods.goods_name}}</text>
|
||||
</view>
|
||||
<view class="sku">{{goods.content}}</view>
|
||||
</view>
|
||||
</template>
|
||||
</nut-cell> -->
|
||||
|
||||
<nut-cell v-for="(goods,index) in detail.goods" :key="index" center
|
||||
@click="navigateTo('/pages/mall/item/index?id=' + goods.goods_id)">
|
||||
<template #title>
|
||||
<view class="goods-info-row">
|
||||
<view class="left-text">
|
||||
<view class="goods-name">
|
||||
<nut-tag custom-color="#1a1a1a">{{goods.snapshot_info.degree.degree_name}}</nut-tag>
|
||||
<text style="margin-left: 10rpx;">{{goods.goods_name}}</text>
|
||||
</view>
|
||||
<text class="goods-no">串号:{{goods.goods_no}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #link>
|
||||
<nut-price :price="goods.goods_price" size="small" :need-symbol="true" />
|
||||
</template>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<text>商品总额</text>
|
||||
<nut-price :price="detail.pay_price" size="normal" :need-symbol="true" />
|
||||
</view>
|
||||
</nut-cell>
|
||||
<!-- <nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<view>
|
||||
<text>邮费</text>
|
||||
</view>
|
||||
<view>
|
||||
<nut-price :price="0" size="normal" :need-symbol="true" />
|
||||
</view>
|
||||
</view>
|
||||
</nut-cell> -->
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell title="订单编号" :desc="detail.order_no" />
|
||||
<nut-cell title="下单时间" :desc="detail.create_time" />
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group v-if="detail.progress >= 3">
|
||||
<nut-cell title="物流公司" :desc="detail.express_company" />
|
||||
<nut-cell title="物流单号" :desc="detail.express_no" />
|
||||
</nut-cell-group>
|
||||
|
||||
|
||||
<view v-if="detail.progress === 1" class="wechat-img-inner" style="margin-top: 60rpx; padding: 0rpx 80rpx;">
|
||||
<nut-button type="primary" block @click="showPayImgs()">
|
||||
点我付款
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
.page-content {
|
||||
min-height: 100vh;
|
||||
background-color: #f2f3f5;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.address-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.total-price-inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
// flex-direction: row;
|
||||
view:nth-child(2) {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
.wechat-img-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
// gap: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
fetchOrderDetail
|
||||
} from '../../../api/order';
|
||||
import {
|
||||
navigateTo,
|
||||
showPayImgs
|
||||
// showWechatImg,
|
||||
// showWechatPayImg
|
||||
} from '../../../utils/helper';
|
||||
const id = ref(0)
|
||||
onLoad((options) => {
|
||||
id.value = options.id
|
||||
})
|
||||
const detail = reactive({})
|
||||
onShow(() => {
|
||||
fetchOrderDetail(id.value).then(res => {
|
||||
Object.assign(detail, res)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
396
pages/order/housePreview.vue
Normal file
396
pages/order/housePreview.vue
Normal file
@@ -0,0 +1,396 @@
|
||||
<template>
|
||||
<view class="page-content">
|
||||
<nut-cell-group>
|
||||
<nut-cell v-if="!form.address_info?.address_id" title="添加地址" is-link @click="chooseAddress"></nut-cell>
|
||||
<nut-cell v-else :title="form.address_info.user_name + ' ' + form.address_info.tel_number" is-link
|
||||
:sub-title="
|
||||
form.address_info.province_name +
|
||||
form.address_info.city_name +
|
||||
form.address_info.county_name +
|
||||
form.address_info.street_name +
|
||||
form.address_info.detail_info_new
|
||||
" @click="chooseAddress"></nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell center>
|
||||
<template #title>
|
||||
<view class="goods-info-row">
|
||||
<!-- 左侧文字区域 -->
|
||||
<view class="left-text">
|
||||
<view class="goods-name">
|
||||
<nut-tag custom-color="#1a1a1a">{{ goods?.goods_house?.degree?.degree_name }}</nut-tag>
|
||||
<text style="margin-left: 10rpx">{{ goods?.goods_house?.goods_name }}</text>
|
||||
</view>
|
||||
<text class="goods-no">串号:{{ goods?.goods_house?.goods_no }}</text>
|
||||
</view>
|
||||
<!-- 右侧价格区域 -->
|
||||
</view>
|
||||
</template>
|
||||
<template #link>
|
||||
<nut-price :price="getPrice(goods?.goods_house)" size="small" :need-symbol="true" />
|
||||
</template>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<text>件数</text>
|
||||
<text>{{ order_total_num }}件</text>
|
||||
</view>
|
||||
</nut-cell>
|
||||
<nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<text>商品总额</text>
|
||||
<nut-price :price="getPrice(goods?.goods_house)" :need-symbol="true" />
|
||||
</view>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
<view class="bottom-submit-inner">
|
||||
<view class="bottom-submit-inner-info">
|
||||
<text>合计:</text>
|
||||
<nut-price size="large" :price="getPrice(goods?.goods_house)" :need-symbol="true" />
|
||||
</view>
|
||||
<view class="bottom-submit-inner-btn">
|
||||
<nut-button type="primary" @click="onSubmitClick">确认下单</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
fetchOrderbuyNow,
|
||||
houseFetchGoodsPreview
|
||||
} from '@/api/house_order';
|
||||
|
||||
import {
|
||||
fetchGetConfig,
|
||||
fetchGetPriceRules,
|
||||
} from '@/api/config';
|
||||
|
||||
import {
|
||||
navigateTo
|
||||
} from '@/utils/helper';
|
||||
|
||||
|
||||
// 审核模式
|
||||
const audit = ref(true);
|
||||
// 是否开启整仓调价
|
||||
const isWarehouse = ref(false)
|
||||
|
||||
|
||||
// 单个商品规则列表
|
||||
const singleRule = ref([])
|
||||
// 价格区间规则列表
|
||||
const rangeRule = ref([])
|
||||
// 整仓规则
|
||||
const warehouseRule = reactive({
|
||||
val: 0,
|
||||
val_type: 1,
|
||||
})
|
||||
|
||||
|
||||
// 获取全部调价规则
|
||||
const GetPriceRules = () => {
|
||||
fetchGetPriceRules().then(res => {
|
||||
console.log('res', res);
|
||||
// 区间调价
|
||||
rangeRule.value = res?.range ?? [];
|
||||
// 单机调价
|
||||
singleRule.value = res?.single ?? [];
|
||||
// 整仓调价
|
||||
Object.assign(warehouseRule, res?.warehouse?.[0] ?? {
|
||||
val: 0,
|
||||
val_type: 1,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 获取价格
|
||||
const getPrice = (goods) => {
|
||||
// 判断是否开启整仓调价
|
||||
if (isWarehouse.value) {
|
||||
console.log("开启整仓调价");
|
||||
// 查找单机器加价规则
|
||||
const list = singleRule.value || singleRule; // 兼容 ref 和 reactive
|
||||
// 根据 product_id == goods_id 找对应规则
|
||||
const rule = list.find(item => item.product_id === goods?.goods_id);
|
||||
if (rule) {
|
||||
// 存在单机加价规则
|
||||
const basePrice = Number(goods?.goods_price);
|
||||
const val = Number(rule.val);
|
||||
let finalPrice = basePrice;
|
||||
// val_type 处理
|
||||
if (rule.val_type == 1) {
|
||||
finalPrice = basePrice + val; // 固定加价
|
||||
} else if (rule.val_type == 2) {
|
||||
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
|
||||
}
|
||||
return finalPrice.toFixed(2); // 保留两位小数
|
||||
} else {
|
||||
// 不存在则使用整仓加价
|
||||
const basePrice = Number(goods?.goods_price);
|
||||
const val = Number(warehouseRule.val);
|
||||
let finalPrice = basePrice;
|
||||
// val_type 处理
|
||||
if (warehouseRule.val_type == 1) {
|
||||
finalPrice = basePrice + val; // 固定加价
|
||||
} else if (warehouseRule.val_type == 2) {
|
||||
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
|
||||
}
|
||||
return finalPrice.toFixed(2); // 保留两位小数
|
||||
}
|
||||
} else {
|
||||
console.log("未开启整仓调价");
|
||||
// 查找单机器加价规则
|
||||
const singleRuleList = singleRule.value || singleRule; // 兼容 ref 和 reactive
|
||||
// 根据 product_id == goods_id 找对应规则
|
||||
const oneRule = singleRuleList.find(item => item.product_id === goods?.goods_id);
|
||||
if (oneRule) {
|
||||
// 存在单机加价规则
|
||||
const basePrice = Number(goods?.goods_price);
|
||||
const val = Number(oneRule.val);
|
||||
let finalPrice = basePrice;
|
||||
// val_type 处理
|
||||
if (oneRule.val_type == 1) {
|
||||
finalPrice = basePrice + val; // 固定加价
|
||||
} else if (oneRule.val_type == 2) {
|
||||
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
|
||||
}
|
||||
return finalPrice.toFixed(2); // 保留两位小数
|
||||
} else {
|
||||
// 不存在则使用区间加价
|
||||
const basePrice = Number(goods?.goods_price)
|
||||
// // 查找区间加价规则
|
||||
const rangeRulelist = rangeRule.value || rangeRule; // 兼容 ref 和 reactive
|
||||
const quRule = rangeRulelist.find(item => {
|
||||
const min = Number(item.min_price)
|
||||
const max = Number(item.max_price)
|
||||
return basePrice >= min && basePrice < max
|
||||
}) || null
|
||||
if (quRule) {
|
||||
// 存在区间加价
|
||||
const val = Number(quRule.val);
|
||||
let finalPrice = basePrice;
|
||||
// val_type 处理
|
||||
if (quRule.val_type == 1) {
|
||||
finalPrice = basePrice + val; // 固定加价
|
||||
} else if (quRule.val_type == 2) {
|
||||
finalPrice = basePrice + (basePrice * val / 100); // 按百分比加
|
||||
}
|
||||
return finalPrice.toFixed(2); // 保留两位小数
|
||||
} else {
|
||||
// 不存在区间加价
|
||||
return basePrice
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getConfig = () => {
|
||||
fetchGetConfig().then(res => {
|
||||
console.log('getConfig=====>', res)
|
||||
audit.value = res.appConfig.is_audit == 1
|
||||
isWarehouse.value = res.appConfig.is_warehouse == 1
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const chooseAddress = () => {
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
// console.log(res.userName)
|
||||
// console.log(res.telNumber)
|
||||
// console.log(res.provinceName + res.cityName + res.countyName + res.streetName + res.detailInfoNew)
|
||||
// console.log(res.userName)
|
||||
// console.log(res.postalCode)
|
||||
// console.log(res.provinceName)
|
||||
// console.log(res.cityName)
|
||||
// console.log(res.countyName)
|
||||
// console.log(res.detailInfo)
|
||||
// console.log(res.nationalCode)
|
||||
// console.log(res.telNumber)
|
||||
console.log(res);
|
||||
Object.assign(form, {
|
||||
address_info: {
|
||||
address_id: res.addressID || 1,
|
||||
user_name: res.userName,
|
||||
tel_number: res.telNumber,
|
||||
city_name: res.cityName || '',
|
||||
county_name: res.countyName || '',
|
||||
detail_info: res.detailInfo || '',
|
||||
detail_info_new: res.detailInfoNew || '',
|
||||
national_code: res.nationalCode || '',
|
||||
national_code_full: res.nationalCodeFull || '',
|
||||
postal_code: res.postalCode || '',
|
||||
province_name: res.provinceName || '',
|
||||
street_name: res.streetName || '',
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const ids = ref([]);
|
||||
// const list = reactive([]);
|
||||
const goods = reactive({})
|
||||
|
||||
|
||||
const order_total_price = ref(0);
|
||||
const order_total_num = ref(0);
|
||||
|
||||
|
||||
const form = reactive({
|
||||
goods_id: 0,
|
||||
address_info: {},
|
||||
});
|
||||
|
||||
|
||||
const fromStr = ref('');
|
||||
|
||||
|
||||
|
||||
onLoad(options => {
|
||||
|
||||
console.log('init');
|
||||
// 获取配置
|
||||
getConfig()
|
||||
GetPriceRules()
|
||||
|
||||
|
||||
console.log('🚀 ~ from:', options.from);
|
||||
fromStr.value = options.from;
|
||||
console.log('🚀 ~ ids:', options.ids);
|
||||
form.goods_id = options.ids;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
onShow(() => {
|
||||
console.log('🚀 ~ onShowfrom:', fromStr.value);
|
||||
if (fromStr.value === 'list' || fromStr.value === 'item') {
|
||||
houseFetchGoodsPreview({
|
||||
goods_id: form.goods_id,
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
// Object.assign(list, res.goods_list);
|
||||
Object.assign(goods, res.goods)
|
||||
// Object.assign(form.address_info, res.address_info);
|
||||
order_total_price.value = res.order_total_price;
|
||||
order_total_num.value = res.order_total_num;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onHide(() => {
|
||||
fromStr.value = '';
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 提交订单
|
||||
const onSubmitClick = () => {
|
||||
if (!form.address_info?.address_id) {
|
||||
uni.showToast({
|
||||
title: '请选择收货地址',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
fetchOrderbuyNow(form).then(res => {
|
||||
console.log(res);
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/detail?id=' + res.order_id,
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {},
|
||||
});
|
||||
// navigateTo('/pages/order/detail/index?id=' + res.order_id)
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page-content {
|
||||
// min-height: 100vh;
|
||||
min-height: calc(100vh - 60px); //100vh;
|
||||
background-color: #f2f3f5;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 140rpx;
|
||||
}
|
||||
|
||||
/* 信息行布局 */
|
||||
.goods-info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 10rpx;
|
||||
// border-bottom: 2rpx solid #f2f3f5;
|
||||
|
||||
/* 左侧文字样式 */
|
||||
.left-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
font-size: 30rpx;
|
||||
color: #000000;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.goods-no {
|
||||
font-size: 26rpx;
|
||||
color: #000000;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* 右侧价格样式 */
|
||||
.price {
|
||||
margin-left: 20rpx;
|
||||
align-self: center;
|
||||
/* 垂直居中在两行文字之间 */
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-submit-inner {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 120rpx;
|
||||
background: #fff;
|
||||
width: calc(100% - 40rpx);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0 auto;
|
||||
padding: 15rpx 20rpx;
|
||||
}
|
||||
|
||||
.total-price-inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
view:nth-child(2) {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
428
pages/order/index.vue
Normal file
428
pages/order/index.vue
Normal file
@@ -0,0 +1,428 @@
|
||||
<template>
|
||||
<view class="page-content">
|
||||
<nut-dialog title="取消订单" content="确认取消吗?此操作不可恢复!" v-model:visible="visibleCancelOrderDialog"
|
||||
@cancel="visibleCancelOrderDialog = false" @ok="onClickCancelOrder" />
|
||||
|
||||
|
||||
<nut-sticky>
|
||||
<nut-searchbar placeholder="请输入商品串号" clearable v-model="search_val" input-background="#eee"
|
||||
@search="onSearch" @clear="onClear">
|
||||
<template #rightout>
|
||||
<nut-button size="small" type="primary" @click="onSearch">搜索</nut-button>
|
||||
</template>
|
||||
</nut-searchbar>
|
||||
<nut-tabs v-model="current_tab_idx" background="#fff">
|
||||
<template #titles>
|
||||
<div class="title-list">
|
||||
<view v-for="(item,idx) in tabs_config" :key="idx" class="title-item"
|
||||
:class="{ 'tabs-active': idx === current_tab_idx }" @click="onChangeTab(item,idx)">
|
||||
<view class="nut-tabs__titles-item__text">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="item__line" />
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
</nut-tabs>
|
||||
</nut-sticky>
|
||||
|
||||
<z-paging ref="paging" :fixed="false" style="height: 88vh;" class="order-list" v-model="dataList"
|
||||
@query="apiFetchOrderList">
|
||||
|
||||
<view class="order-inner" v-for="(order,index) in dataList" :key="index">
|
||||
<view class="order-inner-header">
|
||||
<text>{{order.create_time}}</text>
|
||||
<nut-tag custom-color="#1a1a1a">{{getStatusText(order)}}</nut-tag>
|
||||
<!-- <text>{{order.order_no}}</text> -->
|
||||
</view>
|
||||
|
||||
<view class="goods-info-row" v-for="(goods,iidx) in order.goods" :key="iidx"
|
||||
@click="navigateToDetail(order.order_id)">
|
||||
<view class="left-text">
|
||||
<view class="goods-name">
|
||||
<nut-tag custom-color="#1a1a1a">{{goods.snapshot_info.degree.degree_name}}</nut-tag>
|
||||
<text style="margin-left: 10rpx;">{{goods.goods_name}}</text>
|
||||
</view>
|
||||
<text class="goods-no">串号:{{goods.goods_no}}</text>
|
||||
</view>
|
||||
<view class="price">
|
||||
<nut-price :price="goods.goods_price" size="small" :need-symbol="true" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="footer">
|
||||
<view class="order-inner-price">
|
||||
总计:<nut-price :price="order.total_price" size="normal" :need-symbol="true" />
|
||||
</view>
|
||||
<view class="order-inner-action" v-if="order.order_status.value === 10">
|
||||
<view style="margin-left:10rpx;">
|
||||
<nut-button plain size="small"
|
||||
@click="visibleCancelOrderDialog = true;current_cancel_order_id=order.order_id;"
|
||||
v-if="order.pay_status.value === 10 ">
|
||||
取消订单
|
||||
</nut-button>
|
||||
</view>
|
||||
|
||||
<view style="margin-left:10rpx;">
|
||||
<nut-button type="primary" size="small" v-if="order.pay_status.value === 10 && !audit"
|
||||
@click="showPayImgs()">
|
||||
点我付款
|
||||
</nut-button>
|
||||
</view>
|
||||
<view style="margin-left:10rpx;">
|
||||
<nut-button type="primary" size="small" @click="onClickReceiptOrder(order.order_id)"
|
||||
v-if="order.pay_status.value === 20 && order.delivery_status.value === 20 && order.receipt_status.value === 10">
|
||||
确认收货
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</z-paging>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
|
||||
|
||||
import {
|
||||
navigateTo,
|
||||
} from '@/utils/helper';
|
||||
import {
|
||||
fetchCancelOrder,
|
||||
fetchOrderList,
|
||||
fetchReceiptOrder
|
||||
} from '@/api/order';
|
||||
|
||||
import {
|
||||
fetchGetConfig
|
||||
} from '@/api/config';
|
||||
|
||||
// 审核模式 默认开启 true
|
||||
const audit = ref(true);
|
||||
|
||||
// 支付码
|
||||
const images = ref([]);
|
||||
|
||||
|
||||
|
||||
// 默认tab
|
||||
const current_tab_idx = ref(0);
|
||||
// 订单列表数据
|
||||
const dataList = ref([]);
|
||||
// zp
|
||||
const paging = ref(null);
|
||||
// 定义tab切换
|
||||
const tabs_config = [{
|
||||
title: '全部',
|
||||
status: 'all'
|
||||
},
|
||||
{
|
||||
title: '待付款',
|
||||
status: 'payment'
|
||||
},
|
||||
{
|
||||
title: '待发货',
|
||||
status: 'delivery'
|
||||
},
|
||||
{
|
||||
title: '待收货',
|
||||
status: 'received'
|
||||
},
|
||||
{
|
||||
title: '已完成',
|
||||
status: 'finish'
|
||||
}
|
||||
]
|
||||
// 取消订单弹窗
|
||||
const visibleCancelOrderDialog = ref(false);
|
||||
// 被取消订单id
|
||||
const current_cancel_order_id = ref(0);
|
||||
// 搜索内容
|
||||
const search_val = ref('')
|
||||
// tab切换
|
||||
const onChangeTab = (item, idx) => {
|
||||
current_tab_idx.value = idx
|
||||
paging.value.reload();
|
||||
// apiFetchPartsOrderList();
|
||||
}
|
||||
|
||||
|
||||
// 获取配置
|
||||
const getConfig = () => {
|
||||
fetchGetConfig().then(res => {
|
||||
console.log('getConfig=====>', res)
|
||||
audit.value = res.appConfig.is_audit == 1
|
||||
console.log(res.appConfig.pay_imgs);
|
||||
let pay_imgs = JSON.parse(res.appConfig.pay_imgs) || [];
|
||||
let wechat_imgs = JSON.parse(res.appConfig.wechat_imgs) || [];
|
||||
let pay_imgs_arr = pay_imgs.map(item => item.file_path) || [];
|
||||
let wechat_imgs_arr = wechat_imgs.map(item => item.file_path) || [];
|
||||
const merged_imgs_arr = pay_imgs_arr.concat(wechat_imgs_arr);
|
||||
images.value = merged_imgs_arr;
|
||||
})
|
||||
}
|
||||
|
||||
// 显示支付码
|
||||
const showPayImgs = () => {
|
||||
if (images.value.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无图片',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log('preview images:', images);
|
||||
uni.previewImage({
|
||||
urls: images.value
|
||||
});
|
||||
}
|
||||
|
||||
// 跳转详情页面
|
||||
const navigateToDetail = (id) => {
|
||||
console.log(id);
|
||||
if (!id) {
|
||||
console.warn('导航ID不能为空')
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/detail?id=${encodeURIComponent(id)}`
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 取消订单
|
||||
const onClickCancelOrder = () => {
|
||||
fetchCancelOrder(current_cancel_order_id.value).then(res => {
|
||||
uni.showToast({
|
||||
title: '取消成功',
|
||||
icon: 'none'
|
||||
})
|
||||
paging.value.reload();
|
||||
// init()
|
||||
})
|
||||
}
|
||||
// 确认收货
|
||||
const onClickReceiptOrder = (id) => {
|
||||
fetchReceiptOrder(id).then(res => {
|
||||
uni.showToast({
|
||||
title: '确认收货成功',
|
||||
icon: 'none'
|
||||
})
|
||||
paging.value.reload();
|
||||
// init()
|
||||
})
|
||||
}
|
||||
// 获取订单列表
|
||||
const apiFetchOrderList = (pageNo = 1, pageSize = 10) => {
|
||||
console.log(tabs_config[current_tab_idx.value]['status']);
|
||||
const params = {
|
||||
page: pageNo,
|
||||
pageSize: 10,
|
||||
status: tabs_config[current_tab_idx.value]['status'],
|
||||
goods_no: search_val.value,
|
||||
}
|
||||
fetchOrderList(params).then(res => {
|
||||
console.log(res);
|
||||
paging.value.complete(res.list);
|
||||
}).catch(res => {
|
||||
paging.value.complete(false);
|
||||
})
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
current_tab_idx.value = parseInt(options.tab)
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 页面显示生命周期钩子
|
||||
* 每次页面显示时都会执行
|
||||
*/
|
||||
onShow(() => {
|
||||
// 获取配置
|
||||
getConfig()
|
||||
|
||||
})
|
||||
|
||||
// 搜索
|
||||
const onSearch = () => {
|
||||
console.log("搜索:", search_val.value);
|
||||
paging.value.reload();
|
||||
|
||||
}
|
||||
// 清空搜索框
|
||||
const onClear = () => {
|
||||
console.log("搜索:", search_val.value);
|
||||
paging.value.reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 订单状态
|
||||
const getStatusText = (order) => {
|
||||
if (order.order_status.value == 20) {
|
||||
return order.order_status.text
|
||||
} else if (order.order_status.value == 30) {
|
||||
return order.order_status.text
|
||||
} else if (order.order_status.value == 10) {
|
||||
if (order.pay_status.value == 10) {
|
||||
return order.pay_status.text
|
||||
} else if (order.pay_status.value == 20) {
|
||||
if (order.delivery_status.value == 10) {
|
||||
return order.delivery_status.text
|
||||
} else if (order.delivery_status.value == 20) {
|
||||
return order.receipt_status.text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
.page-content {
|
||||
min-height: 100vh;
|
||||
background-color: #f2f3f5;
|
||||
}
|
||||
|
||||
.order-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.order-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border-radius: 15rpx;
|
||||
overflow: hidden;
|
||||
margin: 20rpx;
|
||||
|
||||
.order-inner-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #dcdcdc;
|
||||
color: rgba(0, 0, 0, .5);
|
||||
font-size: 24rpx;
|
||||
justify-content: space-between;
|
||||
line-height: 45rpx;
|
||||
padding: 15rpx 20rpx;
|
||||
}
|
||||
|
||||
|
||||
/* 信息行布局 */
|
||||
.goods-info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
border-bottom: 2rpx solid #f2f3f5;
|
||||
|
||||
/* 左侧文字样式 */
|
||||
.left-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
font-size: 30rpx;
|
||||
color: #000000;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.goods-no {
|
||||
font-size: 26rpx;
|
||||
color: #000000;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* 右侧价格样式 */
|
||||
.price {
|
||||
margin-left: 20rpx;
|
||||
align-self: center;
|
||||
/* 垂直居中在两行文字之间 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.order-inner-price {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 10rpx;
|
||||
padding-right: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
font-size: 24rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.order-inner-action {
|
||||
display: flex;
|
||||
padding-top: 10rpx;
|
||||
padding-bottom: 30rpx;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.title-list {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
|
||||
.title-item {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tabs-active {
|
||||
font-weight: bold;
|
||||
color: $tabs-titles-item-active-color;
|
||||
opacity: $tabs-titles-item-line-opacity;
|
||||
transition: width 0.3s ease;
|
||||
|
||||
.item__line {
|
||||
position: absolute;
|
||||
bottom: -10%;
|
||||
left: 50%;
|
||||
overflow: hidden;
|
||||
content: ' ';
|
||||
border-radius: $tabs-titles-item-line-border-radius;
|
||||
opacity: $tabs-titles-item-line-opacity;
|
||||
transition: width 0.3s ease;
|
||||
transform: translate(-50%, 0);
|
||||
width: $tabs-horizontal-titles-item-active-line-width;
|
||||
height: 3px;
|
||||
content: ' ';
|
||||
background: $tabs-horizontal-tab-line-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
301
pages/order/preview.vue
Normal file
301
pages/order/preview.vue
Normal file
@@ -0,0 +1,301 @@
|
||||
<template>
|
||||
<view class="page-content">
|
||||
<nut-cell-group>
|
||||
<nut-cell v-if="!form.address_info?.address_id" title="添加地址" is-link @click="chooseAddress"></nut-cell>
|
||||
<nut-cell v-else :title="form.address_info.user_name + ' ' + form.address_info.tel_number" is-link
|
||||
:sub-title="
|
||||
form.address_info.province_name +
|
||||
form.address_info.city_name +
|
||||
form.address_info.county_name +
|
||||
form.address_info.street_name +
|
||||
form.address_info.detail_info_new
|
||||
" @click="chooseAddress"></nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell v-for="(goods, index) in list" :key="index" center>
|
||||
<!-- :title="item.goods_name"
|
||||
:sub-title="'串号:' + item.goods_no" -->
|
||||
<!-- @click="navigateTo('/pages/order/detail/index?id=' + order.order_id)" -->
|
||||
|
||||
<template #title>
|
||||
<view class="goods-info-row">
|
||||
<!-- 左侧文字区域 -->
|
||||
<view class="left-text">
|
||||
<view class="goods-name">
|
||||
<nut-tag custom-color="#1a1a1a">{{ goods.degree.degree_name }}</nut-tag>
|
||||
<text style="margin-left: 10rpx">{{ goods.goods_name }}</text>
|
||||
</view>
|
||||
<text class="goods-no">串号:{{ goods.goods_no }}</text>
|
||||
</view>
|
||||
<!-- 右侧价格区域 -->
|
||||
</view>
|
||||
</template>
|
||||
<template #link>
|
||||
<!-- <view class="price"> -->
|
||||
<nut-price :price="goods.goods_price" size="small" :need-symbol="true" />
|
||||
<!-- </view> -->
|
||||
</template>
|
||||
|
||||
<!-- <view class="goods-item" @click="navigateTo('/pages/mall/item/index?id=' + item.goods_id)">
|
||||
<view class="goods-item-left-inner">
|
||||
<view class="goods-item-left-inner-top">
|
||||
<image class="goods-item-left-inner-top-package" src="@/static/package.svg"></image>
|
||||
<text class="goods-item-left-inner-title">{{item.goods_name}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>
|
||||
{{item.content}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-item-right-inner">
|
||||
<text class="goods-item-right-inner-price-unit">¥</text>
|
||||
<text class="goods-item-right-inner-price-value">{{item.goods_price}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<text>件数</text>
|
||||
<text>{{ order_total_num }}件</text>
|
||||
</view>
|
||||
</nut-cell>
|
||||
<nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<text>商品总额</text>
|
||||
<nut-price :price="order_total_price" :need-symbol="true" />
|
||||
</view>
|
||||
</nut-cell>
|
||||
<!-- <nut-cell>
|
||||
<view class="total-price-inner">
|
||||
<view>
|
||||
<text>邮费</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>¥</text>
|
||||
<text>888</text>
|
||||
</view>
|
||||
</view>
|
||||
</nut-cell> -->
|
||||
</nut-cell-group>
|
||||
|
||||
<!-- <view class="bottom-submit-inner">
|
||||
<view class="bottom-submit-inner-info">
|
||||
<text>共计{{order_total_num}}件商品,合计:</text>
|
||||
<text>¥</text>
|
||||
<text>{{order_total_price}}</text>
|
||||
</view>
|
||||
<view class="bottom-submit-inner-btn">
|
||||
<nut-button type="primary" @click="onSubmitClick">确认下单</nut-button>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="bottom-submit-inner">
|
||||
<view class="bottom-submit-inner-info">
|
||||
<text>合计:</text>
|
||||
<nut-price size="large" :price="order_total_price" :need-symbol="true" />
|
||||
</view>
|
||||
<view class="bottom-submit-inner-btn">
|
||||
<nut-button type="primary" @click="onSubmitClick">确认下单</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
fetchOrderbuyNow,
|
||||
fetchOrderPreview
|
||||
} from '@/api/order';
|
||||
import {
|
||||
navigateTo
|
||||
} from '@/utils/helper';
|
||||
|
||||
|
||||
|
||||
|
||||
const chooseAddress = () => {
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
// console.log(res.userName)
|
||||
// console.log(res.telNumber)
|
||||
// console.log(res.provinceName + res.cityName + res.countyName + res.streetName + res.detailInfoNew)
|
||||
// console.log(res.userName)
|
||||
// console.log(res.postalCode)
|
||||
// console.log(res.provinceName)
|
||||
// console.log(res.cityName)
|
||||
// console.log(res.countyName)
|
||||
// console.log(res.detailInfo)
|
||||
// console.log(res.nationalCode)
|
||||
// console.log(res.telNumber)
|
||||
console.log(res);
|
||||
Object.assign(form, {
|
||||
address_info: {
|
||||
address_id: res.addressID || 1,
|
||||
user_name: res.userName,
|
||||
tel_number: res.telNumber,
|
||||
city_name: res.cityName || '',
|
||||
county_name: res.countyName || '',
|
||||
detail_info: res.detailInfo || '',
|
||||
detail_info_new: res.detailInfoNew || '',
|
||||
national_code: res.nationalCode || '',
|
||||
national_code_full: res.nationalCodeFull || '',
|
||||
postal_code: res.postalCode || '',
|
||||
province_name: res.provinceName || '',
|
||||
street_name: res.streetName || '',
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const ids = ref([]);
|
||||
const list = reactive([]);
|
||||
const order_total_price = ref(0);
|
||||
const order_total_num = ref(0);
|
||||
|
||||
|
||||
const form = reactive({
|
||||
goods_id: 0,
|
||||
address_info: {},
|
||||
});
|
||||
|
||||
|
||||
const fromStr = ref('');
|
||||
|
||||
|
||||
|
||||
onLoad(options => {
|
||||
console.log('🚀 ~ from:', options.from);
|
||||
fromStr.value = options.from;
|
||||
console.log('🚀 ~ ids:', options.ids);
|
||||
form.goods_id = options.ids;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
onShow(() => {
|
||||
console.log('🚀 ~ onShowfrom:', fromStr.value);
|
||||
if (fromStr.value === 'list' || fromStr.value === 'item') {
|
||||
fetchOrderPreview(form).then(res => {
|
||||
Object.assign(list, res.goods_list);
|
||||
Object.assign(form.address_info, res.address_info);
|
||||
order_total_price.value = res.order_total_price;
|
||||
order_total_num.value = res.order_total_num;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onHide(() => {
|
||||
fromStr.value = '';
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 提交订单
|
||||
const onSubmitClick = () => {
|
||||
if (!form.address_info?.address_id) {
|
||||
uni.showToast({
|
||||
title: '请选择收货地址',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
fetchOrderbuyNow(form).then(res => {
|
||||
console.log(res);
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/detail?id=' + res.order_id,
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {},
|
||||
});
|
||||
// navigateTo('/pages/order/detail/index?id=' + res.order_id)
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page-content {
|
||||
// min-height: 100vh;
|
||||
min-height: calc(100vh - 60px); //100vh;
|
||||
background-color: #f2f3f5;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 140rpx;
|
||||
}
|
||||
|
||||
/* 信息行布局 */
|
||||
.goods-info-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 10rpx;
|
||||
// border-bottom: 2rpx solid #f2f3f5;
|
||||
|
||||
/* 左侧文字样式 */
|
||||
.left-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
font-size: 30rpx;
|
||||
color: #000000;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.goods-no {
|
||||
font-size: 26rpx;
|
||||
color: #000000;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* 右侧价格样式 */
|
||||
.price {
|
||||
margin-left: 20rpx;
|
||||
align-self: center;
|
||||
/* 垂直居中在两行文字之间 */
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-submit-inner {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 120rpx;
|
||||
background: #fff;
|
||||
width: calc(100% - 40rpx);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0 auto;
|
||||
padding: 15rpx 20rpx;
|
||||
}
|
||||
|
||||
.total-price-inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
view:nth-child(2) {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user