master
xy 1 year ago
parent 06982cbe2a
commit d70fb991c2

@ -34,6 +34,7 @@ let apiApp = {
productDetail: '/api/mobile/product/product-detail',
productOrder: '/api/mobile/product/order',
productPay: '/api/mobile/product/pay',
productOrderRefund: '/api/mobile/user/order-refund',
// 收货地址
userAddress: '/api/mobile/user-address/index',
userAddressShow: '/api/mobile/user-address/show',
@ -89,7 +90,7 @@ const install = (Vue, vm) => {
const productList = (params = {}) => vm.$u.get(apiApp.productList, params)
const productDetail = (params = {}) => vm.$u.get(apiApp.productDetail, params)
const productOrder = (params = {}) => vm.$u.post(apiApp.productOrder, params)
const productPay = (params = {}) => vm.$u.get(apiApp.productPay, params)
const productPay = (params = {}) => vm.$u.post(apiApp.productPay, params)
// 收货地址
const userAddress = (params = {}) => vm.$u.get(apiApp.userAddress, params)
const userAddressShow = (params = {}) => vm.$u.get(apiApp.userAddressShow, params)
@ -98,7 +99,7 @@ const install = (Vue, vm) => {
// 用户商城订单
const userOrders = (params = {}) => vm.$u.get(apiApp.userOrders, params)
const userOrdersDetail = (params = {}) => vm.$u.get(apiApp.userOrdersDetail, params)
const productOrderRefund = (params = {}) => vm.$u.get(apiApp.productOrderRefund, params)
const hospitalList = (params = {}) => vm.$u.get(apiApp.hospital, params)
const banner = (params = {}) => vm.$u.get(apiApp.banner, params)
// end
@ -131,7 +132,7 @@ const install = (Vue, vm) => {
// 收货地址
userAddress,userAddressShow,userAddressSave,userAddressDestroy,
// 用户商城订单
userOrders,userOrdersDetail,
userOrders,userOrdersDetail,productOrderRefund,
// 购物车
cartList, cartSave, cartShow, cartDestroy

@ -37,10 +37,9 @@
<view class="order" v-for="i in list[swiperIndex]" :key="i.id">
<view class="title">
<view class="title__name">
<u-tag size="mini" type="primary" mode="dark" shape="circleLeft" :text="i.type === 1 ? '陪诊' : '陪护'"></u-tag>
<text style="padding-left: 10rpx;">专享半天陪诊</text>
<text style="padding-left: 10rpx;">{{ i.title }}</text>
</view>
<view class="title__status">{{ statusFormat(i.pay_status) }}</view>
<view class="title__status">{{ i.pay_status ? '已支付' : '待支付' }}</view>
</view>
<view class="price">
@ -49,40 +48,13 @@
</view>
<view class="price-text">
<view class="price-text__num">{{ i.accompany_product ? i.accompany_product.price : 0 }}</view>
<view class="price-text__num">{{ i.price }}</view>
<view class="price-text__no"
>订单号 {{ i.no }}</view
>
</view>
</view>
<view class="info"
@click.stop.native="$u.route({
url: '/package_sub/pages/AddOrder/AddOrder',
params: {
order_id: i.id,
type: i.type,
site_id: i.hospital.site_id
}
})">
<view class="info__item">
<text>就诊城市</text>
<text>{{ i.city || ((i.hospital && i.hospital.site) ? i.hospital.site.name : "") || " " }}</text>
</view>
<view class="info__item">
<text>就诊医院</text>
<text>{{ i.hospital ? i.hospital.name : '' }}</text>
</view>
<view class="info__item">
<text>就诊人</text>
<text>{{ i.user_archive ? i.user_archive.name : i.user_archive_id }}</text>
</view>
<view class="info__item">
<text>就诊时间</text>
<text>{{ i.time ? $moment(i.time).format('YYYY年MM月DD日 HH:mm') : '' }}</text>
</view>
</view>
<view class="bottom">
<view class="row1">
<view class="time">
@ -95,11 +67,9 @@
:custom-style="payBtnStyle"
:throttle-time="2000"
@click="$u.route({
url: '/package_sub/pages/AddOrder/AddOrder',
url: '/package_sub/pages/Shop/Pay',
params: {
order_id: i.id,
type: i.type,
site_id: i.hospital ? i.hospital.site_id : ''
order_id: i.id
}
})"
>{{ i.pay_status === 0 ? '立即支付' : '查看订单' }}</u-button
@ -238,8 +208,7 @@ export default {
if (this.loadStatus[this.swiperCurrent] === 'nomore') return
try {
this.loadStatus[this.swiperCurrent] = 'loading'
const res = await this.$u.api.productOrder(this.select);
console.log(res);
const res = await this.$u.api.userOrders(this.select);
this.tabs[this.swiperCurrent].count = res.total;
if (isRefresh) {
this.list[this.swiperCurrent].length = 0;
@ -248,13 +217,12 @@ export default {
if (this.list[this.swiperCurrent].length >= res.total) {
this.loadStatus[this.swiperCurrent] = 'nomore'
} else {
this.select.page++;
this.loadStatus[this.swiperCurrent] = 'loadmore'
}
} catch (err) {
console.error(err);
this.loadStatus[this.swiperCurrent] = 'loadmore'
} finally {
this.loadStatus[this.swiperCurrent] = 'loadmore'
}
},
},

@ -17,27 +17,47 @@
</u-navbar>
<view class="wrap">
<view class="site" @tap="showPop = true">
<view v-if="site.id" style="padding-right: 80rpx">
<view class="top">
<view class="tag" v-if="site.is_default"> </view>
<view class="city">{{ site.city }}</view>
</view>
<view class="center">
<view class="address">{{ site.address }}</view>
<view>
<view v-if="!detail.id" class="site" @tap="showPop = true">
<view v-if="site.id" style="padding-right: 80rpx">
<view class="top">
<view class="tag" v-if="site.is_default"> </view>
<view class="city">{{ site.city }}</view>
<view class="name">{{ site.name }} {{ site.mobile }}</view>
</view>
<view class="center">
<view class="address">{{ site.address }}</view>
</view>
<view class="bottom">
<text>{{ site.name }} {{ site.mobile }}</text>
</view>
</view>
<view class="bottom">
<text>{{ site.name }} {{ site.mobile }}</text>
<view class="no-site" v-else> </view>
<view class="site-select">
<u-icon
name="arrow-right"
label="选择"
label-pos="left"
label-color="#666"
></u-icon>
</view>
</view>
<view class="no-site" v-else> </view>
<view class="site-select">
<u-icon
name="arrow-right"
label="选择"
label-pos="left"
label-color="#666"
></u-icon>
<view v-if="detail.id && detail.user_address" class="site">
<view>
<view class="top">
<view class="tag" v-if="detail.user_address && detail.user_address.is_default"> </view>
<view class="city">{{ detail.user_address.city }}</view>
<view class="name">{{ detail.user_address.name }} {{ detail.user_address.mobile }}</view>
</view>
<view class="center">
<view class="address">{{ detail.user_address.address }}</view>
</view>
<view class="bottom">
<text>{{ detail.user_address.name }} {{ detail.user_address.mobile }}</text>
</view>
</view>
</view>
</view>
@ -79,12 +99,44 @@
</view>
<view class="price">
<view class="price-row" v-if="detail.express_name">
<view class="price-row__name">
快递名称
</view>
<view class="price-row__value">
<text>{{ detail.express_name }}</text>
</view>
</view>
<view class="price-row" v-if="detail.express_number">
<view class="price-row__name">
快递单号
</view>
<view class="price-row__value">
<text>{{ detail.express_number }}</text>
</view>
</view>
<view class="price-row" v-if="detail.created_at">
<view class="price-row__name">
下单日期
</view>
<view class="price-row__value">
<text>{{ detail.created_at }}</text>
</view>
</view>
<view class="price-row" v-if="detail.no">
<view class="price-row__name">
订单号
</view>
<view class="price-row__value">
<text>{{ detail.no }}</text>
</view>
</view>
<view class="price-row">
<view class="price-row__name">
合计
</view>
<view class="price-row__value">
¥ {{ totalPrice }}
¥ {{ detail.id ? detail.price : totalPrice }}
</view>
</view>
</view>
@ -92,12 +144,29 @@
<view class="bottom">
<view>
<u-button
v-if="!detail.id"
shape="circle"
ripple
:custom-style="btnStyle"
@click="submit"
> </u-button
>
<u-button
v-else-if="detail.id && detail.pay_status === 0"
shape="circle"
ripple
:custom-style="btnStyle"
@click="payOrder(detail)"
>立即支付</u-button
>
<u-button
v-else-if="detail.id && detail.pay_status === 1"
shape="circle"
ripple
:custom-style="btnStyle"
@click="refund"
>申请退款</u-button
>
</view>
</view>
@ -164,6 +233,7 @@ export default {
site: {},
sites: [],
carts: [],
detail: {}
};
},
methods: {
@ -201,18 +271,21 @@ export default {
return
}
try {
const res = await this.$u.api.productOrder({
user_addres_id: this.site.id
const { model } = await this.$u.api.productOrder({
user_address_id: this.site.id
});
if (res) {
if (model) {
uni.showModal({
title: "下单成功",
content: "下单成功,是否立即支付?",
success: (status) => {
if (status.confirm) {
this.payOrder(res);
this.payOrder(model);
} else {
this.$u.route({
url: '/package_sub/pages/Shop/Order',
type: 'reLaunch'
})
}
},
fail: () => {
@ -249,6 +322,10 @@ export default {
title: "支付成功",
icon: "none",
});
this.$u.route({
url: '/package_sub/pages/Shop/Order',
type: 'reLaunch'
})
}
} catch (err) {
uni.showToast({
@ -257,6 +334,39 @@ export default {
});
}
},
async getDetail(id) {
try {
const res = await this.$u.api.userOrdersDetail({ id })
this.detail = res
} catch (err) {
console.error(err)
}
},
async refund() {
try {
uni.showModal({
title: "提示",
content: "确认申请退款?",
success: async (status) => {
if (status.confirm) {
await this.$u.api.productOrderRefund({
id: this.detail.id
})
await this.getDetail({
id: this.detail.id
})
} else {
}
},
fail: () => {
},
});
} catch (err) {
console.error(err)
}
}
},
computed: {
totalPrice() {
@ -266,7 +376,13 @@ export default {
},
created() {
this.getSites();
this.getCarts();
},
onLoad(option) {
if (option.order_id) {
this.getDetail(option.order_id)
} else {
this.getCarts();
}
},
};
</script>
@ -292,6 +408,11 @@ export default {
color: #666666;
margin-left: 10rpx;
}
.name {
font-size: 22rpx;
color: #999;
margin-left: 10rpx;
}
.tag {
display: flex;
font-weight: normal;
@ -395,9 +516,21 @@ export default {
&-row {
display: flex;
align-items: center;
// line-height: 80rpx;
justify-content: space-between;
position: relative;
&::before {
content: '';
background: #ccc;
height: 2rpx;
position: absolute;
top: -19rpx;
left: 10rpx;
right: 10rpx;
}
&:nth-child(1):before {
opacity: 0;
}
&__name {
font-size: 24rpx;
color: #000000;
@ -408,8 +541,15 @@ export default {
color: red;
font-weight: 500;
text-align: right;
text {
color: #666;
}
}
}
.price-row + .price-row {
margin-top: 40rpx;
}
}
.bottom {
position: fixed;

@ -18,7 +18,8 @@
<u-icon name="arrow-down" size="22"></u-icon>
</view>
<view class="icon">
<image src="~@/static/index/icon.png" mode="aspectFit" alt=""></image>
<text style="color:#fff;font-size: 28rpx;font-weight: 500;letter-spacing: 2rpx;">四世同堂整合照护平台</text>
<!-- <image src="~@/static/index/icon.png" mode="aspectFit" alt=""></image>-->
</view>
</view>

@ -2,10 +2,10 @@
<view class="container">
<image class="bkg" mode="aspectFill" src="~@/static/me/bkg.png"></image>
<view class="top">
<view class="top" @click="isShowMyInfo = true">
<image class="avatar" mode="aspectFit" :src="vuex_user.headimgurl || vuex_default_icon"></image>
<view v-if="token" class="info" @click="isShowMyInfo = true">
<view v-if="token" class="info">
<view class="info-name">
{{ vuex_user.nickname || '微信用户' }}
</view>
@ -13,10 +13,13 @@
<text v-if="vuex_user.mobile">
{{ vuex_user.mobile || '' }}
</text>
<!-- <u-button shape="circle"-->
<!-- size="mini"-->
<!-- type="primary"-->
<!-- ripple>获取手机号</u-button>-->
<u-button v-if="!vuex_user.mobile"
shape="circle"
size="mini"
open-type="getPhoneNumber"
type="primary"
@getphonenumber="onPhoneNumber"
ripple>获取手机号</u-button>
</view>
</view>
<view v-else class="info">
@ -87,11 +90,11 @@
<u-icon class="row__icon" name="share"></u-icon>
<view>我要分享</view>
</button>
<view class="row">
<view class="row" @click="isShowModal = true">
<u-icon class="row__icon" name="man-add"></u-icon>
<view>加入我们</view>
</view>
<view class="row">
<view class="row" @click="isShowModal = true">
<u-icon class="row__icon" name="kefu-ermai"></u-icon>
<view>联系我们</view>
</view>
@ -119,11 +122,9 @@
<u-radio name="保密">保密</u-radio>
</u-radio-group>
</u-form-item>
<!-- <u-form-item label="手机号">-->
<!-- <button class="btn-normal" open-type="getPhoneNumber" @getphonenumber="onPhoneNumber">-->
<!-- <view>{{ vuex_user.mobile || '点击授权' }}</view>-->
<!-- </button>-->
<!-- </u-form-item>-->
<u-form-item label="手机号">
<u-input v-model="form.mobile"></u-input>
</u-form-item>
</u-form>
</view>
<!-- 操作按钮 -->
@ -134,6 +135,9 @@
</view>
</u-popup>
</view>
<u-modal v-model="isShowModal" :show-title="false" content="客服热线xxx-xxxxxxxx"></u-modal>
</view>
</template>
@ -147,6 +151,7 @@ export default {
},
data() {
return {
isShowModal: false,
isShowMyInfo: false,
form: {
headimgurl: '',
@ -156,6 +161,19 @@ export default {
};
},
methods: {
async onPhoneNumber(e) {
try {
if (e.detail.encryptedData) {
const res = await this.$u.api.getMobile({
code: e.detail.encryptedData
})
const { user } = await this.$u.api.getUserInfo()
this.$u.vuex('vuex_user', user)
}
} catch (err) {
console.error(err)
}
},
onChooseAvatar(e) {
uni.uploadFile({
url: ROOTPATH + "/api/mobile/upload-file",
@ -206,6 +224,15 @@ export default {
return this.vuex_token || uni.getStorageSync('lifeData')?.vuex_token
}
},
watch: {
vuex_user: {
handler: function (newVal) {
this.form.mobile = newVal.mobile
this.form.sex = newVal.sex
this.form.headimgurl = newVal.headimgurl
}
}
},
onLoad() {
},
}
@ -339,5 +366,8 @@ export default {
.btn-normal::after {
border: none
}
.auth-btn {
color: $uni-color-primary;
}
}
</style>

@ -189,7 +189,7 @@ export default {
select: {
page: 1,
pay_status: "",
page_size: 20,
page_size: 10,
},
list: [],
};
@ -252,6 +252,7 @@ export default {
if (this.list[this.swiperCurrent].length >= res.total) {
this.loadStatus[this.swiperCurrent] = 'nomore'
} else {
this.select.page++;
this.loadStatus[this.swiperCurrent] = 'loadmore'
}
} catch (err) {

Loading…
Cancel
Save