index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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">
  74. <textarea auto-height placeholder="请输入详细地址" />
  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. }
  111. },
  112. onLoad(option) {
  113. //this.getDetailInfo(option.detailId);
  114. },
  115. onShow() {
  116. },
  117. // onShareAppMessage() {
  118. // return {
  119. // title: '分销小助手',
  120. // path:'/pages/index/index?scene=' + getApp().globalData.user_id
  121. // }
  122. // },
  123. methods: {
  124. addresspick(obj) {
  125. console.log(obj)
  126. this.addressObj = obj;
  127. this.txt = obj.province.name + obj.city.name;
  128. },
  129. radioCheck(e){
  130. console.log(e.target.value)
  131. this.userSex = e.target.value;
  132. //this.gender = e.target.value == '0' ? '男' : '女';
  133. },
  134. changeCity(data) {
  135. this.txt = data.data.join('')
  136. console.log(data.data.join(''))
  137. },
  138. formSubmit(e) {
  139. //将下列代码加入到对应的检查位置
  140. //定义表单规则
  141. var rule = [
  142. {
  143. name: "selfName",
  144. checkType: "notnull",
  145. errorMsg: "姓名不能为空"
  146. },
  147. {
  148. name: "dealerName",
  149. checkType: "notnull",
  150. errorMsg: "经销商姓名不能为空"
  151. },
  152. ];
  153. //进行表单检查
  154. var formData = e.detail.value;
  155. var checkRes = graceChecker.check(formData, rule);
  156. if (checkRes) {
  157. this.txt === '请选择' ?
  158. uni.showToast({
  159. title: '请选择地区',
  160. icon: "none"
  161. }):
  162. this.submitRequest(formData);
  163. } else {
  164. uni.showToast({
  165. title: graceChecker.error,
  166. icon: "none"
  167. });
  168. }
  169. },
  170. submitRequest(params){
  171. console.log(params)
  172. let that = this;
  173. uni.request({
  174. url:getApp().globalData.shareUrl, //需要设置为全局
  175. method: 'POST',
  176. header: {
  177. 'content-type': 'application/x-www-form-urlencoded'
  178. },
  179. data: {
  180. method: 'jxs_guest_login',
  181. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  182. sign: md5('jxs_guest_login' + getApp().globalData.globalTimestamp),
  183. phone:getApp().globalData.userPhone,
  184. wxopenid:getApp().globalData.openId,
  185. name:params.selfName,
  186. sex:that.userSex,//0-女 1-男
  187. province:that.addressObj.province.id,//省份id
  188. city:that.addressObj.city.id,//城市id
  189. jxs_name:params.dealerName,
  190. },
  191. success: res => {
  192. console.log(res)
  193. if(res.data.code === 200){
  194. that.loginObj = res.data.msg;
  195. getApp().globalData.userCodeNumber = that.loginObj.code;
  196. getApp().globalData.managerPhone = that.loginObj.qyjl_phone;
  197. getApp().globalData.managerName = that.loginObj.qyjl_name;
  198. getApp().globalData.addTime = that.loginObj.addtime;
  199. this.goCustomCardPage(that.loginObj.pass)
  200. }
  201. else {
  202. uni.showToast({
  203. title: res.data.msg,
  204. icon: 'none'
  205. });
  206. }
  207. }
  208. });
  209. },
  210. goCustomCardPage(type){
  211. type === 1 ?
  212. uni.redirectTo({
  213. url: '/pages/index/successPage/index?types='+'dealer', //经销商成功页面
  214. success: res => {},
  215. fail: () => {},
  216. complete: () => {}
  217. }):
  218. uni.redirectTo({
  219. url: '/pages/index/failPage/index', //失败页面
  220. success: res => {},
  221. fail: () => {},
  222. complete: () => {}
  223. });
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="scss" scoped>
  229. .content {
  230. &_list{
  231. display: flex;
  232. flex-direction: row;
  233. align-items: center;
  234. justify-content:space-around;
  235. &_lable{
  236. }
  237. &_content{
  238. flex: 1;
  239. width: auto;
  240. text-align: right;
  241. }
  242. }
  243. }
  244. .content-box {
  245. width: 100%;
  246. /* height: 100%; */
  247. display: flex;
  248. flex-direction: column;
  249. align-items: center;
  250. /* justify-content: center; */
  251. }
  252. .header-box {
  253. width: 85%;
  254. height:80rpx;
  255. border: .5px dotted #00A1B4;
  256. border-radius: 50rpx;
  257. display: flex;
  258. justify-content: center;
  259. align-items: center;
  260. font-size: 24rpx;
  261. color:#00A1B4 ;
  262. /* font-family: PingFangSC-Regular; */
  263. margin-top: 2%;
  264. }
  265. .header-box image {
  266. width: 36rpx;
  267. height: 36rpx;
  268. margin-right: 1%;
  269. }
  270. .self-title-box {
  271. width: 90%;
  272. display: flex;
  273. align-items: center;
  274. font-size: 32rpx;
  275. letter-spacing: 2rpx;
  276. color:#3C3C3C ;
  277. /* font-family: SimHei; */
  278. margin: 4% auto;
  279. font-weight: bold;
  280. height: 50rpx;
  281. line-height: 50rpx;
  282. }
  283. .self-title-box image {
  284. width: 6rpx;
  285. height: 32rpx;
  286. margin-right: 2%;
  287. }
  288. .info-box {
  289. width: 90%;
  290. margin: 3% auto;
  291. height: 180rpx;
  292. border-bottom: 1px solid #f7f7f7;
  293. }
  294. .info-title-box {
  295. width: 100%;
  296. display: flex;
  297. align-items: center;
  298. font-size: 28rpx;
  299. height: 50rpx;
  300. line-height: 50rpx;
  301. }
  302. .info-title-box image{
  303. width: 15rpx;
  304. height: 15rpx;
  305. margin-right: 2%;
  306. }
  307. .info-value-box input {
  308. height: 88rpx;
  309. background: #f7f7f7;
  310. font-size: 28rpx;
  311. padding-left: 4%;
  312. margin: 2% auto;
  313. }
  314. .info-gender-box {
  315. margin: 3% auto;
  316. font-size: 28rpx;
  317. }
  318. .form-radio {
  319. transform: scale(0.6);
  320. }
  321. .padding-left-2 {
  322. padding-left: 2%;
  323. }
  324. .margin-right-10 {
  325. margin-right: 10%;
  326. }
  327. .border-line-box {
  328. width: 100%;
  329. height: 20rpx;
  330. background: #f7f7f7;
  331. }
  332. .picker-box{
  333. display: flex;
  334. align-items: center;
  335. justify-content: space-between;
  336. height: 60rpx;
  337. line-height: 60rpx;
  338. background: #f7f7f7;
  339. height: 88rpx;
  340. line-height: 88rpx;
  341. background: #f7f7f7;
  342. font-size: 28rpx;
  343. padding-left: 4%;
  344. }
  345. .uni-input image {
  346. width: 40rpx;
  347. height: 40rpx;
  348. margin-right: 2%;
  349. float: right;
  350. }
  351. .textarea-box {
  352. background: #f7f7f7;
  353. min-height: 120rpx;
  354. font-size: 28rpx;
  355. margin: 5% auto;
  356. padding: 4%;
  357. margin-bottom: 8%;
  358. }
  359. .submit-bth {
  360. width: 80%;
  361. height: 80rpx;
  362. line-height: 80rpx;
  363. background: #00A1B4!important;
  364. -webkit-box-shadow: 0 2rpx 16rpx 0 rgba(60,120,109,0.20);
  365. box-shadow: 0 2rpx 16rpx 0 rgba(60,120,109,0.20);
  366. border-radius: 50rpx;
  367. margin-bottom: 10%;
  368. font-size: 30rpx;
  369. }
  370. </style>