add.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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">人数:{{shopInfo.num}}人</view>
  8. </view>
  9. <view class="one_2">
  10. <view class="left">备注</view>
  11. <view class="right">
  12. <input v-model="shopInfo.remark" placeholder="填写备注" />
  13. <uni-icons color="#C0C0C0" type="forward" size="14"></uni-icons>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="two">
  18. <view class="two_1">消费明细</view>
  19. <view class="two_2">
  20. <scroll-view scroll-y="true" class="scroll-view">
  21. <view class="list-scroll-view">
  22. <view class="list" v-for="(item,index) in list" :key="index">
  23. <view class="img">
  24. <image class="image" :src="item.file" mode=""></image>
  25. </view>
  26. <view class="info">
  27. <view class="name textOver">
  28. <text>{{item.name}}</text>
  29. </view>
  30. <view class="spec" v-if="item.spec">
  31. <text>{{item.spec}}</text>
  32. </view>
  33. </view>
  34. <view class="money">
  35. <text>¥{{item.price}}</text>
  36. <text>×{{item.num}}</text>
  37. </view>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. <view class="two_3">
  43. 共{{shopInfo.numTotal}}件商品,合计:<text>¥</text><text>{{shopInfo.total}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="foot">
  48. <view class="foot_1">
  49. 合计<text>¥</text><text>{{shopInfo.total||0}}</text>
  50. </view>
  51. <view class="foot_2">
  52. <button class="button" @tap.stop="toBuy">下单</button>
  53. </view>
  54. </view>
  55. <uni-popup ref="popup" type="dialog">
  56. <uni-popup-dialog mode="input" message="成功消息" :duration="2000" :before-close="true" @close="close"
  57. @confirm="confirm"></uni-popup-dialog>
  58. </uni-popup>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. id: "",
  66. shopInfo: {},
  67. list: [],
  68. }
  69. },
  70. onLoad: async function(e) {
  71. const that = this;
  72. that.$set(that, `id`, e.id);
  73. that.search();
  74. },
  75. onShow() {
  76. const that = this;
  77. },
  78. methods: {
  79. async search(e) {
  80. const that = this;
  81. if (that.id) {
  82. let res = await that.$api(`order/${that.id}`, 'GET', {});
  83. if (res.errcode == '0') {
  84. that.$set(that, `list`, res.data.list)
  85. that.$set(that, `shopInfo`, res.data)
  86. }
  87. }
  88. },
  89. // 下单
  90. toBuy() {
  91. const that = this;
  92. that.$refs.popup.open()
  93. },
  94. close() {
  95. const that = this;
  96. that.$refs.popup.close()
  97. },
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .content {
  103. background-color: #f1f1f1;
  104. font-family: 12px/1 Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
  105. .info {
  106. display: flex;
  107. flex-direction: column;
  108. position: relative;
  109. flex-grow: 1;
  110. padding: 2vw;
  111. .one {
  112. padding: 2vw;
  113. background-color: #ffffff;
  114. border-radius: 4vw;
  115. .one_1 {
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. background-color: #ffffff;
  120. border-radius: 3vw;
  121. padding: 4vw 2vw;
  122. border-bottom: 1px solid #f1f1f1;
  123. .left {
  124. font-size: 16px;
  125. font-weight: 600;
  126. }
  127. .right {
  128. font-size: 14px;
  129. }
  130. }
  131. .one_2 {
  132. display: flex;
  133. justify-content: space-between;
  134. align-items: center;
  135. padding: 3vw 2vw;
  136. font-size: 14px;
  137. .right {
  138. display: flex;
  139. align-items: flex-end;
  140. color: #858585;
  141. /deep/input {
  142. text-align: right;
  143. }
  144. }
  145. }
  146. }
  147. .two {
  148. margin: 2vw 0;
  149. padding: 2vw;
  150. background-color: #ffffff;
  151. border-radius: 4vw;
  152. .two_1 {
  153. padding: 2vw 0;
  154. font-size: 16px;
  155. font-weight: 600;
  156. }
  157. .two_2 {
  158. position: relative;
  159. display: flex;
  160. flex-direction: column;
  161. height: 32vh;
  162. .list {
  163. display: flex;
  164. width: 88vw;
  165. margin: 0 0 2vw 0;
  166. padding: 2vw;
  167. box-shadow: 0 0 5px #f1f1f1;
  168. border-radius: 5px;
  169. .img {
  170. width: 30vw;
  171. .image {
  172. width: 30vw;
  173. height: 20vw;
  174. border-radius: 5px;
  175. }
  176. }
  177. .info {
  178. width: 40vw;
  179. padding: 0 0 0 2vw;
  180. .name {
  181. font-size: 16px;
  182. }
  183. .spec {
  184. font-size: 12px;
  185. color: #858585;
  186. }
  187. }
  188. .money {
  189. display: flex;
  190. flex-direction: column;
  191. align-items: flex-end;
  192. width: 20vw;
  193. text:first-child {
  194. font-size: 14px;
  195. color: #FF8C00;
  196. }
  197. }
  198. }
  199. }
  200. .two_3 {
  201. padding: 3vw;
  202. text-align: right;
  203. font-size: 14px;
  204. color: #858585;
  205. border-top: 1px solid #f1f1f1;
  206. text:first-child {
  207. color: #FF7800;
  208. }
  209. text:last-child {
  210. color: #FF7800;
  211. font-size: 18px;
  212. }
  213. }
  214. }
  215. }
  216. .foot {
  217. display: flex;
  218. justify-content: space-between;
  219. align-items: center;
  220. padding: 2vw 3vw;
  221. background-color: #ffffff;
  222. border-top: 1px solid #f1f1f1;
  223. .foot_1 {
  224. font-size: 14px;
  225. color: #858585;
  226. text:first-child {
  227. color: #FF7800;
  228. }
  229. text:last-child {
  230. color: #FF7800;
  231. font-size: 18px;
  232. }
  233. }
  234. .foot_2 {
  235. .button {
  236. background-color: #FF8C00;
  237. color: #ffffff;
  238. border-radius: 5vw;
  239. font-size: 16px;
  240. }
  241. }
  242. }
  243. }
  244. .scroll-view {
  245. position: absolute;
  246. top: 0;
  247. left: 0;
  248. right: 0;
  249. bottom: 0;
  250. .list-scroll-view {
  251. display: flex;
  252. flex-direction: column;
  253. }
  254. }
  255. </style>