add order count

master
lynn 9 months ago
parent e9cbb2cd48
commit badf7be500

@ -1,5 +1,5 @@
{
"dependencies": {
"copy-webpack-plugin": "^5.0.0"
"copy-webpack-plugin": "^6.4.1"
}
}

@ -62,6 +62,49 @@
</view>
</view>
<!-- 数量选择器 - 新建订单时显示 -->
<view v-if="!orderId && accompanyProduct.id && form.can_multi_num==1" class="quantity-card">
<view class="quantity-card__header">
<view class="quantity-card__title">产品数量</view>
<view class="quantity-card__content">
<view class="quantity-control">
<u-button
size="mini"
type="default"
@click="decreaseQuantity"
:disabled="form.quantity <= 1"
:custom-style="{ width: '60rpx', height: '60rpx', borderRadius: '50%' }"
:throttle-time="0"
>
<u-icon name="minus" size="20" color="#666"></u-icon>
</u-button>
<view class="quantity-display">{{ form.quantity }}</view>
<u-button
size="mini"
type="default"
@click="increaseQuantity"
:custom-style="{ width: '60rpx', height: '60rpx', borderRadius: '50%' }"
:throttle-time="0"
>
<u-icon name="plus" size="20" color="#666"></u-icon>
</u-button>
</view>
</view>
</view>
</view>
<!-- 数量显示 - 编辑订单时显示 -->
<view v-if="orderId && form.quantity" class="quantity-card">
<view class="quantity-card__header">
<view class="quantity-card__title">产品数量</view>
<view class="quantity-card__content">
<view class="quantity-display-static">
{{ form.quantity }}
</view>
</view>
</view>
</view>
<view class="card" v-if="form.nurse_id && nurse.id">
<view class="desc-card__title">
护工信息
@ -326,6 +369,12 @@
</view>
<br />
<view class="desc-card__content--title"> 数量 </view>
<view class="desc-card__content--value">
{{ form.quantity || 1 }}
</view>
<br />
<!-- <view class="desc-card__content&#45;&#45;title"> 服务标价 </view>-->
<!-- <view class="desc-card__content&#45;&#45;value"> ¥ 288 </view>-->
<!-- <br />-->
@ -352,7 +401,7 @@
<view class="bottom-bar">
<view class="price">
<text>实付</text>
<text>¥ {{ orderId?paidPrice:accompanyProduct.price }}</text>
<text>¥ {{ orderId ? paidPrice : ((accompanyProduct.price || 0) * (form.quantity || 1)) }}</text>
</view>
<u-button
v-if="form.pay_status === 0"
@ -673,6 +722,7 @@ export default {
content: "",
pay_status: 0,
no: "",
quantity: 1,
},
rules: {
user_archive_id: [
@ -739,6 +789,7 @@ export default {
this.$refs.uForm.setRules(this.rules);
},
onLoad(option) {
this.form.can_multi_num = option.can_multi_num ? Number(option.can_multi_num) : 0
this.form.accompany_product_id = option.id ? Number(option.id) : "";
this.form.type = Number(option.type);
uni.setNavigationBarTitle({
@ -754,6 +805,28 @@ export default {
},
methods: {
//
increaseQuantity() {
if (this.form.quantity < 99) { // 99
this.$set(this.form, 'quantity', this.form.quantity + 1);
} else {
uni.showToast({
title: '最大数量为99',
icon: 'none'
});
}
},
//
decreaseQuantity() {
if (this.form.quantity > 1) {
this.$set(this.form, 'quantity', this.form.quantity - 1);
} else {
uni.showToast({
title: '最小数量为1',
icon: 'none'
});
}
},
//
async getList(type) {
const res = await this.$u.api.accompanyProduct({
@ -775,6 +848,11 @@ export default {
this.form[key] = res[key];
}
}
//
if (!this.form.quantity) {
this.form.quantity = 1;
}
this.form['created_at'] = res['created_at']
this.form['status'] = res['status']
this.form['nurse_id'] = res['nurse_id']
@ -885,6 +963,8 @@ export default {
}
}
// return
this.form.price = this.orderId ? this.paidPrice : (this.accompanyProduct.price * this.form.quantity)
this.form.total = this.form.quantity.toString()
const res = await this.$u.api.accompanyProductOrder(this.form);
if (res) {
this.orderId = res.id;
@ -1160,6 +1240,79 @@ export default {
background: #f4efee;
}
// Card
.quantity-card {
background: #fff;
border-radius: 20rpx;
margin: 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 30rpx;
&__header {
display: flex;
justify-content: space-between;
align-items: center;
}
&__title {
font-size: 28rpx;
color: #000000;
font-weight: bold;
position: relative;
padding-left: 24rpx;
&::before {
content: "";
background: linear-gradient(
0deg,
#c10d12 0%,
#c10d12 6%,
#e26165 100%
);
border-radius: 4rpx;
width: 6rpx;
position: absolute;
top: 0;
left: 0;
bottom: 0;
}
}
&__content {
display: flex;
align-items: center;
.quantity-control {
display: flex;
align-items: center;
justify-content: center;
.quantity-display {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
background: #f8f8f8;
border-radius: 8rpx;
margin: 0 20rpx;
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.quantity-display-static {
font-size: 28rpx;
color: #333;
font-weight: 500;
padding: 10rpx 20rpx;
background: #f8f8f8;
border-radius: 8rpx;
text-align: center;
}
}
}
}
.pay-popup {
&-container {
padding-bottom: 20rpx;

@ -120,11 +120,11 @@
},
mounted() {
},
computed: {
token() {
return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token
}
},
computed: {
token() {
return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token
}
},
methods: {
async getDetail(id) {
@ -136,28 +136,28 @@
})
},
toOrder(info) {
if (!this.token) {
uni.showModal({
title: "提示",
content: "请先登录再下单",
confirmText: "登录",
success: (status) => {
if (status.confirm) {
this.$u.route({
url: '/pages/login/login',
type: 'redirect'
})
} else {
}
},
fail: () => {},
});
return
toOrder(info) {
if (!this.token) {
uni.showModal({
title: "提示",
content: "请先登录再下单",
confirmText: "登录",
success: (status) => {
if (status.confirm) {
this.$u.route({
url: '/pages/login/login',
type: 'redirect'
})
} else {
}
},
fail: () => {},
});
return
}
this.$u.route({
url: '/package_sub/pages/AddOrder/AddOrder?id='+info.id+'&site_id='+info.site_id+'&type='+info.type
url: '/package_sub/pages/AddOrder/AddOrder?id='+info.id+'&site_id='+info.site_id+'&type='+info.type+'&can_multi_num='+info.can_multi_num
})
},
}

@ -124,7 +124,8 @@
this.getList()
},
confirmSite(e) {
// this.$u.vuex("vuex_site", e[0])
// this.$u.vuex("vuex_site", e[0])
console.log(e[0])
this.select.site_id = e[0].id?e[0].id:''
this.site_name = e[0].name?e[0].name:'全部'
this.list = []

@ -0,0 +1,28 @@
{
"appid": "wx2129de75c4937c40",
"compileType": "miniprogram",
"libVersion": "3.8.8",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "yikangyang-wx",
"setting": {
"compileHotReLoad": true
}
}

@ -7,11 +7,13 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
configureWebpack:{
plugins: [
new CopyWebpackPlugin([{
from: path.join(__dirname, 'agent_sub/wxcomponents'),
to: path.join(__dirname, 'unpackage/dist', process.env.NODE_ENV === 'production' ? 'build' : 'dev',
'mp-weixin', 'agent_sub/wxcomponents')
}])
new CopyWebpackPlugin({
patterns: [{
from: path.join(__dirname, 'package_sub'),
to: path.join(__dirname, 'unpackage/dist', process.env.NODE_ENV === 'production' ? 'build' : 'dev',
'mp-weixin', 'package_sub')
}]
})
]
}
}

Loading…
Cancel
Save