index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <view class="content-box">
  3. <view class="header-box">
  4. <image src="/static/tips.png" mode="aspectFill"></image>
  5. <text>温馨提示:请填写以下信息,填写后信息不可修改</text>
  6. </view>
  7. <form @submit="formSubmit" style="width: 100%">
  8. <view class="self-title-box">
  9. <image src="/static/rect-icon.png" mode="aspectFill"></image>
  10. <text>个人信息</text>
  11. </view>
  12. <view class="info-box">
  13. <view class="info-title-box">
  14. <image src="/static/require-icon.png" mode="aspectFill"></image>
  15. <text>姓名</text>
  16. </view>
  17. <view class="info-value-box">
  18. <input type="text" placeholder="请输入姓名" name="selfName">
  19. </view>
  20. </view>
  21. <view class="info-box" style="border-bottom: none;height: 170rpx;">
  22. <view class="info-title-box">
  23. <image src="/static/require-icon.png" mode="aspectFill"></image>
  24. <text>性别</text>
  25. </view>
  26. <view class="info-gender-box">
  27. <radio-group @change="radioCheck" class="padding-left-2">
  28. <label class="radio margin-right-10"><radio value="1" :checked="userSex==='1'" color="#00A1B4" class="form-radio"/>男</label>
  29. <label class="radio"><radio value="0" :checked="userSex==='0'" color="#00A1B4" class="form-radio"/>女</label>
  30. </radio-group>
  31. </view>
  32. </view>
  33. <view class="border-line-box"></view>
  34. <view class="self-title-box">
  35. <image src="/static/rect-icon.png" mode="aspectFill"></image>
  36. <text>经销商信息</text>
  37. </view>
  38. <view class="info-box">
  39. <view class="info-title-box">
  40. <image src="/static/require-icon.png" mode="aspectFill"></image>
  41. <text>经销商姓名</text>
  42. </view>
  43. <view class="info-value-box">
  44. <input type="text" placeholder="请输入姓名" name="dealerName">
  45. </view>
  46. </view>
  47. <!-- <view class="info-box">
  48. <view class="info-title-box">
  49. <image src="/static/require-icon.png" mode="aspectFill"></image>
  50. <text>经销商手机号</text>
  51. </view>
  52. <view class="info-value-box">
  53. <input type="number" placeholder="请输入手机号" name="dealPhone">
  54. </view>
  55. </view> -->
  56. <view class="info-box" style="border-bottom: none;height: auto;">
  57. <view class="info-title-box">
  58. <image src="/static/require-icon.png" mode="aspectFill"></image>
  59. <text>经销商展厅所在地</text>
  60. </view>
  61. <view class="info-value-box " style="margin: 2% auto;">
  62. <view class="uni-input picker-box">
  63. <view class="content" style="width: 100%;">
  64. <view class="content_list" style="width: 100%;">
  65. <view class="content_list_label" @click="addressShow = true" style="width: 100%;color: #888;">{{txt}}</view>
  66. <view class="content_list_content">
  67. <pickerAddress v-model="addressShow" @confirm="addresspick" />
  68. <image src="/static/right-arrow.png" mode="aspectFill"></image>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="textarea-box" v-show="!addressShow">
  74. <textarea auto-height placeholder="请输入详细地址" v-model="addressDetail" maxlength="26" @blur="testLength"/>
  75. </view>
  76. </view>
  77. </view>
  78. <view style="width: 100%;">
  79. <button type="primary" class="submit-bth" formType="submit">提交</button>
  80. </view>
  81. </form>
  82. </view>
  83. </template>
  84. <script>
  85. var md5 = require("../../../common/md5.js");
  86. import pickerAddress from '@/components/liudx-pickerAddress/index.vue'
  87. var graceChecker = require("../../../common/graceChecker.js");
  88. export default {
  89. components: {
  90. pickerAddress
  91. },
  92. data() {
  93. return {
  94. title: 'Hello',
  95. detailObj:{},
  96. shareContent:'',
  97. shareCode:'',
  98. storeImg:'',
  99. isAuthPhone:getApp().globalData.user_phone,
  100. userSex:'1',
  101. txt: '请选择',
  102. addressShow: false,
  103. form: {
  104. province: '',
  105. city: '',
  106. },
  107. address: '',
  108. addressObj:{},
  109. loginObj:{},
  110. addressDetail:'',
  111. }
  112. },
  113. onLoad(option) {
  114. //this.getDetailInfo(option.detailId);
  115. },
  116. onShow() {
  117. },
  118. // onShareAppMessage() {
  119. // return {
  120. // title: '分销小助手',
  121. // path:'/pages/index/index?scene=' + getApp().globalData.user_id
  122. // }
  123. // },
  124. methods: {
  125. addresspick(obj) {
  126. console.log(obj)
  127. this.addressObj = obj;
  128. this.txt = obj.province.name + obj.city.name;
  129. },
  130. radioCheck(e){
  131. console.log(e.target.value)
  132. this.userSex = e.target.value;
  133. //this.gender = e.target.value == '0' ? '男' : '女';
  134. },
  135. changeCity(data) {
  136. this.txt = data.data.join('')
  137. console.log(data.data.join(''))
  138. },
  139. testLength(){
  140. if(this.addressDetail.length > 25){
  141. uni.showToast({
  142. title: '详细地址应为0-25个字符',
  143. icon: 'none'
  144. });
  145. }
  146. },
  147. formSubmit(e) {
  148. //将下列代码加入到对应的检查位置
  149. //定义表单规则
  150. var rule = [
  151. {
  152. name: "selfName",
  153. checkType: "notnull",
  154. errorMsg: "姓名不能为空"
  155. },
  156. {
  157. name: "selfName",
  158. checkType: "string",
  159. checkRule: "2,15",
  160. errorMsg: "姓名不能小于2个字符"
  161. },
  162. {
  163. name: "selfName",
  164. checkType: "reg",
  165. checkRule: "[\u4e00-\u9fa5]",
  166. errorMsg: "姓名需为中文"
  167. },
  168. {
  169. name: "dealerName",
  170. checkType: "notnull",
  171. errorMsg: "经销商姓名不能为空"
  172. },
  173. {
  174. name: "dealerName",
  175. checkType: "string",
  176. checkRule: "2,15",
  177. errorMsg: "经销商姓名不能小于2个字符"
  178. },
  179. ];
  180. //进行表单检查
  181. var formData = e.detail.value;
  182. var checkRes = graceChecker.check(formData, rule);
  183. if (checkRes) {
  184. this.txt === '请选择' ?
  185. uni.showToast({
  186. title: '请选择地区',
  187. icon: "none"
  188. }):
  189. this.submitRequest(formData);
  190. } else {
  191. uni.showToast({
  192. title: graceChecker.error,
  193. icon: "none"
  194. });
  195. }
  196. },
  197. submitRequest(params){
  198. console.log(params)
  199. let that = this;
  200. uni.request({
  201. url:getApp().globalData.shareUrl, //需要设置为全局
  202. method: 'POST',
  203. header: {
  204. 'content-type': 'application/x-www-form-urlencoded'
  205. },
  206. data: {
  207. method: 'jxs_guest_login',
  208. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  209. sign: md5('jxs_guest_login' + getApp().globalData.globalTimestamp),
  210. phone:getApp().globalData.userPhone,
  211. wxopenid:getApp().globalData.openId,
  212. name:params.selfName,
  213. sex:that.userSex,//0-女 1-男
  214. province:that.addressObj.province.id,//省份id
  215. city:that.addressObj.city.id,//城市id
  216. detailaddress:that.addressDetail,
  217. jxs_name:params.dealerName,
  218. },
  219. success: res => {
  220. console.log(res)
  221. if(res.data.code === 200){
  222. that.loginObj = res.data.msg;
  223. getApp().globalData.userCodeNumber = that.loginObj.code;
  224. getApp().globalData.managerPhone = that.loginObj.qyjl_phone;
  225. getApp().globalData.managerName = that.loginObj.qyjl_name;
  226. getApp().globalData.addTime = that.loginObj.addtime;
  227. this.goCustomCardPage(that.loginObj.pass)
  228. }
  229. else {
  230. uni.showToast({
  231. title: res.data.msg,
  232. icon: 'none'
  233. });
  234. }
  235. }
  236. });
  237. },
  238. goCustomCardPage(type){
  239. type === 1 ?
  240. uni.redirectTo({
  241. url: '/pages/index/successPage/index?types='+'dealer', //经销商成功页面
  242. success: res => {},
  243. fail: () => {},
  244. complete: () => {}
  245. }):
  246. uni.redirectTo({
  247. url: '/pages/index/failPage/index', //失败页面
  248. success: res => {},
  249. fail: () => {},
  250. complete: () => {}
  251. });
  252. }
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .content {
  258. &_list{
  259. display: flex;
  260. flex-direction: row;
  261. align-items: center;
  262. justify-content:space-around;
  263. &_lable{
  264. }
  265. &_content{
  266. flex: 1;
  267. width: auto;
  268. text-align: right;
  269. }
  270. }
  271. }
  272. .content-box {
  273. width: 100%;
  274. /* height: 100%; */
  275. display: flex;
  276. flex-direction: column;
  277. align-items: center;
  278. /* justify-content: center; */
  279. }
  280. .header-box {
  281. width: 85%;
  282. height:80rpx;
  283. border: .5px dotted #00A1B4;
  284. border-radius: 50rpx;
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. font-size: 24rpx;
  289. color:#00A1B4 ;
  290. /* font-family: PingFangSC-Regular; */
  291. margin-top: 2%;
  292. }
  293. .header-box image {
  294. width: 36rpx;
  295. height: 36rpx;
  296. margin-right: 1%;
  297. }
  298. .self-title-box {
  299. width: 90%;
  300. display: flex;
  301. align-items: center;
  302. font-size: 32rpx;
  303. letter-spacing: 2rpx;
  304. color:#3C3C3C ;
  305. /* font-family: SimHei; */
  306. margin: 4% auto;
  307. font-weight: bold;
  308. height: 50rpx;
  309. line-height: 50rpx;
  310. }
  311. .self-title-box image {
  312. width: 6rpx;
  313. height: 32rpx;
  314. margin-right: 2%;
  315. }
  316. .info-box {
  317. width: 90%;
  318. margin: 3% auto;
  319. height: 180rpx;
  320. border-bottom: 1px solid #f7f7f7;
  321. }
  322. .info-title-box {
  323. width: 100%;
  324. display: flex;
  325. align-items: center;
  326. font-size: 28rpx;
  327. height: 50rpx;
  328. line-height: 50rpx;
  329. }
  330. .info-title-box image{
  331. width: 15rpx;
  332. height: 15rpx;
  333. margin-right: 2%;
  334. }
  335. .info-value-box input {
  336. height: 88rpx;
  337. background: #f7f7f7;
  338. font-size: 28rpx;
  339. padding-left: 4%;
  340. margin: 2% auto;
  341. }
  342. .info-gender-box {
  343. margin: 3% auto;
  344. font-size: 28rpx;
  345. }
  346. .form-radio {
  347. transform: scale(0.6);
  348. }
  349. .padding-left-2 {
  350. padding-left: 2%;
  351. }
  352. .margin-right-10 {
  353. margin-right: 10%;
  354. }
  355. .border-line-box {
  356. width: 100%;
  357. height: 20rpx;
  358. background: #f7f7f7;
  359. }
  360. .picker-box{
  361. display: flex;
  362. align-items: center;
  363. justify-content: space-between;
  364. height: 60rpx;
  365. line-height: 60rpx;
  366. background: #f7f7f7;
  367. height: 88rpx;
  368. line-height: 88rpx;
  369. background: #f7f7f7;
  370. font-size: 28rpx;
  371. padding-left: 4%;
  372. }
  373. .uni-input image {
  374. width: 40rpx;
  375. height: 40rpx;
  376. margin-right: 2%;
  377. float: right;
  378. }
  379. .textarea-box {
  380. background: #f7f7f7;
  381. min-height: 120rpx;
  382. font-size: 28rpx;
  383. margin: 5% auto;
  384. padding: 4%;
  385. margin-bottom: 8%;
  386. }
  387. .submit-bth {
  388. width: 80%;
  389. height: 80rpx;
  390. line-height: 80rpx;
  391. background: #00A1B4!important;
  392. -webkit-box-shadow: 0 2rpx 16rpx 0 rgba(60,120,109,0.20);
  393. box-shadow: 0 2rpx 16rpx 0 rgba(60,120,109,0.20);
  394. border-radius: 50rpx;
  395. margin-bottom: 10%;
  396. font-size: 30rpx;
  397. }
  398. </style>