123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <template>
- <view class="">
- <view class="card">
- <view class="classHead">
- <view class="classBorder">
- </view>
- <view class="classTitle">
- 套餐详情
- </view>
- </view>
- <view class="body">
- <image :src="'https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/'+setMeal.packages.imgUrl" alt="">
- <view class="content">
- <view class="title">
- {{setMeal.packages.name}}
- </view>
- <view class="explain">
- <a href="##">购买的套餐仅限选择的车辆使用</a>
- </view>
- </view>
- </view>
- </view>
- <Card titles="使用车辆" :data="setMeal.userCar"></Card>
- <view class="bottomBtn">
- <view class="leftView">
- <view class="unit">
- 需支付:
- </view>
- <view class="chooseNum">
- <view style="font-size: 26rpx;">
- ¥
- </view>
- <view style="font-size: 56rpx;">
- {{setMeal.price}}
- </view>
- </view>
- </view>
- <view class="rightView" @click="createOrder(setMeal.packages.id,setMeal.userCar.id,setMeal.price)">
- 确定
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- packageBuy
- } from "@/api/maintain.js"
- import {
- buyPackage
- } from "@/api/myApi.js"
- import Card from '@/components/Card'
- export default {
- components: {
- Card
- },
- data() {
- return {
- setMeal: {
- packages: {},
- userCar: {},
- price: null
- },
- url: "",
- name: "",
- cardMsg: [],
- provider: '',
- payType: 1
- };
- },
- onLoad(options) {
- this.packageBuys(JSON.parse(options.item).id)
- },
- methods: {
- createOrder(packageId, carId, price) {
- let data = {
- packageId: packageId,
- carId: carId,
- payPrice: price,
- payType: this.payType
- }
- console.log(data);
- buyPackage(data).then(res => {
- console.log(res);
- if (this.payType === 1) {
- this.provider = 'wxpay'
- }
- console.log(res.data.wechatOrder);
- uni.requestPayment({
-
- provider: this.provider,
- orderInfo: res.data.wechatOrder,
- success: (res) => {
- console.log('下单支付===============>', res);
- uni.showToast({
- icon: 'none',
- title: '下单成功'
- })
- uni.redirectTo({
- url: '/pages/preCarWash/washOrder/index'
- })
- },
- fail: (res) => {
- console.log(res, '支付失败fail');
- uni.showToast({
- icon: 'none',
- title: '支付失败:' + res.errMsg + ',code:' + res.code +
- ',errCode:' + res.errCode
- })
- }
- })
- })
- },
- packageBuys(id) {
- packageBuy({
- packageId: id
- }).then(res => {
- console.log('获取参数=================>', res);
- this.setMeal = res.data;
- })
- },
- }
- }
- </script>
- <style lang="less">
- page {
- background: #EDEDED;
- }
- .bottomBtn {
- width: 690rpx;
- height: 110rpx;
- background: #FFFFFF;
- border: 1px solid #EEEEEE;
- box-shadow: 0px 8rpx 17rpx 0px rgba(168, 165, 165, 0.26);
- border-radius: 55rpx;
- margin-left: 30rpx;
- position: absolute;
- bottom: 67rpx;
- z-index: 9998;
- .leftView {
- float: left;
- height: 100%;
- display: flex;
- align-items: center;
- .unit {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- line-height: 31rpx;
- padding-left: 52rpx;
- }
- .chooseNum {
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FF3C00;
- line-height: 31rpx;
- display: flex;
- align-items: baseline;
- }
- }
- .rightView {
- float: right;
- width: 210rpx;
- height: 108rpx;
- background: linear-gradient(0deg, #005AFF 0%, #0078FF 100%);
- border-radius: 0 55rpx 55rpx 0;
- font-size: 34rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FEFEFE;
- line-height: 108rpx;
- text-align: center;
- }
- }
- .card {
- width: 94%;
- height: 239rpx;
- margin-left: 3%;
- background: #FFFFFF;
- border-radius: 10rpx;
- margin-top: 28rpx;
- .classHead {
- display: flex;
- padding-top: 28rpx;
- width: 100%;
- height: 28rpx;
- .classBorder {
- width: 5rpx;
- height: 28rpx;
- background: linear-gradient(0deg, #005AFF 0%, #0078FF 100%);
- border-radius: 3rpx;
- }
- .classTitle {
- height: 25rpx;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- padding-left: 28rpx;
- line-height: 28rpx;
- }
- }
- .body {
- display: flex;
- align-items: center;
- padding: 36rpx 0 0 26rpx;
- image {
- width: 120rpx;
- height: 120rpx;
- }
- .content {
- padding-left: 30rpx;
- .title {
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- line-height: 31rpx;
- }
- .explain {
- margin-top: 23rpx;
- a {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #005BFF;
- line-height: 31rpx;
- text-decoration: none;
- }
- }
- }
- }
- }
- </style>
|