123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <view class="content">
- <view class="info">
- <view class="one">
- <view class="one_1">
- <view class="left">桌号:{{shopInfo.table_name}}</view>
- <view class="right">人数:{{shopInfo.num}}人</view>
- </view>
- <view class="one_2">
- <view class="left">备注</view>
- <view class="right">
- <input v-model="shopInfo.remark" placeholder="填写备注" />
- <uni-icons color="#C0C0C0" type="forward" size="14"></uni-icons>
- </view>
- </view>
- </view>
- <view class="two">
- <view class="two_1">消费明细</view>
- <view class="two_2">
- <scroll-view scroll-y="true" class="scroll-view">
- <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&&item.file.length>0?item.file[0].url:''"
- mode="">
- </image>
- </view>
- <view class="info">
- <view class="name textOver">
- <text>{{item.name}}</text>
- </view>
- <view class="spec" v-if="item.spec">
- <text>{{item.spec}}</text>
- </view>
- </view>
- <view class="money">
- <text>¥{{item.price}}</text>
- <text>×{{item.num}}</text>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="two_3">
- 共{{list.length}}件商品,合计:<text>¥</text><text>{{shopInfo.total}}</text>
- </view>
- </view>
- </view>
- <view class="foot">
- <view class="foot_1">
- 合计<text>¥</text><text>{{shopInfo.total||0}}</text>
- </view>
- <view class="foot_2">
- <button class="button" @tap.stop="toBuy">下单</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import moment from 'moment';
- export default {
- data() {
- return {
- id: "",
- order: '',
- shopInfo: {},
- list: [],
- }
- },
- onLoad: async function(e) {
- const that = this;
- that.$set(that, `id`, e.id);
- that.$set(that, `order`, e.order);
- that.search();
- },
- methods: {
- async search(e) {
- const that = this;
- if (that.id && that.order) {
- let res;
- res = await that.$api(`cart/${that.id}`, 'GET', {});
- if (res.errcode == '0') {
- that.$set(that, `list`, res.data.list)
- that.$set(that.shopInfo, `total`, res.data.total)
- let table = await that.$api(`table/${res.data.table}`, `GET`)
- that.$set(that.shopInfo, `table_name`, table.data.name)
- }
- res = await that.$api(`order/${that.order}`, 'GET', {});
- if (res.errcode == '0') {
- that.$set(that.shopInfo, `num`, res.data.num)
- that.$set(that.shopInfo, `remark`, res.data.remark)
- }
- }
- },
- // 下单
- async toBuy() {
- const that = this;
- 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,
- money:that.shopInfo.total,
- remark:that.shopInfo.remark
- }
- if (that.shopInfo.remark) obj.remark = that.shopInfo.remark
- let res = await that.$api(`order/${that.order}`, 'POST', obj);
- if (res.errcode == '0') {
- uni.showToast({
- title: '下单成功',
- icon: 'none'
- })
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .content {
- background-color: #f1f1f1;
- font-family: 12px/1 Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
- .info {
- display: flex;
- flex-direction: column;
- position: relative;
- flex-grow: 1;
- padding: 2vw;
- .one {
- padding: 2vw;
- background-color: #ffffff;
- border-radius: 4vw;
- .one_1 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #ffffff;
- border-radius: 3vw;
- padding: 4vw 2vw;
- border-bottom: 1px solid #f1f1f1;
- .left {
- font-size: 16px;
- font-weight: 600;
- }
- .right {
- font-size: 14px;
- }
- }
- .one_2 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 3vw 2vw;
- font-size: 14px;
- .right {
- display: flex;
- align-items: flex-end;
- color: #858585;
- /deep/input {
- text-align: right;
- }
- }
- }
- }
- .two {
- margin: 2vw 0;
- padding: 2vw;
- background-color: #ffffff;
- border-radius: 4vw;
- .two_1 {
- padding: 2vw 0;
- font-size: 16px;
- font-weight: 600;
- }
- .two_2 {
- position: relative;
- display: flex;
- flex-direction: column;
- height: 32vh;
- .list {
- display: flex;
- width: 88vw;
- margin: 0 0 2vw 0;
- padding: 2vw;
- box-shadow: 0 0 5px #f1f1f1;
- border-radius: 5px;
- .img {
- width: 30vw;
- .image {
- width: 30vw;
- height: 20vw;
- border-radius: 5px;
- }
- }
- .info {
- width: 40vw;
- padding: 0 0 0 2vw;
- .name {
- font-size: 16px;
- }
- .spec {
- font-size: 12px;
- color: #858585;
- }
- }
- .money {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- width: 20vw;
- text:first-child {
- font-size: 14px;
- color: #FF8C00;
- }
- }
- }
- }
- .two_3 {
- padding: 3vw;
- text-align: right;
- font-size: 14px;
- color: #858585;
- border-top: 1px solid #f1f1f1;
- text:first-child {
- color: #FF7800;
- }
- text:last-child {
- color: #FF7800;
- font-size: 18px;
- }
- }
- }
- }
- .foot {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 2vw 3vw;
- background-color: #ffffff;
- border-top: 1px solid #f1f1f1;
- .foot_1 {
- font-size: 14px;
- color: #858585;
- text:first-child {
- color: #FF7800;
- }
- text:last-child {
- color: #FF7800;
- font-size: 18px;
- }
- }
- .foot_2 {
- .button {
- background-color: #FF8C00;
- color: #ffffff;
- border-radius: 5vw;
- font-size: 16px;
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|