|
@@ -21,7 +21,9 @@
|
|
|
<view class="list-scroll-view">
|
|
|
<view class="list" v-for="(item,index) in list" :key="index">
|
|
|
<view class="img">
|
|
|
- <image class="image" :src="item.file" mode=""></image>
|
|
|
+ <image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''"
|
|
|
+ mode="">
|
|
|
+ </image>
|
|
|
</view>
|
|
|
<view class="info">
|
|
|
<view class="name textOver">
|
|
@@ -40,7 +42,7 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view class="two_3">
|
|
|
- 共{{shopInfo.numTotal}}件商品,合计:<text>¥</text><text>{{shopInfo.total}}</text>
|
|
|
+ 共{{list.length}}件商品,合计:<text>¥</text><text>{{shopInfo.total}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -52,18 +54,16 @@
|
|
|
<button class="button" @tap.stop="toBuy">下单</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <uni-popup ref="popup" type="dialog">
|
|
|
- <uni-popup-dialog mode="input" message="成功消息" :duration="2000" :before-close="true" @close="close"
|
|
|
- @confirm="confirm"></uni-popup-dialog>
|
|
|
- </uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import moment from 'moment';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
id: "",
|
|
|
+ order: '',
|
|
|
shopInfo: {},
|
|
|
list: [],
|
|
|
}
|
|
@@ -71,6 +71,7 @@
|
|
|
onLoad: async function(e) {
|
|
|
const that = this;
|
|
|
that.$set(that, `id`, e.id);
|
|
|
+ that.$set(that, `order`, e.order);
|
|
|
that.search();
|
|
|
},
|
|
|
onShow() {
|
|
@@ -80,22 +81,34 @@
|
|
|
async search(e) {
|
|
|
const that = this;
|
|
|
if (that.id) {
|
|
|
- let res = await that.$api(`order/${that.id}`, 'GET', {});
|
|
|
+ let res = await that.$api(`cart/${that.id}`, 'GET', {});
|
|
|
if (res.errcode == '0') {
|
|
|
that.$set(that, `list`, res.data.list)
|
|
|
that.$set(that, `shopInfo`, res.data)
|
|
|
+ let table = await that.$api(`table/${res.data.table}`, `GET`)
|
|
|
+ that.$set(that.shopInfo, `table`, table.data.name)
|
|
|
+ that.$set(that.shopInfo, `table_id`, res.data.table)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 下单
|
|
|
- toBuy() {
|
|
|
+ async toBuy() {
|
|
|
const that = this;
|
|
|
- that.$refs.popup.open()
|
|
|
- },
|
|
|
- close() {
|
|
|
- const that = this;
|
|
|
- that.$refs.popup.close()
|
|
|
- },
|
|
|
+ let type = '0';
|
|
|
+ if (that.is_show == true) type = '0'
|
|
|
+ else type = '1'
|
|
|
+ let obj = {
|
|
|
+ time: moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ list: that.list
|
|
|
+ }
|
|
|
+ let res = await that.$api(`order/${that.order}`, 'POST', obj);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ uni.showToast({
|
|
|
+ title: '下单成功',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|