bottom1.vue 8.0 KB

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