index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view class="work-pages">
  3. <!-- 工作控制按钮及进度 -->
  4. <view class="work-cons flex-center">
  5. <!-- 操作按钮组件 -->
  6. <view class="work-button-wrap">
  7. <!-- 按钮 -->
  8. <view class="work-button flex-center" @click="startWork">
  9. <!-- 扇形进度条 -->
  10. <view class="circle_process">
  11. <view class="wrapper right"><view class="circle rightcircle" :style="{ transform: `rotate(${rdeg}deg)` }"></view></view>
  12. <view class="wrapper left"><view class="circle leftcircle" :style="{ transform: `rotate(${ldeg}deg)` }"></view></view>
  13. </view>
  14. <view class="cirle-one"></view>
  15. <!-- 指针 -->
  16. <view class="cirle-two flex-center" v-for="item in 60" :key="item">
  17. <view class="sector" :style="{ transform: `rotate(${item * 6}deg)` }"></view>
  18. </view>
  19. <view class="cirle-three flex-center"></view>
  20. <view class="cirle-free" :class="status == 'working' ? 'w-stop' : 'w-start'"></view>
  21. <view class="cirle-sex flex-center">{{ status == 'working' ? '紧急停止' : '点击启动' }}</view>
  22. </view>
  23. <!-- 状态提示 -->
  24. <view class="work-button-tips">设备准备就绪</view>
  25. </view>
  26. </view>
  27. <!-- 说明提示 -->
  28. <view class="work-tips">
  29. <view v-if="status=='start'">
  30. <view class="work-dtime">
  31. 距离订单强制完成还剩
  32. <u-count-down
  33. @change="changeDtime"
  34. separator="zh"
  35. font-size="36"
  36. separator-size="28"
  37. color="#ff0000"
  38. :timestamp="timestamp"
  39. :show-days="false"
  40. :show-hours="false"
  41. ></u-count-down>
  42. </view>
  43. <view class="work-remarks">
  44. <view class="title">说明:</view>
  45. <view>
  46. 支付完成后
  47. <text class="red">请尽快启动洗车服务</text>
  48. ,否则订单将在5分钟后自动完成。
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 正在启动,归位弹框提示 -->
  54. <u-popup v-model="showStart" :mask-close-able="false" border-radius="10" mode="center" width="500rpx" height="400rpx">
  55. <view style="padding: 30rpx;display: flex;justify-content: center;text-align: center;">
  56. <!-- 启动中 -->
  57. <view v-if="status == 'start'">
  58. <u-image width="216px" height="120px" src="/static/img/start.png"></u-image>
  59. <view style="padding: 15rpx;">洗车机正在启动...</view>
  60. </view>
  61. <!-- 归位中 -->
  62. <view v-if="status == 'reseting'">
  63. <u-image width="216px" height="120px" src="/static/img/reset.png"></u-image>
  64. <view style="padding: 15rpx;">洗车机正在归位中...</view>
  65. </view>
  66. </view>
  67. </u-popup>
  68. <!-- 急停提示弹框 -->
  69. <u-popup v-model="showStop" :mask-close-able="false" border-radius="10" mode="center" width="80%">
  70. <view style="padding: 30rpx;text-align: center;">
  71. <view>
  72. <view style="font-weight: bold;">设备提示</view>
  73. <view style="display: flex;justify-content: center;padding: 10rpx 0;">
  74. <u-image width="165px" height="138px" src="/static/img/sbts.png"></u-image>
  75. </view>
  76. <u-divider>可能原因</u-divider>
  77. <view style="padding: 15rpx;text-align: left;">
  78. <view>1、洗车机紧急停止,本次服务结束</view>
  79. <view>2、因设备故障无法继续为您服务,所支付金额将退至您的支付账户</view>
  80. <view>3、如需再次服务,请退出车辆重新进入,再扫码支付洗车</view>
  81. <view>4、如需帮助请联系客服</view>
  82. </view>
  83. <view style="display: flex;padding: 20rpx 0;">
  84. <u-button @click="callPhone" style="width: 45%;border-radius: 0;">联系客服</u-button>
  85. <u-button @click="resetRabt" style="width: 45%;" type="error">洗车机归位</u-button>
  86. </view>
  87. </view>
  88. </view>
  89. </u-popup>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. timestamp: 300,
  97. rdeg: -135,
  98. ldeg: -135,
  99. step: 0,
  100. interId: null,
  101. status: 'start', // 状态,start 开始启动,working 正在工作,reseting 归位中
  102. showStart: false ,// 启动弹框提示
  103. showStop: false, // 急停提示
  104. };
  105. },
  106. onLoad() {},
  107. methods: {
  108. // 电话客服
  109. callPhone () {
  110. uni.makePhoneCall({
  111. phoneNumber: '114'
  112. })
  113. },
  114. // 倒计时监听,0 时自动结束订单
  115. changeDtime(time) {
  116. console.log(time);
  117. },
  118. // 归位机器
  119. resetRabt(){
  120. this.status = 'reseting';
  121. this.showStart = true;
  122. this.showStop = false;
  123. // 归位结束后
  124. setTimeout(()=>{
  125. uni.redirectTo({
  126. url:"/pages/work/success/success"
  127. })
  128. },3000)
  129. },
  130. // 启动,急停按钮
  131. startWork() {
  132. // 启动
  133. if (this.status == 'start') {
  134. this.showStart = true;
  135. // 启动成功
  136. setTimeout(() => {
  137. this.status = 'working';
  138. this.showStart = false;
  139. // 进度条
  140. this.interId = setInterval(()=>{
  141. this.loading(this.step++)
  142. },7000)
  143. }, 3000);
  144. }
  145. // 急停
  146. if (this.status == 'working') {
  147. // 显示急停提示弹框
  148. this.showStop = true;
  149. // 停止进度
  150. this.rdeg= -135;
  151. this.ldeg= -135;
  152. clearInterval(this.interId);
  153. }
  154. },
  155. // 进度条动画
  156. loading(second) {
  157. if (second <= 30) {
  158. this.rdeg = -135 + 6 * second;
  159. this.ldeg = -135;
  160. } else {
  161. this.rdeg = 45;
  162. this.ldeg = -135 + 6 * (second - 30);
  163. }
  164. }
  165. }
  166. };
  167. </script>
  168. <style lang="scss">
  169. // 扇形圆环
  170. .circle_process {
  171. position: absolute;
  172. width: 390rpx;
  173. height: 390rpx;
  174. }
  175. .circle_process .wrapper {
  176. width: 195rpx;
  177. height: 390rpx;
  178. position: absolute;
  179. top: 0;
  180. overflow: hidden;
  181. }
  182. .circle_process .right {
  183. right: 1px;
  184. }
  185. .circle_process .left {
  186. left: 1px;
  187. }
  188. .circle_process .circle {
  189. width: 390rpx;
  190. height: 390rpx;
  191. border: 40rpx solid transparent;
  192. border-radius: 100%;
  193. position: absolute;
  194. top: 0;
  195. transform: rotate(-135deg);
  196. }
  197. .circle_process .rightcircle {
  198. border-top: 40rpx solid red;
  199. border-right: 40rpx solid red;
  200. right: 0;
  201. }
  202. .circle_process .leftcircle {
  203. border-bottom: 40rpx solid red;
  204. border-left: 40rpx solid red;
  205. left: 0;
  206. }
  207. .work-pages {
  208. width: 100%;
  209. .flex-center {
  210. display: flex;
  211. align-items: center;
  212. justify-content: center;
  213. }
  214. .work-cons {
  215. height: 50vh;
  216. background-image: linear-gradient(0deg, #666, #333);
  217. border-bottom-left-radius: 500rpx 50rpx;
  218. border-bottom-right-radius: 500rpx 50rpx;
  219. position: relative;
  220. // 按钮
  221. .work-button-wrap {
  222. width: 400rpx;
  223. margin-top: -50rpx;
  224. .work-button {
  225. background: #666;
  226. border-radius: 100%;
  227. width: 390rpx;
  228. height: 390rpx;
  229. cursor: pointer;
  230. .cirle-one {
  231. background-image: linear-gradient(180deg, #555, #333 20%);
  232. width: 370rpx;
  233. height: 370rpx;
  234. border-radius: 100%;
  235. position: absolute;
  236. }
  237. .cirle-two {
  238. width: 370rpx;
  239. height: 370rpx;
  240. border-radius: 100%;
  241. position: absolute;
  242. .sector {
  243. transform-origin: center center;
  244. width: 350rpx;
  245. height: 5rpx;
  246. background: #888;
  247. }
  248. }
  249. .cirle-three {
  250. background: #444;
  251. width: 280rpx;
  252. height: 280rpx;
  253. border-radius: 100%;
  254. position: absolute;
  255. }
  256. .cirle-free {
  257. width: 230rpx;
  258. height: 230rpx;
  259. border-radius: 100%;
  260. position: absolute;
  261. animation: mymove 5s infinite;
  262. }
  263. @keyframes mymove {
  264. 0% {
  265. transform: scale(1); /*开始为原始大小*/
  266. opacity: 1;
  267. }
  268. 25% {
  269. transform: scale(1.1); /*放大1.1倍*/
  270. opacity: 0.5;
  271. }
  272. 50% {
  273. transform: scale(1);
  274. opacity: 1;
  275. }
  276. 75% {
  277. transform: scale(1.1);
  278. opacity: 0.5;
  279. }
  280. }
  281. .cirle-sex {
  282. background-image: linear-gradient(180deg, #888, #333 50%);
  283. width: 210rpx;
  284. height: 210rpx;
  285. border-radius: 100%;
  286. position: absolute;
  287. color: #ffffff;
  288. font-size: 28rpx;
  289. color: #eee;
  290. }
  291. .w-start {
  292. background: #ffc800;
  293. }
  294. .w-stop {
  295. background: #ff0000;
  296. }
  297. &:active {
  298. .cirle-sex {
  299. background-image: linear-gradient(180deg, #888, #333 80%);
  300. }
  301. }
  302. }
  303. .work-button-tips {
  304. color: #eee;
  305. text-align: center;
  306. padding-top: 30rpx;
  307. }
  308. }
  309. }
  310. .work-tips {
  311. padding: 45rpx;
  312. .work-dtime {
  313. text-align: center;
  314. font-weight: bold;
  315. font-size: 34rpx;
  316. }
  317. .work-remarks {
  318. padding-top: 50rpx;
  319. .red {
  320. color: red;
  321. }
  322. .title {
  323. font-weight: bold;
  324. }
  325. }
  326. }
  327. }
  328. </style>