|
@@ -30,10 +30,12 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <radio style="margin: 0 10px; transform: scale(0.85)" value="r1" :checked="true" color="#ff0000" class="radio">店内用餐
|
|
|
+ <uni-data-checkbox v-model="val" :localdata="list" @change="radioChange"
|
|
|
+ selectedColor="#F54319"></uni-data-checkbox>
|
|
|
+ <!-- <radio style="margin: 0 10px; transform: scale(0.85)" value="r1" :checked="typePicking" color="#ff0000" class="radio">店内用餐
|
|
|
</radio >
|
|
|
- <radio style="transform: scale(0.85)" value="r1" :checked="true" color="#ff0000" class="radio">打包带走
|
|
|
- </radio>
|
|
|
+ <radio style="transform: scale(0.85)" value="r1" :checked="typePickings" color="#ff0000" class="radio">打包带走
|
|
|
+ </radio> -->
|
|
|
</view>
|
|
|
<!-- <view class="iconfont iconjiantou-01 fs-sm"></view> -->
|
|
|
</view>
|
|
@@ -41,23 +43,24 @@
|
|
|
<view class="goods-order-list w-full padding-lr-sm">
|
|
|
<view class="shop dflex-b ">
|
|
|
<view class="shop-check">
|
|
|
- <text class="shop-name">xxx学校xx年级xx班级</text>
|
|
|
+ <text class="shop-name">{{cList.name}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="goods-cart w-full">
|
|
|
- <view class="goods-cont padding-tb" v-for="index in 1" :key="index">
|
|
|
- <my-goods :data="data">
|
|
|
- <view class="good-num">×1</view>
|
|
|
+ <view class="goods-cont padding-tb" v-for="(item, index) in data.carlist" :key="index">
|
|
|
+ <my-goods :item="item">
|
|
|
+ <view class="good-num">×{{item.quantity}}</view>
|
|
|
</my-goods>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 金额明细 -->
|
|
|
+ <view class="gap"></view>
|
|
|
<view class="bg-main">
|
|
|
<view class="dflex-b padding-lr padding-tb-sm">
|
|
|
<view class="flex1">总金额</view>
|
|
|
- <view class=""><text style="font-size: 24rpx;">¥</text>46.32</view>
|
|
|
+ <view class=""><text style="font-size: 24rpx;">¥</text>{{data.total}}</view>
|
|
|
</view>
|
|
|
<!-- <view class="dflex-b padding-lr padding-tb-sm">
|
|
|
<view class="flex1">运费 (总重:4.960 kg )</view>
|
|
@@ -82,19 +85,40 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- data: {
|
|
|
- src: '../../static/x0.jpg',
|
|
|
- title: '标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题',
|
|
|
- spec: '180cm',
|
|
|
- price: '53.30'
|
|
|
- },
|
|
|
+ data: [],
|
|
|
show: false,
|
|
|
value: '',
|
|
|
+ cList: {},
|
|
|
+ val: null,
|
|
|
+ vals: null,
|
|
|
+ list: [{
|
|
|
+ text: "店内用餐",
|
|
|
+ value: 'A'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: "打包带走",
|
|
|
+ value: 'B'
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
+ onLoad(option) {
|
|
|
+ const e = uni.getStorageSync('carl')
|
|
|
+ this.cList = e
|
|
|
+ console.log('233333333333333', e)
|
|
|
+ // 解码 URL 编码的字符串
|
|
|
+ var dataString = decodeURIComponent(option.data);
|
|
|
+ // 尝试将字符串转换为 JSON 对象
|
|
|
+ var data = JSON.parse(dataString);
|
|
|
+ this.data = data
|
|
|
+ // 打印解码后的数据
|
|
|
+ console.log('eeeeeeeeeeeee============data', data);
|
|
|
+ },
|
|
|
methods: {
|
|
|
- sendTypeChange(v) {
|
|
|
- console.log(v)
|
|
|
+ sendTypeChange(v) {},
|
|
|
+ radioChange(v) {
|
|
|
+ console.log('2=================', v)
|
|
|
+ console.log('2=================22222', this.val)
|
|
|
},
|
|
|
onConfirm(v) {
|
|
|
console.log('vvvvvvvvvvvvvvv', v)
|
|
@@ -105,8 +129,73 @@
|
|
|
this.show = false
|
|
|
},
|
|
|
toBuy() {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/order/orderPaid/orderPaid`
|
|
|
+ console.log('this.val', this.val)
|
|
|
+ if (this.value == '') {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择取餐时间',
|
|
|
+ icon: 'error',
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.val == '' || this.val == null) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择取餐方式',
|
|
|
+ icon: 'error',
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const userName = uni.getStorageSync('userName');
|
|
|
+ const itemListArray = this.data.carlist.map(item => ({
|
|
|
+ skuId: item.skuId,
|
|
|
+ isGift: false, // 假设所有商品都不是礼物
|
|
|
+ basePrice: item.basePrice,
|
|
|
+ price: item.price,
|
|
|
+ quantity: item.quantity,
|
|
|
+ sellerType: 'C', // 假设所有商品卖家类型都是 'C'
|
|
|
+ isFenxiao: false // 假设所有商品都不是分销商品
|
|
|
+ }))
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ orderType: 'waimai,cod',
|
|
|
+ isCod: true,
|
|
|
+ shippingType: 'SELF_PICKUP',
|
|
|
+ storeId: this.cList.id,
|
|
|
+ storeName: this.cList.name,
|
|
|
+ arriveCutTime: this.value,
|
|
|
+ sellerNick: this.cList.name,
|
|
|
+ buyerNick: userName,
|
|
|
+ itemList: itemListArray,
|
|
|
+ pickupInfo: {
|
|
|
+ pickupType: this.val,
|
|
|
+ isVerify: false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('params', params);
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: `/pages/order/orderPaid/orderPaid`
|
|
|
+ // })
|
|
|
+ this.$request('post', `/order/retailOrder`, params, true).then(response => {
|
|
|
+ // 请求成功
|
|
|
+ console.log('response', response)
|
|
|
+ if (response.code == 200) {
|
|
|
+ const ids = this.data.carlist.map(car => car.id);
|
|
|
+ this.$request('delete', `/front/shoppingCart/${ids}`)
|
|
|
+ console.log('response.data', response.data)
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/order/orderPaid/orderPaid?id=${response.data}`
|
|
|
+ })
|
|
|
+ } else if (response.code == 500) {
|
|
|
+ uni.showToast({
|
|
|
+ title: response.msg,
|
|
|
+ icon: 'error',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ // 请求失败
|
|
|
+ console.error('请求失败:', error);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -171,9 +260,10 @@
|
|
|
|
|
|
.good-num {
|
|
|
font-size: 12px;
|
|
|
- padding-top: 40rpx;
|
|
|
+ padding-top: 65rpx;
|
|
|
}
|
|
|
- .send-label{
|
|
|
+
|
|
|
+ .send-label {
|
|
|
font-size: 14px;
|
|
|
font-weight: 700;
|
|
|
}
|