123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- <template>
- <view class="content">
- <view class="info">
- <view class="one">
- <view class="one_1">
- <view class="left">桌号:{{shopInfo.table}}</view>
- <view class="right">
- <view class="right_1">
- <text @click="toChang" :class="[is_show==true?'type':'']">店内就餐</text>
- <text @click="toChang" :class="[is_show==false?'type':'']">打包带走</text>
- </view>
- </view>
- </view>
- <view class="one_2">
- <view class="left">人数</view>
- <view class="right">
- <picker @change="bindChange" :value="shopInfo.person" :range="personList">
- <view>
- {{shopInfo.person||'请选择用餐人数'}}
- <text v-if="shopInfo.person">人</text>
- </view>
- </picker>
- <uni-icons color="#C0C0C0" type="forward" size="14"></uni-icons>
- </view>
- </view>
- <view class="one_3">
- <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" 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">
- <view class="two_3_1" v-if="shopInfo.person">
- <view class="left">
- 餐位费
- <text>×{{shopInfo.person}}</text>
- </view>
- <view class="right">¥{{shopInfo.perMoney}}</view>
- </view>
- <view class="two_3_2">
- 共{{shopInfo.numTotal}}件商品,合计:<text>¥</text><text>{{shopInfo.goods_total}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="foot">
- <view class="foot_1">
- 需支付<text>¥</text><text>{{shopInfo.detail_total||0}}</text>
- </view>
- <view class="foot_2">
- <button class="button" @tap.stop="toBuy">下单</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- shopInfo: {
- table: '1',
- goods_total: 512,
- numTotal: 9,
- money: 3,
- type: '1',
- },
- is_show: true,
- personList: [
- '1人', '2人', '3人', '4人', '5人', '6人', '7人', '8人', '9人', '10人', '11人', '12人', '13人', '14人',
- '15人', '16人', '17人',
- '18人', '19人', '20人', '21人', '22人'
- ],
- list: [{
- _id: '1',
- code: '0',
- name: '三文鱼',
- file: require("../../static/foods_1.webp"),
- price: 126,
- spec: '300g',
- stock: 100,
- num: 1,
- },
- {
- _id: '2',
- code: '0',
- name: '蜜汁扇贝',
- file: require("../../static/foods_2.webp"),
- price: 68,
- spec: '400g',
- stock: 140,
- num: 1,
- },
- {
- _id: '3',
- code: '0',
- name: '意大利牛排',
- file: require("../../static/foods_3.webp"),
- price: 128,
- spec: '600g',
- stock: 200,
- num: 1,
- },
- {
- _id: '4',
- code: '0',
- name: '糖醋里脊',
- file: require("../../static/foods_4.webp"),
- price: 58,
- spec: '500g',
- stock: 140,
- num: 1,
- },
- {
- _id: '5',
- code: '2',
- name: '黑糖珍珠奶茶',
- file: require("../../static/foods_1.webp"),
- price: 18,
- spec: '500g',
- stock: 120,
- num: 1,
- },
- {
- _id: '6',
- code: '2',
- name: '雪碧',
- file: require("../../static/foods_2.webp"),
- price: 5,
- spec: '500g',
- stock: 34,
- num: 1,
- },
- {
- _id: '7',
- code: '2',
- name: '可口可乐',
- file: require("../../static/foods_3.webp"),
- price: 5,
- spec: '500g',
- stock: 50,
- num: 1,
- },
- {
- _id: '8',
- code: '1',
- name: '芝士小蛋糕',
- file: require("../../static/foods_2.webp"),
- price: 12,
- spec: '260g',
- stock: 10,
- num: 1,
- },
- {
- _id: '9',
- code: '1',
- name: '草莓千层',
- file: require("../../static/foods_3.webp"),
- price: 15,
- spec: '350g',
- stock: 40,
- num: 1,
- }
- ],
- }
- },
- onLoad() {
- const that = this;
- },
- onShow() {
- const that = this;
- },
- methods: {
- async search(e) {
- const that = this;
- },
- // 选择堂食还是打包
- toChang() {
- const that = this;
- that.is_show = !that.is_show
- },
- // 选择用餐人数
- bindChange(e) {
- const that = this;
- that.$set(that.shopInfo, `person`, parseInt(e.detail.value) + 1)
- let money = that.$multiply(that.shopInfo.money, that.shopInfo.person);
- that.$set(that.shopInfo, `perMoney`, money)
- let total = that.$plus(money, that.shopInfo.goods_total)
- that.$set(that.shopInfo, `detail_total`, total)
- },
- // 下单
- toBuy() {
- const that = this;
- console.log('下单');
- let key = '1'
- uni.navigateTo({
- url: `/pagesHome/order/info?key=${key}`
- })
- },
- }
- }
- </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;
- padding: 2vw 0;
- border-bottom: 1px solid #f1f1f1;
- .left {
- font-size: 16px;
- font-weight: 600;
- }
- .right {
- font-size: 14px;
- .right_1 {
- background-color: #f1f1f1;
- padding: 3vw 1vw;
- border-radius: 5vw;
- text {
- background-color: #f1f1f1;
- color: #858585;
- padding: 2vw;
- }
- .type {
- padding: 2vw 3vw;
- border-radius: 5vw;
- color: #ffffff;
- background-color: #FF7800;
- }
- }
- }
- }
- .one_2 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 3vw 0;
- border-bottom: 1px solid #f1f1f1;
- font-size: 14px;
- .right {
- display: flex;
- align-items: center;
- color: #858585;
- }
- }
- .one_3 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 3vw 0;
- 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 {
- .two_3_1 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 14px;
- padding: 2vw 3vw;
- .left {
- text {
- color: #858585;
- font-size: 12px;
- margin: 0 2vw;
- }
- }
- .right {
- color: #FF7800;
- }
- }
- .two_3_2 {
- 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>
|