getOrder.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="order-content">
  3. <view class="step">
  4. <uni-steps :options="[{title: '停车'}, {title: '检查'}, {title: '下单'}]" :active="stepIndex" active-color="rgb(255,0,0)"></uni-steps>
  5. </view>
  6. <view class="step-content">
  7. <!-- 停车 -->
  8. <view v-if="stepIndex===0" class="step-item step-one">
  9. <text>请确认车辆是否停到指定位置</text>
  10. <image src="/static/img/step-one.png" mode="aspectFit"></image>
  11. </view>
  12. <!-- 检查 -->
  13. <view v-if="stepIndex===1" class="step-item step-two">
  14. <view class="item top">
  15. <text>-请完成以下操作-</text>
  16. <image src="/static/img/cztis.png" mode="aspectFit"></image>
  17. <view class="care">
  18. 注意:洗车过程中禁止移动车辆和上下车
  19. </view>
  20. </view>
  21. <view class="item bottom">
  22. <text>超高加装件不能清洗</text>
  23. <image src="/static/img/zyts.png" mode="aspectFit"></image>
  24. </view>
  25. </view>
  26. <!-- 下单 -->
  27. <view v-if="stepIndex===2" class="step-item step-three">
  28. <view class="choose">
  29. <view class="title">
  30. 请选择服务模式
  31. </view>
  32. <view class="list">
  33. <view :class="['item', serverIndex==index ?'avtive':'']" @click="chooseItem(index)" v-for="(item,index) in itemList" :key="index">
  34. <text>{{item.name}}</text>
  35. <text class="price">¥{{item.price}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="choose-content">
  40. <view class="choose-item">
  41. <view class="item" @click="intoChooseCoupon">
  42. <text>优惠卷</text>
  43. <view class="right">
  44. <u-icon name="gift" color="rgb(255,0,0)" size="32"></u-icon>
  45. <text class="coopon">9.8元洗车券(¥-9.8)</text>
  46. <u-icon name="arrow-right" color="rgb(255,0,0)" size="32"></u-icon>
  47. </view>
  48. </view>
  49. <view class="item phone">
  50. <text>手机号码</text>
  51. <view class="right">
  52. <text >18792703003</text>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="read">
  57. <u-radio-group v-model="isRead">
  58. <u-radio shape="square" :disabled="isRead!='read'" name="read" active-color="red" icon-size="28" label-size="28">
  59. 点击阅读并同意
  60. <text>无人洗车</text>
  61. <text @click="intoAgreement">《注意事项及服务协议》</text>
  62. </u-radio>
  63. </u-radio-group>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="step-footer">
  68. <button class="next-button" @click="nextStep" v-if="stepIndex!=2" type="warn">下一步</button>
  69. <view v-else class="pay">
  70. <text>合计:</text>
  71. <text class="amount">¥10:00</text>
  72. <view class="">
  73. <button @click="toPay" type="warn">去付款</button>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. import uniSteps from '@/components/uni-steps/uni-steps.vue'
  82. export default {
  83. components: {
  84. uniSteps
  85. },
  86. data() {
  87. return {
  88. stepIndex: 0, // 当前步奏下标
  89. serverIndex: 0, // 选择服务下标
  90. itemList: [ // 服务列表
  91. {
  92. id: 1,
  93. name: '极速快洗',
  94. price: 10
  95. },
  96. {
  97. id: 12,
  98. name: '精致洗',
  99. price: 20
  100. },
  101. {
  102. id: 13,
  103. name: '打蜡洗',
  104. price: 30
  105. }
  106. ],
  107. isRead: '', // 是否同意协议
  108. }
  109. },
  110. onLoad(option) {
  111. uni.removeStorageSync('stepIndex')
  112. // 注册全局监听事件
  113. uni.$once('read', this.read)
  114. },
  115. onUnload() {
  116. uni.removeStorageSync('stepIndex')
  117. },
  118. onShow() {
  119. const index = uni.getStorageSync('stepIndex')
  120. this.stepIndex = index ? index : 0
  121. console.log(this.stepIndex)
  122. },
  123. methods: {
  124. // 选择服务项目
  125. chooseItem(index) {
  126. this.serverIndex = index
  127. },
  128. // 下一步
  129. nextStep() {
  130. this.stepIndex = this.stepIndex===0 ? 1 : 2
  131. uni.setStorageSync('stepIndex', this.stepIndex)
  132. },
  133. // 已阅读
  134. read (e) {
  135. this.isRead = e.msg
  136. },
  137. // 选择优惠券
  138. intoChooseCoupon () {
  139. uni.navigateTo({
  140. url: '/pages/coupon/chooseCoupon/chooseCoupon'
  141. })
  142. },
  143. // 打开服务协议
  144. intoAgreement () {
  145. uni.navigateTo({
  146. url: '/pages/agreement/agreement'
  147. })
  148. },
  149. // 去付款
  150. toPay (){
  151. // 付款成功后开始洗车
  152. uni.redirectTo({
  153. url:"/pages/work/index/index"
  154. })
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss">
  160. page{
  161. height: 100%;
  162. }
  163. .order-content{
  164. width: 100%;
  165. height: 100%;
  166. display: flex;
  167. flex-direction: column;
  168. .step{
  169. padding: 40rpx 0;
  170. }
  171. .step-content{
  172. flex: 1;
  173. width: 100%;
  174. display: flex;
  175. flex-direction: column;
  176. .step-item{
  177. width: 100%;
  178. display: flex;
  179. flex-direction: column;
  180. align-items: center;
  181. flex: 1;
  182. }
  183. .step-one{
  184. text{
  185. color: #999;
  186. margin: 40rpx 0;
  187. }
  188. }
  189. .step-two{
  190. background-color: #F8F8F8;
  191. .item{
  192. background-color: #fff;
  193. width: 80%;
  194. height: 40%;
  195. display: flex;
  196. flex-direction: column;
  197. align-items: center;
  198. margin-top: 20rpx;
  199. padding-top: 20rpx;
  200. image{
  201. width: 80%;
  202. flex: 1;
  203. }
  204. }
  205. .top{
  206. text{
  207. color: #df928e;
  208. font-size: 24rpx;
  209. margin-bottom: 20rpx;
  210. }
  211. .care{
  212. padding: 10rpx 20rpx;
  213. background-color: #ff805b;
  214. border-radius: 30rpx;
  215. color: #fff;
  216. font-size: 24rpx;
  217. margin-bottom: 10rpx;
  218. }
  219. }
  220. .bottom{
  221. text{
  222. font-size: 24rpx;
  223. color: #333;
  224. }
  225. }
  226. }
  227. .step-three{
  228. .choose{
  229. width: 100%;
  230. height: auto;
  231. padding-bottom: 60rpx;
  232. display: flex;
  233. flex-direction: column;
  234. align-items: center;
  235. border-bottom: 1px solid #eee;
  236. .title{
  237. color: #666;
  238. }
  239. .list{
  240. width: 100%;
  241. display: flex;
  242. justify-content: space-around;
  243. padding: 0 20rpx;
  244. .item{
  245. width: 30%;
  246. height: 140rpx;
  247. display: flex;
  248. flex-direction: column;
  249. align-items: center;
  250. justify-content: center;
  251. border: 1px solid #eee;
  252. border-radius: 15rpx;
  253. margin-top: 30rpx;
  254. color: #999;
  255. .price{
  256. font-size: 34rpx;
  257. margin-top: 10rpx;
  258. }
  259. }
  260. .avtive{
  261. color: #333;
  262. border-color: rgb(255,0,0);
  263. .price{
  264. color: rgb(255,0,0);
  265. }
  266. }
  267. }
  268. }
  269. .choose-content{
  270. flex: 1;
  271. width: 100%;
  272. .choose-item{
  273. width: 100%;
  274. .item{
  275. padding: 0 30rpx;
  276. }
  277. }
  278. .item{
  279. width: 100%;
  280. height: 100rpx;
  281. display: flex;
  282. align-items: center;
  283. justify-content: space-between;
  284. border-bottom: 1px solid #eee;
  285. .coopon{
  286. color: rgb(255,0,0);
  287. }
  288. }
  289. .phone{
  290. border-bottom: none;
  291. }
  292. .read{
  293. width: 100%;
  294. border-top: 1px solid #eee;
  295. padding-top: 40rpx;
  296. display: flex;
  297. justify-content: center;
  298. text{
  299. color: #999;
  300. }
  301. text:last-child{
  302. color: #ff9ba5;
  303. }
  304. }
  305. }
  306. }
  307. .step-footer{
  308. width: 100%;
  309. background-color: #fff;
  310. .next-button{
  311. margin: 0;
  312. border-radius: 0;
  313. padding: 10rpx 0;
  314. }
  315. .pay{
  316. width: 100%;
  317. height: 100%;
  318. padding: 10rpx;
  319. border-top: 1px solid #eee;
  320. display: flex;
  321. align-items: center;
  322. justify-content: flex-end;
  323. .amount{
  324. color: rgb(255,0,0);
  325. font-size: 36rpx;
  326. margin-right: 40rpx;
  327. }
  328. button{
  329. width: 200rpx;
  330. }
  331. }
  332. }
  333. }
  334. }
  335. </style>