index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <view class="content">
  3. <view class="info">
  4. <view class="one">
  5. <view class="one_1">
  6. <view class="left">桌号:{{shopInfo.table}}</view>
  7. <view class="right">
  8. <view class="right_1">
  9. <text @click="toChang" :class="[is_show==true?'type':'']">店内就餐</text>
  10. <text @click="toChang" :class="[is_show==false?'type':'']">打包带走</text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="one_2">
  15. <view class="left">人数</view>
  16. <view class="right">
  17. <picker @change="bindChange" :value="shopInfo.person" :range="personList">
  18. <view>
  19. {{shopInfo.person||'请选择用餐人数'}}
  20. <text v-if="shopInfo.person">人</text>
  21. </view>
  22. </picker>
  23. <uni-icons color="#C0C0C0" type="forward" size="14"></uni-icons>
  24. </view>
  25. </view>
  26. <view class="one_3">
  27. <view class="left">备注</view>
  28. <view class="right">
  29. <input v-model="shopInfo.remark" placeholder="填写备注" />
  30. <uni-icons color="#C0C0C0" type="forward" size="14"></uni-icons>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="two">
  35. <view class="two_1">消费明细</view>
  36. <view class="two_2">
  37. <scroll-view scroll-y="true" class="scroll-view">
  38. <view class="list-scroll-view">
  39. <view class="list" v-for="(item,index) in list" :key="index">
  40. <view class="img">
  41. <image class="image" :src="item.file" mode=""></image>
  42. </view>
  43. <view class="info">
  44. <view class="name textOver">
  45. <text>{{item.name}}</text>
  46. </view>
  47. <view class="spec" v-if="item.spec">
  48. <text>{{item.spec}}</text>
  49. </view>
  50. </view>
  51. <view class="money">
  52. <text>¥{{item.price}}</text>
  53. <text>×{{item.num}}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. <view class="two_3">
  60. <view class="two_3_1" v-if="shopInfo.person">
  61. <view class="left">
  62. 餐位费
  63. <text>×{{shopInfo.person}}</text>
  64. </view>
  65. <view class="right">¥{{shopInfo.perMoney}}</view>
  66. </view>
  67. <view class="two_3_2">
  68. 共{{shopInfo.numTotal}}件商品,合计:<text>¥</text><text>{{shopInfo.goods_total}}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="foot">
  74. <view class="foot_1">
  75. 需支付<text>¥</text><text>{{shopInfo.detail_total||0}}</text>
  76. </view>
  77. <view class="foot_2">
  78. <button class="button" @tap.stop="toBuy">下单</button>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. export default {
  85. data() {
  86. return {
  87. shopInfo: {
  88. table: '1',
  89. goods_total: 512,
  90. numTotal: 9,
  91. money: 3,
  92. type: '1',
  93. },
  94. is_show: true,
  95. personList: [
  96. '1人', '2人', '3人', '4人', '5人', '6人', '7人', '8人', '9人', '10人', '11人', '12人', '13人', '14人',
  97. '15人', '16人', '17人',
  98. '18人', '19人', '20人', '21人', '22人'
  99. ],
  100. list: [{
  101. _id: '1',
  102. code: '0',
  103. name: '三文鱼',
  104. file: require("../../static/foods_1.webp"),
  105. price: 126,
  106. spec: '300g',
  107. stock: 100,
  108. num: 1,
  109. },
  110. {
  111. _id: '2',
  112. code: '0',
  113. name: '蜜汁扇贝',
  114. file: require("../../static/foods_2.webp"),
  115. price: 68,
  116. spec: '400g',
  117. stock: 140,
  118. num: 1,
  119. },
  120. {
  121. _id: '3',
  122. code: '0',
  123. name: '意大利牛排',
  124. file: require("../../static/foods_3.webp"),
  125. price: 128,
  126. spec: '600g',
  127. stock: 200,
  128. num: 1,
  129. },
  130. {
  131. _id: '4',
  132. code: '0',
  133. name: '糖醋里脊',
  134. file: require("../../static/foods_4.webp"),
  135. price: 58,
  136. spec: '500g',
  137. stock: 140,
  138. num: 1,
  139. },
  140. {
  141. _id: '5',
  142. code: '2',
  143. name: '黑糖珍珠奶茶',
  144. file: require("../../static/foods_1.webp"),
  145. price: 18,
  146. spec: '500g',
  147. stock: 120,
  148. num: 1,
  149. },
  150. {
  151. _id: '6',
  152. code: '2',
  153. name: '雪碧',
  154. file: require("../../static/foods_2.webp"),
  155. price: 5,
  156. spec: '500g',
  157. stock: 34,
  158. num: 1,
  159. },
  160. {
  161. _id: '7',
  162. code: '2',
  163. name: '可口可乐',
  164. file: require("../../static/foods_3.webp"),
  165. price: 5,
  166. spec: '500g',
  167. stock: 50,
  168. num: 1,
  169. },
  170. {
  171. _id: '8',
  172. code: '1',
  173. name: '芝士小蛋糕',
  174. file: require("../../static/foods_2.webp"),
  175. price: 12,
  176. spec: '260g',
  177. stock: 10,
  178. num: 1,
  179. },
  180. {
  181. _id: '9',
  182. code: '1',
  183. name: '草莓千层',
  184. file: require("../../static/foods_3.webp"),
  185. price: 15,
  186. spec: '350g',
  187. stock: 40,
  188. num: 1,
  189. }
  190. ],
  191. }
  192. },
  193. onLoad() {
  194. const that = this;
  195. },
  196. onShow() {
  197. const that = this;
  198. },
  199. methods: {
  200. async search(e) {
  201. const that = this;
  202. },
  203. // 选择堂食还是打包
  204. toChang() {
  205. const that = this;
  206. that.is_show = !that.is_show
  207. },
  208. // 选择用餐人数
  209. bindChange(e) {
  210. const that = this;
  211. that.$set(that.shopInfo, `person`, parseInt(e.detail.value) + 1)
  212. let money = that.$multiply(that.shopInfo.money, that.shopInfo.person);
  213. that.$set(that.shopInfo, `perMoney`, money)
  214. let total = that.$plus(money, that.shopInfo.goods_total)
  215. that.$set(that.shopInfo, `detail_total`, total)
  216. },
  217. // 下单
  218. toBuy() {
  219. const that = this;
  220. console.log('下单');
  221. let key = '1'
  222. uni.navigateTo({
  223. url: `/pagesHome/order/info?key=${key}`
  224. })
  225. },
  226. }
  227. }
  228. </script>
  229. <style lang="scss">
  230. .content {
  231. background-color: #f1f1f1;
  232. font-family: 12px/1 Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
  233. .info {
  234. display: flex;
  235. flex-direction: column;
  236. position: relative;
  237. flex-grow: 1;
  238. padding: 2vw;
  239. .one {
  240. padding: 2vw;
  241. background-color: #ffffff;
  242. border-radius: 4vw;
  243. .one_1 {
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. padding: 2vw 0;
  248. border-bottom: 1px solid #f1f1f1;
  249. .left {
  250. font-size: 16px;
  251. font-weight: 600;
  252. }
  253. .right {
  254. font-size: 14px;
  255. .right_1 {
  256. background-color: #f1f1f1;
  257. padding: 3vw 1vw;
  258. border-radius: 5vw;
  259. text {
  260. background-color: #f1f1f1;
  261. color: #858585;
  262. padding: 2vw;
  263. }
  264. .type {
  265. padding: 2vw 3vw;
  266. border-radius: 5vw;
  267. color: #ffffff;
  268. background-color: #FF7800;
  269. }
  270. }
  271. }
  272. }
  273. .one_2 {
  274. display: flex;
  275. justify-content: space-between;
  276. align-items: center;
  277. padding: 3vw 0;
  278. border-bottom: 1px solid #f1f1f1;
  279. font-size: 14px;
  280. .right {
  281. display: flex;
  282. align-items: center;
  283. color: #858585;
  284. }
  285. }
  286. .one_3 {
  287. display: flex;
  288. justify-content: space-between;
  289. align-items: center;
  290. padding: 3vw 0;
  291. font-size: 14px;
  292. .right {
  293. display: flex;
  294. align-items: flex-end;
  295. color: #858585;
  296. /deep/input {
  297. text-align: right;
  298. }
  299. }
  300. }
  301. }
  302. .two {
  303. margin: 2vw 0;
  304. padding: 2vw;
  305. background-color: #ffffff;
  306. border-radius: 4vw;
  307. .two_1 {
  308. padding: 2vw 0;
  309. font-size: 16px;
  310. font-weight: 600;
  311. }
  312. .two_2 {
  313. position: relative;
  314. display: flex;
  315. flex-direction: column;
  316. height: 32vh;
  317. .list {
  318. display: flex;
  319. width: 88vw;
  320. margin: 0 0 2vw 0;
  321. padding: 2vw;
  322. box-shadow: 0 0 5px #f1f1f1;
  323. border-radius: 5px;
  324. .img {
  325. width: 30vw;
  326. .image {
  327. width: 30vw;
  328. height: 20vw;
  329. border-radius: 5px;
  330. }
  331. }
  332. .info {
  333. width: 40vw;
  334. padding: 0 0 0 2vw;
  335. .name {
  336. font-size: 16px;
  337. }
  338. .spec {
  339. font-size: 12px;
  340. color: #858585;
  341. }
  342. }
  343. .money {
  344. display: flex;
  345. flex-direction: column;
  346. align-items: flex-end;
  347. width: 20vw;
  348. text:first-child {
  349. font-size: 14px;
  350. color: #FF8C00;
  351. }
  352. }
  353. }
  354. }
  355. .two_3 {
  356. .two_3_1 {
  357. display: flex;
  358. justify-content: space-between;
  359. align-items: center;
  360. font-size: 14px;
  361. padding: 2vw 3vw;
  362. .left {
  363. text {
  364. color: #858585;
  365. font-size: 12px;
  366. margin: 0 2vw;
  367. }
  368. }
  369. .right {
  370. color: #FF7800;
  371. }
  372. }
  373. .two_3_2 {
  374. padding: 3vw;
  375. text-align: right;
  376. font-size: 14px;
  377. color: #858585;
  378. border-top: 1px solid #f1f1f1;
  379. text:first-child {
  380. color: #FF7800;
  381. }
  382. text:last-child {
  383. color: #FF7800;
  384. font-size: 18px;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. .foot {
  391. display: flex;
  392. justify-content: space-between;
  393. align-items: center;
  394. padding: 2vw 3vw;
  395. background-color: #ffffff;
  396. border-top: 1px solid #f1f1f1;
  397. .foot_1 {
  398. font-size: 14px;
  399. color: #858585;
  400. text:first-child {
  401. color: #FF7800;
  402. }
  403. text:last-child {
  404. color: #FF7800;
  405. font-size: 18px;
  406. }
  407. }
  408. .foot_2 {
  409. .button {
  410. background-color: #FF8C00;
  411. color: #ffffff;
  412. border-radius: 5vw;
  413. font-size: 16px;
  414. }
  415. }
  416. }
  417. }
  418. .scroll-view {
  419. position: absolute;
  420. top: 0;
  421. left: 0;
  422. right: 0;
  423. bottom: 0;
  424. .list-scroll-view {
  425. display: flex;
  426. flex-direction: column;
  427. }
  428. }
  429. </style>