提交
This commit is contained in:
61
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.acss
Normal file
61
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.acss
Normal file
@ -0,0 +1,61 @@
|
||||
.all{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.box{
|
||||
width: 90%;
|
||||
height: 520px;
|
||||
display: flex;
|
||||
border: 1px solid #9fa1a3;
|
||||
border-radius: 20px;
|
||||
margin-top: 20rpx;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
.image{
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.xinxi{
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
margin-left: 20rpx
|
||||
}
|
||||
.juzhong{
|
||||
display:flex;
|
||||
align-items:center
|
||||
}
|
||||
.biaoti{
|
||||
width: 249px;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.text{
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.form{
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
.xian{
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #9fa1a3;
|
||||
|
||||
}
|
||||
.zhifu{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 90%;
|
||||
height: 50px;
|
||||
background-color: #ee8d97;
|
||||
border-radius: 40px;
|
||||
position: fixed;
|
||||
bottom: 40rpx;
|
||||
}
|
||||
76
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.axml
Normal file
76
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.axml
Normal file
@ -0,0 +1,76 @@
|
||||
<view class="all">
|
||||
<!-- 商品框 -->
|
||||
<view class="box" >
|
||||
<view class="xinxi">
|
||||
<view class="juzhong">
|
||||
<image class="image" mode="scaleToFill" src="{{commoditiesImage}}" />
|
||||
</view>
|
||||
<view class="biaoti">
|
||||
<view style="margin-top:30rpx">
|
||||
<text class="text">{{commoditiesName}}</text>
|
||||
<view style="margin-top:5rpx">
|
||||
<text>¥{{commoditiesPrice}}</text>
|
||||
</view>
|
||||
<view style="margin-top:5rpx">
|
||||
<text style="color:#898c90">共1件</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="xian"></view>
|
||||
<view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">商品总价</text>
|
||||
<text style="margin-right:50rpx">¥{{commoditiesPrice}}</text>
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">姓名</text>
|
||||
<input style="width:90px" placeholder="请输入姓名" onInput="name" />
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">联系方式</text>
|
||||
<input style="width:125px" placeholder="请输入联系方式" onInput="phone" />
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">地址</text>
|
||||
<input style="width:125px" onInput="adress" placeholder="请输入上门地址" />
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">备注</text>
|
||||
<input style="width:90px" placeholder="备注" onInput="note" />
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">蚂蚁积分</text>
|
||||
<text style="margin-right:30rpx;color:#a3abb2">暂不可用</text>
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">预约时间</text>
|
||||
<text style="margin-right:30rpx;">{{yuyuetime}}</text>
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">指定美甲师</text>
|
||||
<text style="margin-right:30rpx;">{{meijiashiname}}</text>
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:space-between;margin-top:20rpx">
|
||||
<text style="font-size:19px;margin-left:30rpx">上门预约费用</text>
|
||||
<text style="margin-right:30rpx;">¥{{price}}</text>
|
||||
</view>
|
||||
<view class="xian" style="margin-top: 10rpx;"></view>
|
||||
<view style="display:flex;justify-content:right;margin-top:20rpx">
|
||||
<text style="font-size:19px;">小计</text>
|
||||
<text style="font-size:19px;color:red;margin-right:20rpx">¥{{commoditiesPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zhifu" onTap="add">
|
||||
<text style="color:white">立即预约</text>
|
||||
</view>
|
||||
</view>
|
||||
188
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.js
Normal file
188
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.js
Normal file
@ -0,0 +1,188 @@
|
||||
import {url} from '../request'
|
||||
Page({
|
||||
data: {
|
||||
price:50,
|
||||
|
||||
},
|
||||
onLoad(options) {
|
||||
const commoditiesImage = options.commoditiesImage;
|
||||
const commoditiesName = options.commoditiesName;
|
||||
const commoditiesPrice = parseFloat(options.commoditiesPrice) + this.data.price;
|
||||
const meijiashiname = options.meijiashiname;
|
||||
const yuyuetime = options.yuyuetime;
|
||||
const meijiashiid = options.meijiashiid;
|
||||
const selectedTime = options.selectedTime; // 例如 "9:00"
|
||||
const dianpuid = options.dianpuid;
|
||||
const businessName = options.businessName;
|
||||
const shopid = options.shopid;
|
||||
console.log(dianpuid,'chuanguolaideid');
|
||||
|
||||
// 获取当前日期
|
||||
const currentDate = new Date();
|
||||
const year = currentDate.getFullYear();
|
||||
const month = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // 补充两位
|
||||
const day = currentDate.getDate().toString().padStart(2, '0'); // 补充两位
|
||||
|
||||
// 处理 selectedTime,确保格式正确,例如 "9:00" 转为 "09:00"
|
||||
const timeParts = selectedTime.split(':');
|
||||
const hours = timeParts[0].padStart(2, '0'); // 补充小时
|
||||
const minutes = timeParts[1].padStart(2, '0'); // 补充分钟
|
||||
|
||||
// 拼接日期和时间
|
||||
const formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||
|
||||
// 设置格式化后的 selectedTime
|
||||
this.setData({
|
||||
commoditiesImage: commoditiesImage,
|
||||
commoditiesName: commoditiesName,
|
||||
commoditiesPrice: commoditiesPrice,
|
||||
meijiashiname: meijiashiname,
|
||||
yuyuetime: yuyuetime,
|
||||
meijiashiid: meijiashiid,
|
||||
selectedTime: formattedDateTime, // 存储格式化后的时间
|
||||
dianpuid: dianpuid,
|
||||
businessName: businessName,
|
||||
shopid:shopid
|
||||
});
|
||||
},
|
||||
|
||||
// yuyue(){
|
||||
// my.getStorage({
|
||||
// key: 'userInfo',
|
||||
// success: (res) => {
|
||||
// const userInfo = res.data;
|
||||
// this.setData({
|
||||
// id: userInfo.id, // 获取 id
|
||||
// });
|
||||
// // 发送请求移除商品
|
||||
// if (userInfo && userInfo.cookie) {
|
||||
// my.request({
|
||||
// url: url + '/api/appointments/add',
|
||||
// method: 'POST',
|
||||
// data: {
|
||||
// appointmentTime: this.data.selectedTime,
|
||||
// businessId: this.data.dianpuid,
|
||||
// businessName: this.data.businessName,
|
||||
// id: "",
|
||||
// manicuristId: this.data.meijiashiid,
|
||||
// manicuristName: this.data.meijiashiname,
|
||||
// notes: "",
|
||||
// payMethod: "",
|
||||
// phone: this.data.phone,
|
||||
// serviceMode: 1,
|
||||
// userId: userInfo.id,
|
||||
// userName: this.data.name,
|
||||
// },
|
||||
// headers: {
|
||||
// 'content-type': 'application/json',
|
||||
// 'Cookie': userInfo.cookie
|
||||
// },
|
||||
// dataType: 'json',
|
||||
// success: (res) => {
|
||||
// console.log(res);
|
||||
// if (res.data.code === 0) {
|
||||
// my.alert({content:'预约成功'})
|
||||
// my.navigateBack();
|
||||
// console.log('chenggong');
|
||||
// } else {
|
||||
// my.alert({ content: '失败,请稍后重试' });
|
||||
// console.log(this.data.name,userInfo.id,this.data.phone,this.data.meijiashiname,this.data.meijiashiid,this.data.businessName,this.data.dianpuid,this.data.selectedTime,);
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
// this.add()
|
||||
// },
|
||||
add(){
|
||||
console.log(this.data.dianpuid,'cahuasndaud');
|
||||
my.getStorage({
|
||||
key: 'userInfo',
|
||||
success: (res) => {
|
||||
const userInfo = res.data;
|
||||
this.setData({
|
||||
id: userInfo.id, // 获取 id
|
||||
|
||||
});
|
||||
// 发送请求移除商品
|
||||
|
||||
if (userInfo && userInfo.cookie) {
|
||||
my.request({
|
||||
url: url + '/api/orders/add',
|
||||
method: 'POST',
|
||||
data: {
|
||||
appointmentTime: this.data.selectedTime,
|
||||
businessName: this.data.businessName,
|
||||
manicuristId: this.data.meijiashiid,
|
||||
manicuristName: this.data.meijiashiname,
|
||||
appointmentAddresss: this.data.adress,
|
||||
businessId: this.data.dianpuid,
|
||||
notes:this.data.note,
|
||||
orderItemsAddRequest: [
|
||||
{
|
||||
attributeNames: this.data.commoditiesName,
|
||||
commoditiesId: this.data.shopid,
|
||||
quantity: 1
|
||||
}
|
||||
],
|
||||
payMethod: 0,
|
||||
serviceMode: 1,
|
||||
phone: this.data.phone,
|
||||
totalPrice: this.data.commoditiesPrice,
|
||||
userId: this.data.id,
|
||||
userName: this.data.name
|
||||
},
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Cookie': userInfo.cookie
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
console.log(this.data.name,this.data.commoditiesPrice,this.data.phone,this.data.shopid,this.data.commoditiesName,this.data.note,this.data.dianpuid,this.data.id,);
|
||||
console.log(res,'成功');
|
||||
if (res.data.code == 0) {
|
||||
my.showToast({
|
||||
content: '待商家确认,请稍后',
|
||||
duration: 2000 // 提示持续时间
|
||||
});
|
||||
my.navigateBack();
|
||||
console.log('chenggong');
|
||||
} else {
|
||||
my.alert({ content: '失败,请稍后重试' });
|
||||
console.log(this.data.name,this.data.commoditiesPrice,this.data.phone,this.data.shopid,this.data.commoditiesName,this.data.note,this.data.dianpuid,'else');
|
||||
}
|
||||
},
|
||||
fail:(res)=>{
|
||||
console.log(this.data.name,this.data.commoditiesPrice,this.data.phone,this.data.shopid,this.data.commoditiesName,this.data.note,this.data.dianpuid,'失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
name(e){
|
||||
this.setData({
|
||||
name: e.detail.value,
|
||||
});
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
phone(e){
|
||||
this.setData({
|
||||
phone: e.detail.value,
|
||||
});
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
note(e){
|
||||
this.setData({
|
||||
note: e.detail.value,
|
||||
});
|
||||
console.log(e.detail.value);
|
||||
},
|
||||
adress(e){
|
||||
this.setData({
|
||||
adress: e.detail.value,
|
||||
});
|
||||
console.log(e.detail.value);
|
||||
}
|
||||
});
|
||||
5
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.json
Normal file
5
甲情_甲意/miniprogram/pages/yuyuezhifusm/yuyuezhifusm.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"defaultTitle": "上门支付",
|
||||
"usingComponents": {},
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
Reference in New Issue
Block a user