123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- <template>
- <view>
- <van-radio-group >
- <van-cell-group
- v-for="(item, index) in list"
- :key="index"
- >
- <van-cell
- :border="false"
- :title="item.title"
- @click="onChange(index)"
- >
- <template slot="right-icon">
- <van-radio-group style="width: 20upx;" :value="radio" >
- <van-radio checked-color="#D9332E" :name="index" >
- </van-radio>
- </van-radio-group>
- </template>
- </van-cell>
- </van-cell-group>
- </van-radio-group>
-
- <view v-if="radio === 0"
- style="border-top: 15upx solid #F5F5F5;
- border-bottom: 15upx solid #F5F5F5;
- "
- >
- <van-field
- @change="gethotelname"
- :value="hotelname"
- label="酒店"
- disabled
- placeholder="请输入酒店"
- />
-
- <van-field
- @change="gethonename"
- :value="honename"
- label="房间号"
- placeholder="请输入房间号"
- />
- <van-field
- @change="getusername"
- :value="username"
- label="收货人"
- placeholder="请输入收货人"
- />
- <van-field
- @change="getphone"
- :value="phone"
- label="手机号"
- placeholder="请输入手机号"
- />
-
- </view>
-
- <view v-if="radio === 2"
- style="border-top: 15upx solid #F5F5F5;
- border-bottom: 15upx solid #F5F5F5;
- "
- >
- <van-field
- @change="getreserve"
- :value="reserve"
- disabled
- label="预定酒店"
- placeholder="请输入预定酒店"
- />
-
- <van-field
- @change="getCheckedin"
- :value="Checkedin"
- label="入住人"
- placeholder="请输入入住人"
- />
- <van-field
- @change="getnumberphone"
- :value="numberphone"
- label="手机号"
- placeholder="请输入手机号"
- />
- <van-field
- @change="getremark"
- :value="remark"
- label="备注"
- placeholder="请输入备注"
- />
- </view>
-
- <view v-if="radio == 2">
- <van-radio-group >
- <van-cell-group
- >
- <van-cell
- :border="false"
- @click="getread"
- >
- <template slot="title">
- 我已阅读并同意 <span style="color: #007AFF">预定须知</span>
- </template>
- <template slot="right-icon">
- <van-radio-group style="width: 20upx;" :value="read" >
- <van-radio checked-color="#D9332E" :name="4" >
- </van-radio>
- </van-radio-group>
- </template>
- </van-cell>
- </van-cell-group>
- </van-radio-group>
- </view>
-
-
- <van-cell v-if="radio === 1&&choseadress == '' " @click="goAdress" class="LinkAdress" title="选择地址" is-link/>
- <view v-if="radio === 1&&choseadress != ''" @click="goAdress" class="wrapper">
- <view class="u-box" >
- <text class="name" style="padding-right: 20upx;">{{choseadress.address_realname}}</text>
- <text class="mobile">{{choseadress.address_mob_phone}}</text>
- </view>
- <view class="u-box">
- <text class="address">{{choseadress.area_info}} {{choseadress.address_detail}}</text>
- </view>
- </view>
-
- <view @tap="goDetail()" class="cart-list">
- <view class="topTip">
- <view style="display: flex;align-items: center;border-bottom: 1px solid #F5F5F5;">
- <image :src="pictureUrl+'/uploads/home/store/'+store.store_id+'/'+store.store_logo" style="border-radius: 50%;
- width: 50upx;height: 50upx;"></image>
- <span style="padding-left: 8upx;">{{store.store_name}}</span>
- </view>
- </view>
-
- <view v-for="(item,index) in pricelist" :key="index" class="shoplist" style="background-color: #fff;">
- <view>
- <van-card
- title-class="changewidth"
- price-class ="priceClass"
- :price="item.goods_price"
- :desc="item.descire+'X'+item.goods_num"
- :title="item.desarray"
- :thumb="pictureUrl + '/uploads/home/store/goods/' + item.goods_image.substr(0, item.goods_image.indexOf('\_')) + '/' + item.goods_image"
- >
- </van-card>
- </view>
- </view>
- <view class="topTip" v-if="radio === 1">
- <view style="font-size: 28upx;">运费:{{ralodprice}}</view>
- </view>
- </view>
- <!-- 底部付款 -->
- <view class="adressbutton">
- <view class="buttonStatus">
- <view @click="estimate" class="deleteOrder">应付<span>¥{{prices}}</span></view>
- <view class="payOrder" @click="goPay">付款</view>
- </view>
- </view>
-
- </view>
- </template>
- <script>
-
- export default {
- data() {
- return {
- read: 0,
- hotelname:'', //
- honename:'',
- phone:'',
- username:'',
- reserve:'', // yudingjiudian
- Checkedin:'',
- numberphone:'',
- remark:'',
- ralodprice: 0,
- prices:'',
- pictureUrl: this.pictureUrl,
- list:[
- {title:'请送到我的房间'},
- {title:'快递到我的地址'},
- {title:'处理我的客房预定'}
- ],
-
- shipping_type: 0,
- radio: 0,
- store: {},
- store_id:'',
- pricelist: [],
- choseadress: '',
- order_id:''
- }
- },
- onLoad(options) {
- console.log(options);
- this.order_id = options.order_id;
- this.store_id = options.store;
- // let prices = Number((options.prices/100).toFixed(2));
- // this.prices = prices;
- this.getorder(); // 获取订单详情
- uni.$on("getadress",(adress)=>{
- console.log(adress);
- this.choseadress = adress;
- this.address_id = this.choseadress.address_id;
- this.getralodprice();
- })
- },
- methods: {
- getread() {
- console.log("kkk")
- this.read = 4;
- },
- // gethotelname(e) {
- // this.hotelname = e.detail;
- // },
- gethonename(e) {
- this.honename = e.detail;
- },
- getphone(e) {
- this.phone = e.detail;
- },
- getusername(e) {
- this.username = e.detail;
- },
- // reserve:'', // yudingjiudian
- // Checkedin:'',
- // numberphone:'',
- //remark:'',
- // getreserve(e) {
- // this.reserve = e.detail;
- // },
- getCheckedin(e) {
- this.Checkedin = e.detail;
- },
- getnumberphone(e) {
- this.numberphone = e.detail;
- },
- getremark(e) {
- this.remark = e.detail;
- },
- // 获取订单详情
- getorder() {
- this.request({
- url: '/v2/order/og',
- method: 'POST',
- data: {
- order_id: this.order_id,
- store_id: this.store_id
- },
- success: (res) => {
- let { data } = res.data;
- this.store = data.store;
- let totalprice = 0;
- data.og_list.forEach(item => {
- let arr = item.goods_name.split(' ');
- item.desarray = arr[0];
- item.descire = item.goods_name.replace(arr[0], '');
- totalprice+=Number(item.goods_pay_price)*Number(item.goods_num);
- })
- console.log(totalprice);
- this.hotelname = this.store.store_name
- this.reserve = this.store.store_name
- this.pricelist = data.og_list;
- this.prices = totalprice;
- }
- })
- },
- // 付款
- goPay() {
- let reg_phone = /^1[3456789]\d{9}$/;
- if(this.radio == 1) {
- this.gopaymoment();
- }else if(this.radio == 0){
- if(this.hotelname == '') {
- this.$msg("请输入酒店名")
- return;
- }else if(this.honename == '') {
- this.$msg("请输入房间号")
- return;
-
- }else if( !reg_phone.test(this.phone)) {
- this.$msg("请输入正确手机号")
- return;
- }else if(this.username == '') {
- this.$msg("请输入收货人")
- return;
- }
- this.request({
- url:'/v2/address/add',
- method:'post',
- data: {
- is_free: 1,
- area_info: this.store.area_info,
- address_detail:this.hotelname + this.honename,
- address_mob_phone: this.phone,
- address_realname: this.username,
- area_id: this.store.region_id
- },
- success: (res) => {
- console.log(res.data.data.address_id);
- this.address_id = res.data.data.address_id;
- this.shipping_type = 1;
- this.gopaymoment();
- }
- })
-
- }else if(this.radio == 2) {
- if(this.reserve == '') {
- this.$msg("请输入预定酒店")
- return;
- }else if(this.Checkedin == '') {
- this.$msg("请输入入住人")
- return;
- }else if( !reg_phone.test(this.numberphone)) {
- this.$msg("请输入正确手机号")
- return;
- }else if(this.read !=4) {
- this.$msg("请阅读预定须知");
- return;
- }
- this.request({
- url:'/v2/address/add',
- method:'post',
- data: {
- is_free: 1,
- area_info: this.store.area_info,
- address_detail:this.reserve,
- address_mob_phone: this.numberphone,
- address_realname: this.Checkedin,
- area_id: this.store.region_id
- },
- success: (res) => {
- console.log(res.data.data.address_id);
- this.address_id = res.data.data.address_id;
- this.shipping_type = 1;
- this.gopaymoment();
- }
- })
-
- }
-
- },
- // 下单
- gopaymoment(){
- this.request({
- url:'/v2/order/create',
- method: 'post',
- data: {
- gorderid: this.order_id,
- address_id: this.address_id,
- store_id: this.store.store_id,
- shipping_type: this.shipping_type,
- remark: this.remark
- },
- success: (res) => {
- console.log(res);
- let order_id = res.data.data.order_id; // 订单id
- let prices = this.prices;
- uni.navigateTo({
- url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
- })
- }
- })
- },
- // 核算运费
- getralodprice() {
- this.request({
- url: '/v2/entry/orderFreight',
- method: 'POST',
- data: {
- order_id: this.order_id,
- address_id: this.address_id
- },
- success:(res) => {
- let price = this.prices;
- this.ralodprice = res.data.data.shipping_fee;
- this.prices = price + this.ralodprice;
- }
- })
- },
- onChange(index) {
- this.radio = index;
-
- if(index == 1) {
- this.shipping_type = 0; // 订单付款快递类型
- }else {
- this.shipping_type = 1;
- }
- },
- goAdress() {
- console.log("dddd")
- uni.navigateTo({
- url: '../myOrder/adress',
- });
- }
- }
- }
-
- </script>
- <style lang="scss">
- .LinkAdress /deep/ .van-cell {
- border-top: 15upx solid #F5F5F5;
- border-bottom: 15upx solid #F5F5F5;
- }
- .wrapper{
- border-top: 15rpx solid #F5F5F5;
- border-bottom: 15rpx solid #F5F5F5;
- padding: 0 32upx;
- }
- .u-box {
- padding: 15upx 0;
- }
- .topTip {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 20upx 36upx;
- border-bottom: 1px solid #F5F5F5;
- }
- .changewidth {
- color: #303133;
- font-size: 32upx;
- font-weight: 100!important;
- }
- .priceClass {
- color:#303133!important;
- font-weight: 100!important;
- font-size: 36upx;
- }
- .van-card {
- background-color: #fff!important;
- }
- .shoplist {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .adressbutton {
- position: fixed;
- bottom: 0;
- width: 100%;
- .buttonStatus {
- display: flex;
- text-align: left;
- .deleteOrder {
- flex: 3;
- color: #303133;
- font-size: 32upx;
- background-color: #fff;
- padding: 10px 0;
- }
- .payOrder {
- flex: 1;
- font-size: 32upx;
- color: #fff;
- background-color: #D9332E;
- padding: 10px 0;
- text-align: center;
- }
- }
- }
- </style>
|