bottom1.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="box">
  3. <image class="image"
  4. src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404111712812810046B1fbafed9.png"
  5. lazy-load="true" mode="aspectFill" />
  6. <view class="function">
  7. <view class="cn-title">预约免费设计</view>
  8. <view class="en-title">Appointment Free Design</view>
  9. <view class="form">
  10. <view class="text" @click="setFocus('姓名')">
  11. <view class="bg" />
  12. <view class="iconfont icon-renyuan-hui" />
  13. <input class="input" :focus="focus == '姓名'" type="text" v-model="content.name" placeholder="请输入您的姓名">
  14. </view>
  15. <view class="text" @click="setFocus('手机号')">
  16. <view class="bg" />
  17. <view class="iconfont icon-dianhua-hui" />
  18. <input class="input" :focus="focus == '手机号'" :disabled="!manualOperation" type="number"
  19. v-model="content.phonenumber" placeholder="请输入您的电话号码">
  20. <button v-if="!manualOperation" class="button" open-type="getPhoneNumber"
  21. @getphonenumber="getphonenumber">123123323223323222222</button>
  22. </view>
  23. <picker mode='region' @change="getRegion">
  24. <view class="text">
  25. <view class="bg" />
  26. <view class="iconfont icon-dizhi-hui1" />
  27. <view style="color: #fff;" v-if="content.province">
  28. {{ this.getCity(content, false) }}
  29. </view>
  30. <view v-else style="opacity: .3;color: #fff;font-size: 14px;">
  31. 请选择城市
  32. </view>
  33. </view>
  34. </picker>
  35. <view class="text textarea-box">
  36. <view class="bg" />
  37. <view class="iconfont icon-dizhi-hui1" />
  38. <textarea class="textarea" v-model="content.address" placeholder="请输入您的具体地址(街道、楼号、门牌号等)" />
  39. </view>
  40. <view v-if="!content.name || !content.phonenumber || !content.province" class="but forbidden"
  41. hover-class="navigator-hover" @click="reminder">
  42. 立即免费预约 >
  43. </view>
  44. <view v-else class="but" hover-class="navigator-hover" @click="loading ? '' : submit()">
  45. <u-loading-icon v-if="loading" />
  46. <text v-else>
  47. 立即免费预约 >
  48. </text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import contact from "../contact.vue"
  56. export default {
  57. components: { contact },
  58. name: "bottom1",
  59. props: {
  60. ownertable: {
  61. type: String
  62. },
  63. ownerid: {
  64. type: [String, Number]
  65. },
  66. type: {
  67. type: String
  68. },
  69. typemx: {
  70. type: String
  71. },
  72. extrajson: {
  73. type: Object,
  74. default: {}
  75. }
  76. },
  77. data() {
  78. return {
  79. focus: '',
  80. loading: false,
  81. manualOperation: false,
  82. content: {
  83. name: "",
  84. phonenumber: "",
  85. address: "",
  86. "province": "",
  87. "city": "",
  88. "county": "",
  89. }
  90. }
  91. },
  92. methods: {
  93. setFocus(name) {
  94. this.focus = '';
  95. setTimeout(() => {
  96. this.focus = name;
  97. })
  98. },
  99. submit() {
  100. let content = this.content;
  101. content.ownertable = this.ownertable;
  102. content.ownerid = this.ownerid;
  103. content.type = this.type;
  104. content.typemx = this.typemx;
  105. content.extrajson = this.extrajson;
  106. if (!new RegExp('^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\\d{8}$').test(content.phonenumber)) return uni.showModal({
  107. title: '提示',
  108. content: '手机号码格式错误',
  109. showCancel: false,
  110. })
  111. this.loading = true;
  112. this.$Http.basic({
  113. "id": 20240513144602,
  114. content
  115. }).then(res => {
  116. console.log("提交预约单", res)
  117. this.loading = false;
  118. if (this.cutoff(res.msg)) return;
  119. uni.showModal({
  120. title: '提交成功',
  121. content: '感谢您的支持,工作人员会第一时间跟您联系!',
  122. showCancel: false,
  123. confirmColor: '#C30D23',
  124. })
  125. this.content = {
  126. name: "",
  127. phoneNumber: "",
  128. address: "",
  129. "province": "",
  130. "city": "",
  131. "county": "",
  132. };
  133. })
  134. },
  135. getRegion(e) {
  136. this.content.province = e.detail.value[0];
  137. this.content.city = e.detail.value[1];
  138. this.content.county = e.detail.value[2];
  139. },
  140. reminder() {
  141. uni.showToast({
  142. title: "请先完成填写后提交",
  143. icon: "none",
  144. duration: 1500,
  145. })
  146. },
  147. getphonenumber(e) {
  148. if (e.detail.code) {
  149. this.$Http.basic({
  150. "id": 20240520110702,
  151. "content": {
  152. "systemclient": "marketingtool",
  153. "code": e.detail.code
  154. }
  155. }).then(res => {
  156. console.log("获取手机号", res)
  157. this.manualOperation = true;
  158. try {
  159. this.content.phonenumber = res.data.purePhoneNumber;
  160. } catch (error) {
  161. this.focus = '手机号';
  162. }
  163. })
  164. } else {
  165. this.manualOperation = true;
  166. this.focus = '手机号';
  167. }
  168. }
  169. },
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .box {
  174. position: relative;
  175. width: 100vw;
  176. height: 436px;
  177. .image {
  178. width: 100%;
  179. height: 100%;
  180. display: block;
  181. vertical-align: bottom;
  182. }
  183. .function {
  184. position: absolute;
  185. top: 0;
  186. left: 0;
  187. width: 100%;
  188. height: 100%;
  189. z-index: 1;
  190. .cn-title {
  191. width: 100%;
  192. text-align: center;
  193. line-height: 22px;
  194. font-family: PingFang SC, PingFang SC;
  195. font-weight: 500;
  196. font-size: 16px;
  197. color: #FFFFFF;
  198. margin-top: 30px;
  199. }
  200. .en-title {
  201. width: 100%;
  202. text-align: center;
  203. font-family: PingFang SC, PingFang SC;
  204. font-size: 10px;
  205. color: #FFFFFF;
  206. }
  207. .form {
  208. width: 260px;
  209. margin: 0 auto;
  210. margin-top: 20px;
  211. .text {
  212. position: relative;
  213. display: flex;
  214. align-items: center;
  215. width: 260px;
  216. height: 45px;
  217. border: 1px solid rgba(255, 255, 255, 0.4);
  218. border-radius: 2px;
  219. overflow: hidden;
  220. padding: 0 10px;
  221. box-sizing: border-box;
  222. margin-bottom: 10px;
  223. .button {
  224. width: 100%;
  225. height: 100%;
  226. position: absolute;
  227. top: 0;
  228. left: 0;
  229. z-index: 2;
  230. opacity: 0;
  231. }
  232. .input {
  233. color: #fff;
  234. flex: 1;
  235. }
  236. .textarea {
  237. color: #fff;
  238. flex: 1;
  239. height: 62px;
  240. }
  241. .iconfont {
  242. color: #fff;
  243. font-size: 20px;
  244. margin-right: 10px;
  245. }
  246. }
  247. .textarea-box {
  248. padding-top: 13px;
  249. height: 90px;
  250. align-items: flex-start;
  251. }
  252. .text::after {
  253. content: "";
  254. position: absolute;
  255. top: 0;
  256. left: 0;
  257. width: 100%;
  258. height: 100%;
  259. background: #fff;
  260. opacity: .2;
  261. }
  262. .but {
  263. display: flex;
  264. align-items: center;
  265. justify-content: center;
  266. width: 260px;
  267. height: 45px;
  268. background: #C30D23;
  269. border-radius: 2px;
  270. font-family: PingFang SC, PingFang SC;
  271. font-weight: 500;
  272. font-size: 14px;
  273. color: #FFFFFF;
  274. }
  275. }
  276. }
  277. }
  278. .forbidden {
  279. opacity: .6;
  280. }
  281. </style>