东风启辰小程序端
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

supplement.js 6.9KB

5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
5 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. // pages/supplement/supplement.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: app.globalData.urlStatic,//图片路径
  9. agreement: false,
  10. isAgreement: true,//是否同意协议
  11. jobList:[],
  12. jobValue:0,
  13. provinceDataAll: null,//地区所有数据
  14. provinceDataArr: [[""], [""]],//省市数据
  15. provinceDataValue: [0, 0],//选中的省市下标
  16. nowProvince: "",//选中的省市文字
  17. storeArr: [],//专营店数据
  18. storeValue: 0,//选中的专营店下标
  19. realname:"",
  20. jobDetail:""
  21. },
  22. /**
  23. * 生命周期函数--监听页面加载
  24. */
  25. onLoad: function (options) {
  26. app.globalData.nowPage = 2;
  27. if (app.globalData.openid) {
  28. this.loadFun();
  29. } else {
  30. app.globalData.openidSuccessFuc = this.loadFun;
  31. }
  32. },
  33. loadFun:function(){
  34. // this.getJobList();
  35. this.getUserLocation();
  36. var authenticationStatus = app.globalData.authenticationStatus;
  37. if (authenticationStatus && authenticationStatus.realName){
  38. this.setData({
  39. realname: authenticationStatus.realName
  40. })
  41. }
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload: function () {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh: function () {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom: function () {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage: function () {
  77. },
  78. agreementState: function () {//协议
  79. this.setData({
  80. isAgreement: !this.data.isAgreement
  81. })
  82. },
  83. agreementControl: function () {
  84. this.setData({
  85. agreement: !this.data.agreement
  86. })
  87. },
  88. getJobList:function(){
  89. app.wxRequest(app.globalData.urlRoot + "userInfo/getJobList", {}, res => {
  90. if(res.code==200){
  91. this.setData({
  92. jobList:res.data
  93. })
  94. var authenticationStatus = app.globalData.authenticationStatus;
  95. if (authenticationStatus && authenticationStatus.jobId) {
  96. for(let i=0;i<res.data.length;i++){
  97. if (res.data[i].jobId == authenticationStatus.jobId){
  98. this.setData({
  99. jobValue: i,
  100. jobDetail: res.data[i].jobDetail
  101. })
  102. break;
  103. }
  104. }
  105. }
  106. }
  107. },this)
  108. },
  109. jobChange:function(e){
  110. this.setData({
  111. jobValue:e.detail.value
  112. })
  113. },
  114. getUserLocation: function (e) {
  115. wx.getLocation({
  116. type: 'gcj02', //wgs84
  117. success: (res) => {
  118. this.getDistributorList(res.longitude, res.latitude);
  119. },
  120. fail: (res) => {
  121. this.getDistributorList("", "");
  122. }
  123. })
  124. },
  125. getDistributorList: function (longitude, latitude) {//获取经销商列表
  126. app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude}, res => {
  127. if (res.code == 200) {
  128. //整理数据
  129. var datas = res.data;
  130. var province = [];
  131. var city = [];
  132. for (let i = 0; i < res.data.list.length; i++) {
  133. province.push(res.data.list[i].province);
  134. }
  135. for (let j = 0; j < res.data.list[res.data.nearData.provinceIndex].children.length; j++) {
  136. city.push(res.data.list[res.data.nearData.provinceIndex].children[j].city)
  137. }
  138. //将数据赋值给变量
  139. this.setData({
  140. provinceDataAll: res.data.list,
  141. provinceDataArr: [province, city],
  142. provinceDataValue: [res.data.nearData.provinceIndex, res.data.nearData.cityIndex],
  143. nowProvince: province[res.data.nearData.provinceIndex] + " " + city[res.data.nearData.cityIndex],
  144. storeArr: res.data.list[res.data.nearData.provinceIndex].children[res.data.nearData.cityIndex].children,
  145. storeValue: res.data.nearData.agentIndex
  146. })
  147. } else {
  148. wx.showToast({
  149. title: res.msg,
  150. icon: "none"
  151. })
  152. }
  153. }, this);
  154. },
  155. getRealname: function (e) {//获取用户输入的姓名
  156. this.data.realname = e.detail.value;
  157. },
  158. getJobDetail: function (e) {//获取用户输入的姓名
  159. this.data.jobDetail = e.detail.value;
  160. },
  161. submitMsg: function () {
  162. if(!this.data.realname){
  163. wx.showToast({
  164. title: '请输入姓名',
  165. icon:'none'
  166. })
  167. return;
  168. }
  169. if (!this.data.jobDetail) {
  170. wx.showToast({
  171. title: '请输入职业',
  172. icon: 'none'
  173. })
  174. return;
  175. }
  176. if (!this.data.isAgreement) {
  177. wx.showToast({
  178. title: '请同意协议',
  179. icon: 'none'
  180. })
  181. return;
  182. }
  183. var data = {
  184. realName:this.data.realname,
  185. // jobId: this.data.jobList[this.data.jobValue].jobId,
  186. jobDetail: this.data.jobDetail,
  187. agentDetail: this.data.storeArr[this.data.storeValue]['agent_detail'],
  188. agentCode: this.data.storeArr[this.data.storeValue]['agent_code'],
  189. city: this.data.provinceDataArr[1][this.data.provinceDataValue[1]],
  190. province: this.data.provinceDataArr[0][this.data.provinceDataValue[0]]
  191. }
  192. app.wxRequest(app.globalData.urlRoot + "certificationInfo/submitCertificationInfoData", data,res=>{
  193. if (res.code == 200) {
  194. if (!app.globalData.authenticationStatus) {
  195. app.globalData.authenticationStatus = {};
  196. }
  197. app.globalData.authenticationStatus.realName = this.data.realname
  198. app.globalData.authenticationStatus.jobDetail = this.data.storeArr[this.data.storeValue]['agent_detail']
  199. app.globalData.authenticationStatus.city = data.city
  200. app.globalData.authenticationStatus.agentDetail = data.agentDetail
  201. // wx.navigateBack({
  202. // delta: 1,
  203. // })
  204. wx.redirectTo({
  205. url: '../poster/poster',
  206. })
  207. }else{
  208. wx.showToast({
  209. title: res.msg,
  210. icon:'none'
  211. })
  212. }
  213. },this,"POST");
  214. },
  215. provinceDataChange: function (e) {
  216. if (e.detail.column == 0) {
  217. var city = [];
  218. for (let i = 0; i < this.data.provinceDataAll[e.detail.value].children.length; i++) {
  219. city.push(this.data.provinceDataAll[e.detail.value].children[i].city);
  220. }
  221. this.data.provinceDataArr[1] = city;
  222. this.setData({
  223. provinceDataArr: this.data.provinceDataArr
  224. })
  225. }
  226. },
  227. provinceDataChane: function (e) {
  228. this.setData({
  229. provinceDataValue: e.detail.value,
  230. nowProvince: this.data.provinceDataArr[0][e.detail.value[0]] + " " + this.data.provinceDataArr[1][e.detail.value[1]],
  231. storeArr: this.data.provinceDataAll[e.detail.value[0]].children[e.detail.value[1]].children,
  232. storeValue: 0
  233. })
  234. },
  235. storeChane: function (e) {//选中店铺
  236. this.setData({
  237. storeValue: e.detail.value,
  238. })
  239. }
  240. })