feat: move project

This commit is contained in:
ckaaaa 2025-09-16 13:41:49 +08:00
commit 4a940f28ba
97 changed files with 5047 additions and 0 deletions

141
pages/sharebuy/sharebuy.js Normal file
View file

@ -0,0 +1,141 @@
import C from '../../utils/constant';
import * as F from '../../utils/func';
import R from '../../utils/request';
Page({
data: {
expireDate: '',
price: '',
shareId: '',
isPay: false,
orderNo: '',
phone: '',
username: '',
tip_before_pay: '',
tip_after_pay: '',
buy_type: '',
},
onLoad(options) {
const { id, orderNo } = options;
if (orderNo) {
this.setData({
isPay: true,
orderNo,
})
this.fetchOrder(orderNo);
} else {
R.get('/index.php/api/v1/get_share', { id }).then(({ model }) => {
this.setData({
shareId: id,
price: F.formatePrice(model.price),
expireDate: model.expire_time,
tip_before_pay: model.tip_before_pay || '',
tip_after_pay: model.tip_after_pay || '',
buy_type: model.buy_type,
});
}).catch((e)=>{
console.log('xxx',e);
})
R.get('/index.php/api/v1/view_share', { id });
}
},
refresh() {
if (this.data.orderNo) {
this.fetchOrder(this.data.orderNo);
}
},
fetchOrder(orderNo) {
const that = this;
return R.get('/index.php/api/v1/fetch_order_pay', { order_no: orderNo }).then(({ model }) => {
console.log('payed', model);
if (model.status === 'payed') {
clearInterval(that.data.timer);
wx.hideLoading();
this.setData({
isPay: true,
orderNo,
price: F.formatePrice(model.price),
buy_type: model.buy_type,
});
}
});
},
checkOrderStatus(orderNo) {
wx.showLoading({
title: '确认支付中...',
})
this.data.timer = setInterval(() => {
this.fetchOrder(orderNo).catch(() => {
clearInterval(this.data.timer);
});
}, 1000);
},
goPay() {
const that = this;
if (this.data.shareId) {
R.post('/index.php/api/v1/make_order', { share_id: this.data.shareId }).then(({ model: { order_no } }) => {
that.data.orderNo = order_no;
R.post('/index.php/api/v1/pay_order', { order_no }).then(({ model }) => {
wx.requestPayment({
...model,
success(res) {
wx.showToast({
title: '支付成功',
icon: 'success',
duration: 2000,
success() {
that.checkOrderStatus(order_no);
// this.setData({
// isPay: true,
// })
}
})
},
fail(res) {
wx.showToast({
title: '您已取消支付',
icon: 'none',
duration: 2000
})
// wx.redirectTo({
// url: '/pages/shop/shop?path=user',
// });
}
})
})
})
}
},
onShareAppMessage() {
},
validate() {
const { username, phone, orderNo, } = this.data;
if (!username) {
wx.showToast({ title: '请输入姓名', icon: 'none' });
return false;
}
if (!/^1\d{10}$/.test(phone)) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' });
return false;
}
return true;
},
submit() {
if (!this.validate()) return;
const {
username, phone, orderNo,
} = this.data
R.post('/index.php/api/v1/mark_order_info', { name: username, phone, order_no: orderNo, }).then(({ model }) => {
wx.showToast({
title: '提交成功',
icon: 'success',
duration: 2000,
success() {
wx.redirectTo({
url: '/pages/paylist/paylist?from=sharebuy',
})
}
});
});
},
})

View file

@ -0,0 +1,9 @@
{
"navigationBarTitleText": "支付",
"backgroundTextStyle": "light",
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-button": "tdesign-miniprogram/button/button",
"t-input": "tdesign-miniprogram/input/input"
}
}

View file

@ -0,0 +1,57 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.logo {
height: 180rpx;
width: 180rpx;
margin: 0 auto;
background-image: url('http://cdn.zhonganonline.top/liiistem/static/liii_icon.png');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.form {
background: #fff;
border-radius: 10rpx;
overflow: hidden;
}
.footer {
margin-top: 40rpx;
padding: 0 20rpx;
}
.card {
margin: 20rpx 0;
padding: 0 20rpx;
.line {
font-size: 36rpx;
line-height: 60rpx;
}
}
.ma {
height: 20rpx;
}
.desc {
color: #666;
font-size: 28rpx;
margin-top: 20rpx;
line-height: 34rpx;
}
.refresh{
text-align: center;
margin-top: 20rpx;
color: #999;
}

View file

@ -0,0 +1,37 @@
<view class="logo"></view>
<view class="card" wx:if="{{!isPay}}">
<!-- <view class="line">付款: {{price}}元</view>
<view class="line">付款有效期: {{expireDate}}</view> -->
<t-cell title="付款" hover note="{{price}}元" />
<t-cell title="有效期" hover note="{{expireDate}}" />
<t-cell title="类型" hover note="{{buy_type}}" />
<view class="ma"></view>
<t-button theme="primary" size="large" block bind:tap="goPay">立即付款</t-button>
<view class="refresh" bind:tap="refresh">已支付? 手动刷新</view>
<view class="ma"></view>
<view class="ma"></view>
<view wx:if="{{tip_before_pay}}">
<!-- <view>支付提示:</view> -->
<rich-text class="desc" nodes="{{tip_before_pay}}"></rich-text>
</view>
</view>
<view wx:else>
<!-- <view>付款订单号: {{orderNo}}</view> -->
<!-- <view>付款成功: {{price}}元</view> -->
<t-cell title="付款订单号" hover note="{{orderNo}}" />
<t-cell title="类型" hover note="{{buy_type}}" />
<t-cell title="付款成功" hover note="{{price}}元" />
<view class="ma"></view>
<view class="form">
<t-input label="姓名" placeholder="请输入姓名" model:value="{{username}}" />
<t-input label="电话" placeholder="请输入电话" type="digit" model:value="{{phone}}" />
</view>
<view class="footer">
<t-button theme="primary" block catchtap="submit">提交</t-button>
</view>
<view class="ma"></view>
<view class="ma"></view>
<view wx:if="{{tip_after_pay}}">
<rich-text class="desc" nodes="{{tip_after_pay}}"></rich-text>
</view>
</view>

View file

@ -0,0 +1,48 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.logo {
height: 180rpx;
width: 180rpx;
margin: 0 auto;
background-image: url('http://cdn.zhonganonline.top/liiistem/static/liii_icon.png');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.form {
background: #fff;
border-radius: 10rpx;
overflow: hidden;
}
.footer {
margin-top: 40rpx;
padding: 0 20rpx;
}
.card {
margin: 20rpx 0;
padding: 0 20rpx;
}
.card .line {
font-size: 36rpx;
line-height: 60rpx;
}
.ma {
height: 20rpx;
}
.desc {
color: #666;
font-size: 28rpx;
margin-top: 20rpx;
line-height: 34rpx;
}
.refresh{
text-align: center;
margin-top: 20rpx;
color: #999;
}