敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

299 lines
9.0 KiB

  1. <template>
  2. <view class="place-order">
  3. <uv-popup ref="popup" @change="change" mode="bottom">
  4. <view class="place-order-content">
  5. <view class="place-order-title">
  6. <image src="@/static/image/多人下单.webp" mode="aspectFit" class="place-order-title-image"></image>
  7. <text class="number">2563</text><text>人下单</text>
  8. <view class="place-order-title-close" @click="close">
  9. <uv-icon name="close" size="40rpx"></uv-icon>
  10. </view>
  11. </view>
  12. <!-- 选择取餐地点 -->
  13. <view class="place-order-address" @click="gotoPickupPoint">
  14. <uv-icon name="map-fill" color="#019245" size="55rpx">
  15. </uv-icon>
  16. <text style="font-size: 42rpx;" v-show="!pickupPoint">
  17. 请选择取餐地点
  18. </text>
  19. <view v-show="pickupPoint" class="place-order-address-content">
  20. <view class="place-order-address-content-name">
  21. {{ pickupPoint.name }}{{ pickupPoint.phone }}
  22. </view>
  23. <view class="place-order-address-content-address"> {{ pickupPoint.address }}</view>
  24. </view>
  25. <view class="place-order-address-arrow">
  26. <uv-icon name="arrow-right" size="40rpx">
  27. </uv-icon>
  28. </view>
  29. </view>
  30. <uv-gap height="20rpx" bgColor="#F7F7F7" />
  31. <!-- 货品信息 -->
  32. <view class="item">
  33. <image src="@/static/image/红烧肉.png" mode="aspectFill" class="item-image"></image>
  34. <view style="font-size: 36rpx;">
  35. <view>豆角炒鸡蛋</view>
  36. <view style="color: red; ">9.9</view>
  37. <view style="margin-top: 30rpx;">
  38. <uv-number-box v-model="value" button-size="36"></uv-number-box>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 选项框 -->
  43. <uv-radio-group v-model="payMethod">
  44. <view class="option-box">
  45. <view class="option-box-item">
  46. <uv-icon name="weixin-circle-fill" size="70rpx" color="#019245" />
  47. <text style="flex: 1;">
  48. 微信支付
  49. </text>
  50. <uv-radio activeColor="#019245" size="40rpx" name="weixin" />
  51. </view>
  52. <view class="option-box-item">
  53. <uv-icon name="red-packet" size="70rpx" color="#019245" />
  54. <text style="flex: 1;">
  55. 账户余额
  56. <text style="color: gray; margin-left: 20rpx;">(余额: 0)
  57. </text>
  58. </text>
  59. <uv-radio activeColor="#019245" size="40rpx" name="account" />
  60. </view>
  61. </view>
  62. </uv-radio-group>
  63. <uv-gap height="20rpx" bgColor="#F7F7F7" />
  64. <!-- 优惠 -->
  65. <view class="discount">
  66. <text style="font-size: 35rpx;">优惠</text>
  67. <view style="display: flex; align-items: center; gap: 20rpx">
  68. <image src="@/static/image/券.webp" mode="aspectFill" class="discount-image" />
  69. <text>新用户立减</text>
  70. <text style="color: red;">-2</text>
  71. </view>
  72. </view>
  73. <uv-gap height="20rpx" bgColor="#F7F7F7" />
  74. <!-- 备注 -->
  75. <view class="remark">
  76. <text style="align-self: start;">备注</text>
  77. <textarea class="remark-textarea" placeholder="请输入您需要备注的内容" />
  78. </view>
  79. <!-- 购物车与支付 -->
  80. <view class="cart-pay">
  81. <view class="cart">
  82. <uv-icon name="shopping-cart-fill" size="60rpx" color="#019245" label="加入购物车" labelPos="bottom"
  83. labelSize="25rpx" />
  84. </view>
  85. <view class="pay">
  86. 立即支付
  87. </view>
  88. </view>
  89. </view>
  90. </uv-popup>
  91. </view>
  92. </template>
  93. <script>
  94. export default {
  95. name: 'placeOrder',
  96. data() {
  97. return {
  98. value: 1,
  99. payMethod: 'weixin',
  100. pickupPoint: null
  101. }
  102. },
  103. methods: {
  104. // 添加open方法,用于外部调用打开弹窗
  105. open() {
  106. this.$refs.popup.open();
  107. },
  108. // 添加close方法,用于关闭弹窗
  109. close(){
  110. this.$refs.popup.close();
  111. },
  112. // 添加change方法,用于处理弹窗状态变化
  113. change(e) {
  114. console.log('弹窗状态变化:', e);
  115. // 可以在这里添加弹窗打开或关闭后的逻辑处理
  116. },
  117. // 跳转到取餐点选择页面
  118. gotoPickupPoint() {
  119. this.$utils.navigateTo('/pages_order/location/pickupPoint')
  120. // uni.navigateTo({
  121. // url: '/pages_order/location/pickupPoint'
  122. // });
  123. },
  124. // 获取并监听取餐点选择事件
  125. listenPickupPoint() {
  126. const pickupPointStr = uni.getStorageSync('selectedPickupPoint');
  127. if (pickupPointStr) {
  128. this.pickupPoint = JSON.parse(pickupPointStr);
  129. }
  130. uni.$on('updatePickupPoint', (point) => {
  131. this.pickupPoint = point;
  132. })
  133. }
  134. },
  135. mounted(){
  136. this.open();
  137. this.listenPickupPoint();
  138. },
  139. beforeDestroy() {
  140. uni.$off('updatePickupPoint');
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .place-order-title{
  146. font-size: 35rpx;
  147. height: 90rpx;
  148. display: flex;
  149. align-items: center;
  150. justify-content: center;
  151. position: relative;
  152. .number{
  153. color: $uni-color;
  154. }
  155. .text{
  156. color: #000;
  157. }
  158. .place-order-title-image{
  159. width: 100rpx;
  160. height: 50rpx;
  161. }
  162. .place-order-title-close{
  163. position: absolute;
  164. right: 20rpx;
  165. top: 50%;
  166. transform: translateY(-50%);
  167. color: $uni-color-third;
  168. }
  169. }
  170. .place-order-address{
  171. display: flex;
  172. height: 80rpx;
  173. line-height: 80rpx;
  174. align-items: center;
  175. // background-color: red;
  176. gap: 30rpx;
  177. padding-left: 20rpx;
  178. position: relative;
  179. text{
  180. font-size: 32rpx;
  181. font-weight: 500;
  182. }
  183. &-arrow{
  184. position: absolute;
  185. right: 20rpx;
  186. top: 50%;
  187. transform: translateY(-50%);
  188. }
  189. &-content{
  190. display: flex;
  191. flex-direction: column;
  192. justify-content: space-around;
  193. gap: 0rpx;
  194. height: 100%;
  195. // width: 100%;
  196. &-name{
  197. height: 30rpx;
  198. line-height: 30rpx;
  199. }
  200. &-address{
  201. height: 30rpx;
  202. line-height: 30rpx;
  203. width: 90%;
  204. text-overflow: ellipsis; // 三个连着一起才会出现省略号
  205. overflow: hidden;
  206. white-space: nowrap;
  207. }
  208. }
  209. }
  210. .item{
  211. display: flex;
  212. padding: 40rpx;
  213. gap: 40rpx;
  214. &-image{
  215. width: 250rpx;
  216. height: 200rpx;
  217. }
  218. }
  219. .option-box{
  220. display: flex;
  221. flex-direction: column;
  222. gap: 40rpx;
  223. width: 100%;
  224. &-item{
  225. display: flex;
  226. gap: 20rpx;
  227. align-items: center;
  228. font-size: 32rpx;
  229. padding: 0 40rpx;
  230. }
  231. }
  232. .discount{
  233. height: 130rpx;
  234. display: flex;
  235. align-items: center;
  236. width: 90%;
  237. justify-content: space-between;
  238. padding:0rpx 40rpx 0rpx 40rpx;
  239. // gap: 20rpx;
  240. .discount-image{
  241. width: 36rpx;
  242. height: 36rpx;
  243. border-radius: 10rpx;
  244. }
  245. }
  246. .remark{
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. padding: 20rpx 40rpx;
  251. // background-color: red;
  252. text{
  253. font-size: 32rpx;
  254. font-weight: 500;
  255. }
  256. .remark-textarea{
  257. width: 80%;
  258. height: 180rpx;
  259. // border: 1rpx solid #000;
  260. // border-radius: 10rpx;
  261. // padding: 20rpx;
  262. }
  263. }
  264. .cart-pay{
  265. // background-color: red;
  266. height: 130rpx;
  267. display: flex;
  268. .cart{
  269. width: 30%;
  270. display: flex;
  271. align-items: center;
  272. justify-content: center;
  273. }
  274. .pay{
  275. width: 70%;
  276. background-color: $uni-color;
  277. color: #fff;
  278. text-align: center;
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. font-size: 32rpx;
  283. }
  284. }
  285. </style>