test.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <view class="center">
  3. <view class="img">
  4. <image src="../../static/img/logo.png" mode=""></image>
  5. </view>
  6. <view class="test_title">
  7. 节水测试
  8. </view>
  9. <view class="form">
  10. <view class="form-item">
  11. <view class="form-left">姓名:</view>
  12. <text class="tip">*</text>
  13. <view class="form-right">
  14. <input type="text" @input="onAction" class="list-input" v-model="name" placeholder="请填写姓名" />
  15. </view>
  16. </view>
  17. <view class="form-item">
  18. <view class="form-left">地址:</view>
  19. <text class="tip"></text>
  20. <view class="form-right">
  21. <input @input="onAction" type="text" class="list-input" v-model="address" placeholder="请填写地址" />
  22. </view>
  23. </view>
  24. <view class="form-item">
  25. <view class="form-left">
  26. 联系电话:
  27. </view>
  28. <text class="tip">*</text>
  29. <view class="form-right">
  30. <input @input="onAction" class="list-input" type="text" v-model="address"
  31. placeholder="请填写联系方式" />
  32. </view>
  33. </view>
  34. <view class="form-item">
  35. <view class="form-left">
  36. 生产线类型:
  37. </view>
  38. <text class="tip">*</text>
  39. <view class="form-right">
  40. <picker :value="index" :range="array" @change="bindPickerType" class="list-input1">
  41. <text style="color: #C7C9D1;">{{line_type || '请选择生产类型'}}</text>
  42. </picker>
  43. </view>
  44. </view>
  45. <view class="form-item">
  46. <view class="form-left">
  47. 生产线数量:
  48. </view>
  49. <text class="tip">*</text>
  50. <view class="form-right">
  51. <input class="list-input" type="number" @input="onAction" v-model="line_num"
  52. placeholder="请填写生产线数量" />
  53. </view>
  54. </view>
  55. <view class="form-item">
  56. <view class="form-left">
  57. 目前用水量(吨/小时):
  58. </view>
  59. <text class="tip">*</text>
  60. <view class="form-right">
  61. <input class="list-input" type="number" @input="onAction" v-model="water_using"
  62. placeholder="请填写目前用水量" />
  63. </view>
  64. </view>
  65. <view class="form-item">
  66. <view class="form-left">工作时长(小时):</view>
  67. <text class="tip"></text>
  68. <view class="form-right">
  69. <input @input="onAction" class="list-input" v-model="day_work_times" type="number"
  70. placeholder="请填写每日工作时长,默认为12小时" />
  71. </view>
  72. </view>
  73. <view class="form-item">
  74. <view class="form-left">年工作日数:</view>
  75. <text class="tip"></text>
  76. <view class="form-right">
  77. <input @input="onAction" class="list-input" v-model="year_work_day" type="number"
  78. placeholder="请填写每年工作日数,默认为330天" />
  79. </view>
  80. </view>
  81. <view class="form-item">
  82. <view class="form-left">废水处理成本(元/吨):</view>
  83. <text class="tip">*</text>
  84. <view class="form-right">
  85. <input @input="onAction" class="list-input" v-model="deal_cost" type="number"
  86. placeholder="请填写废水处理成本" />
  87. </view>
  88. </view>
  89. </view>
  90. <view class="btn" @click="next">
  91. <view class="btn-left">
  92. 提交
  93. </view>
  94. </view>
  95. <view class="result">
  96. <view class="result-title">
  97. 测试结果
  98. </view>
  99. <view class="border">
  100. </view>
  101. <view class="result-box">
  102. </view>
  103. </view>
  104. <view class="tanchang">
  105. </view>
  106. <aboutUs class="aboutUs"></aboutUs>
  107. </view>
  108. </template>
  109. <script>
  110. import {
  111. addForm
  112. } from '@/api/index.js';
  113. import aboutUs from "@/components/introduce/introduce.vue"
  114. import {changeTaber} from "@/utils/tarberChange.js"
  115. export default {
  116. components: {
  117. aboutUs
  118. },
  119. data() {
  120. return {
  121. name: '',
  122. address: '',
  123. telephone: '',
  124. line_type: '',
  125. line_num: '',
  126. water_using: '',
  127. day_work_times: '',
  128. year_work_day: '',
  129. deal_cost: '',
  130. }
  131. },
  132. onLoad() {
  133. // this.loadData();
  134. changeTaber(4);
  135. },
  136. methods: {
  137. //表单提交
  138. next() {
  139. if (this.name == '') {
  140. //消息提醒
  141. uni.showToast({
  142. title: '请输入您的姓名',
  143. //是否展示图标
  144. icon: 'none',
  145. //显示时间
  146. duration: 2000
  147. });
  148. this.$api.msg('');
  149. return;
  150. }
  151. if (this.address == '') {
  152. uni.showToast({
  153. title: '请填写详细地址',
  154. icon: 'none',
  155. duration: 2000
  156. });
  157. return;
  158. }
  159. if (this.address == '') {
  160. uni.showToast({
  161. title: '请填写联系电话',
  162. icon: 'none',
  163. duration: 2000
  164. });
  165. return;
  166. }
  167. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  168. if (!reg.test(this.telephone)) {
  169. uni.showToast({
  170. title: '请填写正确的手机格式',
  171. icon: 'none',
  172. duration: 2000
  173. });
  174. return;
  175. }
  176. if (this.line_type == '') {
  177. uni.showToast({
  178. title: '请填写生产线类型',
  179. icon: 'none',
  180. duration: 2000
  181. });
  182. return;
  183. }
  184. if (this.line_num == '') {
  185. uni.showToast({
  186. title: '请填写生产线数量',
  187. icon: 'none',
  188. duration: 2000
  189. });
  190. return;
  191. }
  192. if (this.water_using == '') {
  193. uni.showToast({
  194. title: '请填写目前用水量',
  195. icon: 'none',
  196. duration: 2000
  197. });
  198. return;
  199. }
  200. if (this.deal_cost == '') {
  201. uni.showToast({
  202. title: '请填写废水处理成本',
  203. icon: 'none',
  204. duration: 2000
  205. });
  206. return;
  207. }
  208. },
  209. //选择生产线类型
  210. bindPickerType: function(e) {
  211. console.log(this.array[e.target.value])
  212. },
  213. // async loadData() {
  214. // const obj = this;
  215. // // banner({}).then(e => {
  216. // // obj.carouselList = obj.carouselList.concat(e.data.banner);
  217. // // console.log(obj.carouselList)
  218. // // // });
  219. // // category({
  220. // // page: 1,
  221. // // limit: 1000
  222. // // }, 2).then(({
  223. // // data
  224. // // }) => {
  225. // // console.log(data)
  226. // // obj.dataList = data
  227. // // });
  228. // },
  229. }
  230. };
  231. </script>
  232. <style lang="scss">
  233. .center {
  234. height: 100%;
  235. background: #FFFFFF;
  236. position: relative;
  237. }
  238. .img {
  239. margin: 17rpx 0 17rpx 41rpx;
  240. width: 208rpx;
  241. height: 52rpx;
  242. image {
  243. width: 100%;
  244. height: 100%;
  245. }
  246. }
  247. .test_title {
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. width: 100%;
  252. height: 60rpx;
  253. font-size: 22rpx;
  254. font-family: Adobe Heiti Std;
  255. font-weight: normal;
  256. color: #FFFFFF;
  257. background-color: #0165B5;
  258. }
  259. .test_table {
  260. font-size: 22rpx;
  261. font-family: Adobe Heiti Std;
  262. font-weight: normal;
  263. color: #000000;
  264. display: flex;
  265. justify-content: space-between;
  266. padding: 10rpx 30rpx;
  267. input {
  268. width: 340rpx;
  269. height: 40rpx;
  270. background: #FFFFFF;
  271. border: 1px solid #B9B7B7;
  272. border-radius: 2rpx;
  273. font-size: 16rpx;
  274. padding-left: 16rpx;
  275. }
  276. }
  277. .form {
  278. background: #FFFFFF;
  279. width: 100%;
  280. padding: 14rpx;
  281. // margin-top: 54rpx;
  282. .form-item {
  283. width: 98%;
  284. display: flex;
  285. align-items: center;
  286. justify-content: space-between;
  287. margin-top: 10rpx;
  288. .form-left {
  289. color: #212121;
  290. font-size: 22rpx;
  291. width: 250rpx;
  292. flex-shrink: 0;
  293. }
  294. .tip {
  295. margin-left: 0rpx;
  296. color: #ff0000;
  297. width: 34rpx;
  298. height: 34rpx;
  299. }
  300. .form-right {
  301. margin-left: 2rpx;
  302. padding: 12rpx;
  303. width: 100%;
  304. background-color: #FFFFFF;
  305. border: 2rpx solid #bdbdbd;
  306. border-radius: 6rpx;
  307. .list-input {
  308. font-size: 18rpx;
  309. .input-placeholder {
  310. color: #C7C9D1;
  311. font-size: 18rpx;
  312. }
  313. }
  314. .list-input1 {
  315. color: #757575;
  316. font-size: 18rpx;
  317. }
  318. }
  319. }
  320. }
  321. .btn {
  322. margin-top: 34rpx;
  323. width: 100%;
  324. height: 70rpx;
  325. display: flex;
  326. justify-content: center;
  327. color: #ffffff;
  328. font-size: 26rpx;
  329. .btn-left {
  330. width: 88%;
  331. height: 70rpx;
  332. display: flex;
  333. justify-content: center;
  334. align-items: center;
  335. // margin-left: 44rpx;
  336. background-color: #3874cb;
  337. border-radius: 8rpx;
  338. }
  339. }
  340. .result {
  341. display: flex;
  342. flex-direction: column;
  343. justify-content: center;
  344. align-items: center;
  345. .result-title {
  346. margin-top: 50rpx;
  347. display: flex;
  348. justify-content: center;
  349. align-items: center;
  350. width: 180rpx;
  351. height: 35rpx;
  352. font-size: 26rpx;
  353. font-family: Adobe Heiti Std;
  354. font-weight: normal;
  355. color: #000000;
  356. position: relative;
  357. top: 15rpx;
  358. z-index: 99;
  359. background-color: #FFFFFF;
  360. }
  361. .border {
  362. width: 100%;
  363. height: 1rpx;
  364. border: 1rpx solid #EEE9E9;
  365. }
  366. .result-box {
  367. width: 100%;
  368. height: 360rpx;
  369. background: #0165B5;
  370. margin-top: 24rpx;
  371. }
  372. }
  373. .tanchang {
  374. height: 132rpx;
  375. }
  376. .aboutUs {
  377. width: 100%;
  378. position: fixed;
  379. bottom: 100rpx;
  380. }
  381. </style>