东风启辰小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
  1. // pages/myCenter/myCenter.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: app.globalData.urlStatic,//图片路径
  9. isAddress:false,
  10. placing:false,
  11. buyState:false,
  12. buyStateTime:"",
  13. isAgreement: true,//是否同意协议
  14. phoneInputShow: false,//是否显示电话输入框
  15. siteSelect: false,//是否显示位置选择框
  16. isLogin:false,//登录状态
  17. selectNow:0,//现在的选项
  18. taskNow:2,//现在的任务类型
  19. recordNow: 1,//现在的记录类型
  20. taskList: [],//任务列表
  21. shareFriendList:[],//星探小分队列表
  22. couponList:[],//卡券列表
  23. recordList:[],//获奖记录列表
  24. provinceArr: [],//省
  25. provinceValue: 0,//选中的省下标
  26. storeArr: [],//店铺
  27. storeValue: 0,//选中的店铺下标
  28. verificationCode: '获取验证码',//验证码文案
  29. sendCode: true,
  30. appointment: true,
  31. getFriendListState:false,
  32. couponListState:false,
  33. couponListCode:"",
  34. subscribeData: {
  35. realname: "",//姓名
  36. mobile: "",//手机号
  37. captcha: "",//验证码
  38. province: "",//省份
  39. agent_code: "",//经销商编码
  40. agentDetail: "",//经销商详细信息
  41. parentOpenid: app.globalData.parentOpenid,//好友openid
  42. },
  43. userData:{
  44. avatarUrl: null,
  45. nickName: null,
  46. userLevel: 1
  47. },
  48. descFrameShow:false,//是否显示奖品详情
  49. ruleShow: false,//是否显示星探等级规则
  50. // isRegister: false,//查询是否已注册
  51. parames:{
  52. page:1,
  53. count:20
  54. },
  55. parames2:{
  56. page:1,
  57. count:20
  58. },
  59. parames3:{
  60. page:1,
  61. count:20
  62. },
  63. noData:false,
  64. noData2:false,
  65. noData3:false,
  66. optionsData:null,
  67. lookDescId: null,
  68. agreement: false,//是否显示协议
  69. addressShow:false,
  70. mycenterTipWindow:0,
  71. barNums:0,
  72. getState:true,
  73. scoutRule:false,
  74. vipDetailShow:false,
  75. machineShow:false,
  76. upgradeShow:false,
  77. starMoveShow:false,
  78. lookPrizeDetail:false,
  79. lookIndex:null,
  80. buyStateCouponCode:"",
  81. testData:[
  82. {
  83. awardDetailPicContentHeight:0,
  84. awardName: "头等舱机票", //奖品名称
  85. awardPicurl:"https://xingb.venucia.com/award/10_1.png",//奖品小图
  86. couponCode: "我是卡号",//卡号
  87. couponSecret:"",//卡密
  88. dead_date:"",//有效期
  89. awardState: 1,
  90. cdate: "2020-03-23",
  91. awardId:1
  92. },
  93. {
  94. awardDetailPicContentHeight: 0,
  95. awardName: "小米扫地机器人", //奖品名称
  96. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  97. couponCode: "我是卡号",//卡号
  98. couponSecret:"我是卡密",//卡密
  99. dead_date:"我是有效期",//有效期
  100. awardState: 1,
  101. cdate: "2020-03-23",
  102. awardId: 2
  103. },
  104. {
  105. awardDetailPicContentHeight: 0,
  106. awardName: "索尼无线蓝牙耳机", //奖品名称
  107. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  108. couponCode: "我是卡号",//卡号
  109. couponSecret:"我是卡密",//卡密
  110. dead_date:"我是有效期",//有效期
  111. awardState: 1,
  112. cdate: "2020-03-23",
  113. awardId: 3
  114. },
  115. {
  116. awardDetailPicContentHeight: 0,
  117. awardName: "美的烤箱", //奖品名称
  118. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  119. couponCode: "我是卡号",//卡号
  120. couponSecret:"我是卡密",//卡密
  121. dead_date:"我是有效期",//有效期
  122. awardState: 1,
  123. cdate: "2020-03-23",
  124. awardId: 4
  125. },
  126. {
  127. awardDetailPicContentHeight: 0,
  128. awardName: "200元油卡", //奖品名称
  129. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  130. couponCode: "我是卡号",//卡号
  131. couponSecret:"我是卡密",//卡密
  132. dead_date:"我是有效期",//有效期
  133. awardState: 1,
  134. cdate: "2020-03-23",
  135. awardId: 5
  136. },
  137. {
  138. awardDetailPicContentHeight: 0,
  139. awardName: "100元京东E卡", //奖品名称
  140. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  141. couponCode: "我是卡号",//卡号
  142. couponSecret:"我是卡密",//卡密
  143. dead_date:"我是有效期",//有效期
  144. awardState: 1,
  145. cdate: "2020-03-23",
  146. awardId: 6,
  147. productId:2501
  148. },
  149. {
  150. awardDetailPicContentHeight: 0,
  151. awardName: "50元京东E卡", //奖品名称
  152. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  153. couponCode: "我是卡号",//卡号
  154. couponSecret:"",//卡密
  155. dead_date:"",//有效期
  156. awardState: 1,
  157. cdate: "2020-03-23",
  158. awardId: 7
  159. },
  160. {
  161. awardDetailPicContentHeight: 0,
  162. awardName: "网易云音乐vip月卡", //奖品名称
  163. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  164. couponCode: "我是卡号",//卡号
  165. couponSecret:"我是卡密",//卡密
  166. dead_date:"我是有效期",//有效期
  167. awardState: 1,
  168. cdate: "2020-03-23",
  169. awardId: 8
  170. },
  171. {
  172. awardDetailPicContentHeight: 0,
  173. awardName: "爱奇艺vip月卡", //奖品名称
  174. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  175. couponCode: "我是卡号",//卡号
  176. couponSecret:"我是卡密",//卡密
  177. dead_date:"我是有效期",//有效期
  178. awardState: 1,
  179. cdate: "2020-03-23",
  180. awardId: 9
  181. },
  182. {
  183. awardDetailPicContentHeight: 0,
  184. awardName: "腾讯会员vip月卡", //奖品名称
  185. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  186. couponCode: "我是卡号",//卡号
  187. couponSecret:"我是卡密",//卡密
  188. dead_date:"我是有效期",//有效期
  189. awardState: 1,
  190. cdate: "2020-03-23",
  191. awardId: 11
  192. },
  193. {
  194. awardDetailPicContentHeight: 0,
  195. awardName: "100元购车红包", //奖品名称
  196. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  197. couponCode: "我是卡号",//卡号
  198. couponSecret:"我是卡密",//卡密
  199. dead_date:"我是有效期",//有效期
  200. awardState: 1,
  201. cdate: "2020-03-23",
  202. awardId: 13
  203. },
  204. {
  205. awardDetailPicContentHeight: 0,
  206. awardName: "100元机油升级券", //奖品名称
  207. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  208. couponCode: "我是卡号",//卡号
  209. couponSecret:"我是卡密",//卡密
  210. dead_date:"我是有效期",//有效期
  211. awardState: 1,
  212. cdate: "2020-03-23",
  213. awardId: 14
  214. },
  215. {
  216. awardDetailPicContentHeight: 0,
  217. awardName: "500元现金", //奖品名称
  218. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  219. couponCode: "我是卡号",//卡号
  220. couponSecret:"我是卡密",//卡密
  221. dead_date:"我是有效期",//有效期
  222. awardState: 1,
  223. cdate: "2020-03-23",
  224. awardId: 16
  225. },
  226. {
  227. awardDetailPicContentHeight: 0,
  228. awardName: "1000元现金", //奖品名称
  229. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  230. couponCode: "我是卡号",//卡号
  231. couponSecret:"我是卡密",//卡密
  232. dead_date:"我是有效期",//有效期
  233. awardState: 1,
  234. cdate: "2020-03-23",
  235. awardId: 17
  236. },
  237. {
  238. awardDetailPicContentHeight: 0,
  239. awardName: "10元京东E卡", //奖品名称
  240. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  241. couponCode: "我是卡号",//卡号
  242. couponSecret:"我是卡密",//卡密
  243. dead_date:"我是有效期",//有效期
  244. awardState: 1,
  245. cdate: "2020-03-23",
  246. awardId: 18
  247. },
  248. ]
  249. },
  250. /**
  251. * 生命周期函数--监听页面加载
  252. */
  253. onLoad: function (options) {
  254. app.globalData.nowPage = 4;
  255. if (options.sourcePage){
  256. this.data.optionsData = options.sourcePage;
  257. }
  258. if (app.globalData.openid) {
  259. this.loadFun();
  260. } else {
  261. app.globalData.openidSuccessFuc = this.loadFun;
  262. }
  263. },
  264. loadFun: function () {
  265. if (!app.globalData.addPageEnterState.myCenter) {
  266. app.addPageEnter("BDAB6E93ECCD815EE83371E16EE42886");
  267. app.globalData.addPageEnterState.myCenter = true;
  268. }
  269. this.getUserInfo();
  270. this.getAddress();
  271. if (app.globalData.userMobile) {
  272. this.data.subscribeData.mobile = app.globalData.userMobile;
  273. this.setData({
  274. phoneInputShow: true,
  275. subscribeData: this.data.subscribeData
  276. })
  277. }
  278. if (app.globalData.myCenterData) {
  279. this.setData({
  280. provinceArr: app.globalData.myCenterData.provinceArr,
  281. storeArr: app.globalData.myCenterData.storeArr,
  282. provinceValue: app.globalData.myCenterData.provinceValue,
  283. storeValue: app.globalData.myCenterData.storeValue,
  284. // isRegister: app.globalData.isRegister
  285. })
  286. this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
  287. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  288. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  289. }
  290. // if (!app.globalData.isRegister) {
  291. // this.getOrderInfo();
  292. // }
  293. if (app.globalData.userInfoData) {
  294. if (app.globalData.userInfoData.avatarUrl){
  295. this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
  296. this.data.userData.nickName = app.globalData.userInfoData.nickName;
  297. this.data.userData.userLevel = app.globalData.userInfoData.userLevel;
  298. this.setData({
  299. isLogin: true,
  300. userData: this.data.userData
  301. })
  302. }
  303. }
  304. },
  305. /**
  306. * 生命周期函数--监听页面初次渲染完成
  307. */
  308. onReady: function () {
  309. },
  310. /**
  311. * 生命周期函数--监听页面显示
  312. */
  313. onShow: function () {
  314. if (app.globalData.getBuyState) {
  315. this.getBuyStates();
  316. } else {
  317. app.globalData.buyStateSuccessFuc = this.getBuyStates;
  318. }
  319. this.data.subscribeData.parentOpenid = app.globalData.parentOpenid;
  320. },
  321. getBuyStates: function () {
  322. this.setData({
  323. buyState: app.globalData.getBuyState.success,
  324. buyStateTime: app.globalData.getBuyState.cdate
  325. })
  326. },
  327. /**
  328. * 生命周期函数--监听页面隐藏
  329. */
  330. onHide: function () {
  331. },
  332. /**
  333. * 生命周期函数--监听页面卸载
  334. */
  335. onUnload: function () {
  336. },
  337. /**
  338. * 页面相关事件处理函数--监听用户下拉动作
  339. */
  340. onPullDownRefresh: function () {
  341. },
  342. /**
  343. * 页面上拉触底事件的处理函数
  344. */
  345. onReachBottom: function () {
  346. },
  347. /**
  348. * 用户点击右上角分享
  349. */
  350. onShareAppMessage: function () {
  351. return app.sharePack();
  352. },
  353. selectChange:function(e){
  354. this.setData({
  355. selectNow: e.currentTarget.dataset.value
  356. })
  357. if (e.currentTarget.dataset.value == 1) {
  358. this.getFriendBuCarNum();
  359. } else if (e.currentTarget.dataset.value == 2) {
  360. this.data.parames2.page = 1;
  361. this.data.noData2 = false;
  362. this.setData({
  363. recordList:[]
  364. })
  365. this.getMyAwardList();
  366. } else if (e.currentTarget.dataset.value == 3){
  367. this.data.parames.page = 1;
  368. this.data.noData = false;
  369. this.setData({
  370. parames: this.data.parames,
  371. shareFriendList:[]
  372. })
  373. this.getShareList();
  374. }else if(e.currentTarget.dataset.value == 4){
  375. this.data.parames3.page = 1;
  376. this.data.noData3 = false;
  377. this.setData({
  378. couponList:[]
  379. })
  380. this.getMyCouponList();
  381. }
  382. },
  383. getMyCouponList:function(){//获取我的卡包
  384. this.setData({
  385. couponListState: true
  386. })
  387. wx.showLoading({
  388. title: '获取数据中'
  389. })
  390. app.wxRequest(app.globalData.urlRoot +"/bag/getMyCouponList",this.data.parames3,res=>{
  391. wx.hideLoading();
  392. if(res.code==200){
  393. if(res.data){
  394. for(let i=0;i<res.data.list.length;i++){
  395. this.data.couponList.push(res.data.list[i]);
  396. }
  397. this.setData({
  398. couponList: this.data.couponList
  399. })
  400. if (res.data.list.length<this.data.parames3.count){
  401. this.setData({
  402. noData3: true
  403. })
  404. }
  405. }
  406. }
  407. this.setData({
  408. couponListState: false
  409. })
  410. },this);
  411. },
  412. selectTask: function (e) {
  413. this.setData({
  414. taskNow: e.currentTarget.dataset.type
  415. })
  416. if (this.data.taskNow==2){
  417. this.getFriendBuCarNum();
  418. }
  419. },
  420. getFriendBuCarNum:function(){
  421. app.wxRequest(app.globalData.urlRoot +"/share/getFriendBuCarNum",{},res=>{
  422. if(res.code==200){
  423. this.setData({
  424. barNums: res.data.total
  425. })
  426. }
  427. },this);
  428. },
  429. selectRecord: function (e) {
  430. if (this.data.recordNow == e.currentTarget.dataset.type) {
  431. return;
  432. }
  433. this.setData({
  434. recordList:[],
  435. recordNow: e.currentTarget.dataset.type
  436. })
  437. this.data.parames2.page = 1;
  438. this.data.noData2 = false;
  439. this.getMyAwardList();
  440. },
  441. getUserLocation: function (e) {
  442. wx.getLocation({
  443. type: 'gcj02', //wgs84
  444. success: (res) => {
  445. this.getDistributorList(res.longitude, res.latitude);
  446. },
  447. fail: (res) => {
  448. this.getDistributorList("", "");
  449. },
  450. complete: (res) => {
  451. this.setData({
  452. siteSelect: true,
  453. })
  454. }
  455. })
  456. },
  457. getDistributorList: function (longitude, latitude) {//获取经销商列表
  458. app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude }, res => {
  459. if (res.code == 200) {
  460. app.globalData.myCenterData = {};
  461. this.setData({
  462. provinceArr: res.data.list,
  463. storeArr: res.data.list[res.data.nearData.provinceIndex].children,
  464. provinceValue: res.data.nearData.provinceIndex,
  465. storeValue: res.data.nearData.cityIndex
  466. })
  467. this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
  468. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  469. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  470. app.globalData.myCenterData.provinceArr = res.data.list;
  471. app.globalData.myCenterData.storeArr = res.data.list[res.data.nearData.provinceIndex].children;
  472. app.globalData.myCenterData.provinceValue = res.data.nearData.provinceIndex;
  473. app.globalData.myCenterData.storeValue = res.data.nearData.cityIndex;
  474. } else {
  475. wx.showToast({
  476. title: res.msg,
  477. icon: "none"
  478. })
  479. }
  480. }, this);
  481. },
  482. provinceChane: function (e) {//选中省
  483. this.setData({
  484. provinceValue: e.detail.value,
  485. storeArr: this.data.provinceArr[e.detail.value].children,
  486. storeValue: 0
  487. })
  488. this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
  489. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  490. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  491. },
  492. storeChane: function (e) {//选中店铺
  493. this.setData({
  494. storeValue: e.detail.value,
  495. })
  496. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  497. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  498. },
  499. getCode: function (e) {//获取验证码
  500. if (!app.mobileVerify(this.data.subscribeData.mobile)) {
  501. if (this.data.subscribeData.mobile) {
  502. wx.showToast({
  503. title: '请输入正确的电话',
  504. icon: 'none'
  505. })
  506. } else {
  507. wx.showToast({
  508. title: '请输入电话',
  509. icon: 'none'
  510. })
  511. }
  512. return;
  513. }
  514. if (!this.data.sendCode) {
  515. return;
  516. }
  517. this.data.sendCode = false;
  518. app.wxRequest(app.globalData.urlRoot + "captcha/sendCaptcha", { mobile: this.data.subscribeData.mobile }, res => {
  519. if (res.code == 200) {
  520. this.countDown();
  521. wx.showToast({
  522. title: '验证码获取成功',
  523. icon: "none"
  524. })
  525. this.setData({
  526. verificationCode: 60
  527. })
  528. } else {
  529. this.data.sendCode = true;
  530. wx.showToast({
  531. title: res.msg,
  532. icon: "none"
  533. })
  534. }
  535. }, this)
  536. },
  537. countDown: function () {//倒计时
  538. setTimeout(() => {
  539. this.setData({
  540. verificationCode: this.data.verificationCode - 1
  541. })
  542. if (this.data.verificationCode > 0) {
  543. this.countDown();
  544. } else {
  545. this.setData({
  546. verificationCode: "获取验证码"
  547. })
  548. this.data.sendCode = true;
  549. }
  550. }, 1000);
  551. },
  552. getRealname: function (e) {//获取用户输入的姓名
  553. this.data.subscribeData.realname = e.detail.value;
  554. },
  555. getMobile: function (e) {//获取用户输入的电话
  556. this.data.subscribeData.mobile = e.detail.value;
  557. },
  558. getCaptcha: function (e) {//获取用户输入的验证码
  559. this.data.subscribeData.captcha = e.detail.value;
  560. },
  561. subscribeFun: function (e) {//预约鉴赏
  562. if(!this.data.subscribeData.realname){
  563. wx.showToast({
  564. title: '请输入姓名',
  565. icon:"none"
  566. })
  567. return;
  568. }
  569. if (!this.data.subscribeData.mobile) {
  570. wx.showToast({
  571. title: '请输入电话',
  572. icon: "none"
  573. })
  574. return;
  575. }
  576. if (!this.data.subscribeData.captcha) {
  577. wx.showToast({
  578. title: '请输入验证码',
  579. icon: "none"
  580. })
  581. return;
  582. }
  583. if (!this.data.isAgreement) {
  584. wx.showToast({
  585. title: '请同意协议',
  586. icon: 'none'
  587. })
  588. return;
  589. }
  590. if (!this.data.appointment) {
  591. return;
  592. }
  593. this.data.appointment = false;
  594. app.wxRequest(app.globalData.urlRoot + "userInfo/submitOrderInfo", this.data.subscribeData, res => {
  595. this.data.appointment = true;
  596. if (res.code == 200) {
  597. wx.showToast({
  598. title: '预约成功'
  599. })
  600. this.data.subscribeData.realname = "";
  601. this.data.subscribeData.captcha = "";
  602. this.setData({
  603. subscribeData: this.data.subscribeData,
  604. verificationCode: '获取验证码',
  605. })
  606. this.setData({
  607. siteSelect: false
  608. })
  609. // this.setData({
  610. // isRegister: true
  611. // })
  612. // app.globalData.isRegister = true;
  613. app.globalData.userMobile = this.data.subscribeData.mobile;
  614. } else {
  615. wx.showToast({
  616. title: res.msg,
  617. icon: "none"
  618. })
  619. }
  620. }, this, "POST")
  621. },
  622. getUserWxMsg:function(e){//通过微信获取用户信息
  623. if (e.detail.errMsg == "getUserInfo:ok") {
  624. this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
  625. this.data.userData.nickName = e.detail.userInfo.nickName;
  626. this.setData({
  627. userData: this.data.userData,
  628. isLogin: true
  629. })
  630. app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
  631. }
  632. },
  633. getUserInfo:function(e){//获取个人信息
  634. app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
  635. if (res.code == 200) {
  636. if (res.data && res.data.avatarUrl) {
  637. if (!app.globalData.userInfoData.nickName) {
  638. this.data.userData.avatarUrl = res.data.avatarUrl;
  639. this.data.userData.nickName = res.data.nickName;
  640. this.data.userData.userLevel = res.data.userLevel;
  641. app.globalData.userInfoData = {};
  642. app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
  643. app.globalData.userInfoData.nickName = res.data.nickName;
  644. app.globalData.userInfoData.userLevel = res.data.userLevel;
  645. wx.setStorageSync('userInfoData', {
  646. avatarUrl: res.data.avatarUrl,
  647. nickName: res.data.nickName,
  648. userLevel: res.data.userLevel,
  649. })
  650. } else if (app.globalData.userInfoData.nickName){
  651. if (app.globalData.userInfoData.userLevel != res.data.userLevel) {
  652. this.data.userData.userLevel = res.data.userLevel;
  653. app.globalData.userInfoData.userLevel = res.data.userLevel;
  654. wx.setStorageSync('userInfoData', app.globalData.userInfoData);
  655. }
  656. if (app.globalData.userInfoData.avatarUrl != res.data.avatarUrl) {
  657. this.data.userData.avatarUrl = res.data.avatarUrl;
  658. app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
  659. wx.setStorageSync('userInfoData', app.globalData.userInfoData);
  660. }
  661. if (app.globalData.userInfoData.nickName != res.data.nickName) {
  662. this.data.userData.nickName = res.data.nickName;
  663. app.globalData.userInfoData.nickName = res.data.nickName;
  664. wx.setStorageSync('userInfoData', app.globalData.userInfoData);
  665. }
  666. }
  667. this.setData({
  668. userData: this.data.userData
  669. })
  670. if (app.globalData.userInfoData.nickName){
  671. this.setData({
  672. isLogin: true
  673. })
  674. }
  675. }
  676. }
  677. },this)
  678. },
  679. getTaskProgress: function () {//获取任务完成度 1每日任务
  680. app.wxRequest(app.globalData.urlRoot + "task/getTaskProgress", { taskType: this.data.taskNow},res=>{
  681. if(res.code==200){
  682. if(res.data){
  683. for (let i = 0; i < res.data.taskData.length; i++) {
  684. res.data.taskData[i]['unlockNum'] = 0;
  685. for (let j = 0; j < res.data.taskData[i].childIdArr.length; j++) {
  686. if (res.data.taskData[i].childIdArr[j]) {
  687. res.data.taskData[i]['unlockNum'] += 1;
  688. }
  689. }
  690. }
  691. this.setData({
  692. taskList: res.data.taskData
  693. })
  694. }
  695. }
  696. },this)
  697. },
  698. lookDesc:function(e){//查看奖品详情
  699. var index = e.currentTarget.dataset.index;
  700. if (this.data.lookPrizeDetail) {
  701. this.setData({
  702. lookPrizeDetail: !this.data.lookPrizeDetail
  703. })
  704. return;
  705. }
  706. if (this.data.recordList[index].awardState == 0 && !this.data.isAddress){
  707. this.setData({
  708. mycenterTipWindow:1,
  709. })
  710. } else if(this.data.recordList[index].awardState == 0 && this.data.isAddress){
  711. wx.showToast({
  712. title:"购车成功后可用",
  713. icon:"none"
  714. })
  715. }else {
  716. this.setData({
  717. lookIndex: (index || index == 0) ? this.data.recordList[index] : null,
  718. lookPrizeDetail: !this.data.lookPrizeDetail
  719. })
  720. }
  721. },
  722. lookRule: function (e) {//查看奖品详情
  723. this.setData({
  724. ruleShow: e.currentTarget.dataset.value
  725. })
  726. },
  727. getShareList: function () {//星探小分队
  728. this.setData({
  729. getFriendListState: true
  730. })
  731. wx.showLoading({
  732. title: '获取数据中'
  733. })
  734. app.wxRequest(app.globalData.urlRoot + "share/getFriendRegisterList", this.data.parames,res=>{
  735. wx.hideLoading();
  736. if(res.code==200){
  737. for(let i=0;i<res.data.length;i++){
  738. this.data.shareFriendList.push(res.data[i]);
  739. }
  740. this.setData({
  741. shareFriendList: this.data.shareFriendList
  742. })
  743. if (res.data.length<this.data.parames.count){
  744. this.setData({
  745. noData: true
  746. })
  747. }
  748. }
  749. this.setData({
  750. getFriendListState: false
  751. })
  752. },this);
  753. },
  754. getOrderInfo: function () {//查询是否已注册
  755. app.wxRequest(app.globalData.urlRoot + "userInfo/getOrderInfo", {}, res => {
  756. if (res.code == 200) {
  757. if (res.data) {
  758. this.setData({
  759. isRegister: true
  760. })
  761. app.globalData.isRegister = true;
  762. app.globalData.userMobile = res.data.mobile;
  763. } else {
  764. if (app.globalData.userMobile) {
  765. this.data.subscribeData.mobile = app.globalData.userMobile;
  766. this.setData({
  767. phoneInputShow: true,
  768. subscribeData: this.data.subscribeData
  769. })
  770. }
  771. }
  772. } else {
  773. console.log(res.msg)
  774. }
  775. }, this);
  776. },
  777. scrolltolower:function(){//星探小分队滚动条触底时执行
  778. if(!this.data.noData){
  779. this.data.parames.page+=1;
  780. this.getShareList();
  781. }
  782. },
  783. scrolltolower2:function(){
  784. if(!this.data.noData2){
  785. this.data.parames2.page+=1;
  786. this.getMyAwardList();
  787. }
  788. },
  789. scrolltolower3:function(){
  790. if(!this.data.noData3){
  791. this.data.parames3.page+=1;
  792. this.getMyCouponList();
  793. }
  794. },
  795. getMyAwardList: function () {//获取获奖记录
  796. this.setData({
  797. getState:true
  798. })
  799. wx.showLoading({
  800. title: '获取数据中'
  801. })
  802. this.data.parames2.awardSource = this.data.recordNow;
  803. app.wxRequest(app.globalData.urlRoot + "award/getMyAwardList", this.data.parames2, res => {
  804. wx.hideLoading();
  805. if(res.code == 200){
  806. // res.data[0].awardState = 0;
  807. // res.data = this.data.testData;
  808. // res.data = [{
  809. // awardDetailPicurl:"https://xingb.venucia.com/award/14_2.png",
  810. // awardId:14,
  811. // awardName:"100元机油升级券",
  812. // awardPicurl:"https://xingb.venucia.com/award/14_1.png",
  813. // awardState:1,
  814. // awardType:2,
  815. // cdate:"2020-04-01",
  816. // couponCode:"450610985",
  817. // productId:0
  818. // }]
  819. // if(this.data.parames2.page<3){
  820. // for(let i=0;i<20;i++){
  821. // res.data.push(res.data[0])
  822. // }
  823. // }
  824. for(let i=0;i<res.data.length;i++){
  825. this.data.recordList.push(res.data[i]);
  826. }
  827. this.setData({
  828. recordList: this.data.recordList
  829. })
  830. if (res.data.length<this.data.parames2.count){
  831. this.setData({
  832. noData2: true
  833. })
  834. }
  835. }
  836. this.setData({
  837. getState: false
  838. })
  839. },this)
  840. },
  841. getUserPhone: function (e) {//获取用户手机号
  842. this.setData({
  843. phoneInputShow: true
  844. })
  845. if (e.detail.errMsg == 'getPhoneNumber:ok') {
  846. app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
  847. if (res.code == 200) {
  848. if (res.data && res.data.decodeData){
  849. this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
  850. this.setData({
  851. subscribeData: this.data.subscribeData
  852. })
  853. }
  854. } else {
  855. wx.showToast({
  856. title: res.msg,
  857. icon: "none"
  858. })
  859. }
  860. }, this);
  861. }
  862. },
  863. addressControl: function () {//跳转到地址管理
  864. if (app.globalData.userInfoData.nickName) {
  865. this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
  866. this.data.userData.nickName = app.globalData.userInfoData.nickName;
  867. this.setData({
  868. userData: this.data.userData
  869. })
  870. }
  871. this.setData({
  872. addressShow:!this.data.addressShow,
  873. mycenterTipWindow:0
  874. })
  875. if (!this.data.isAddress){
  876. this.getAddress();
  877. }
  878. if(this.data.selectNow==2 && this.data.recordNow == 1 && !this.data.addressShow){
  879. this.data.parames2.page = 1;
  880. this.data.noData2 = false;
  881. this.setData({
  882. recordList:[]
  883. })
  884. this.getMyAwardList();
  885. }
  886. if(this.data.selectNow==4 && this.data.couponList.length && !this.data.addressShow){
  887. this.data.parames3.page = 1;
  888. this.data.noData3 = false;
  889. this.setData({
  890. couponList:[]
  891. })
  892. this.getMyCouponList();
  893. }
  894. },
  895. agreementState: function () {//协议
  896. this.setData({
  897. isAgreement: !this.data.isAgreement
  898. })
  899. },
  900. agreementControl: function () {
  901. this.setData({
  902. agreement: !this.data.agreement
  903. })
  904. },
  905. lookMore:function(){
  906. wx.navigateTo({
  907. url: '/pages/moreType/moreType',
  908. })
  909. },
  910. showSite: function () {//显示地址选择框
  911. if (!this.data.siteSelect) {
  912. if (!app.globalData.myCenterData) {
  913. this.getUserLocation();//获取用户当前位置
  914. }else{
  915. this.setData({
  916. siteSelect:true
  917. })
  918. }
  919. }
  920. },
  921. placingControl: function () {
  922. if (app.globalData.getBuyState.success != this.data.buyState) {
  923. this.setData({
  924. buyState: app.globalData.getBuyState.success,
  925. buyStateTime: app.globalData.getBuyState.cdate
  926. })
  927. }
  928. this.setData({
  929. placing: !this.data.placing
  930. })
  931. },
  932. scoutRuleControl:function(){
  933. this.setData({
  934. scoutRule: !this.data.scoutRule
  935. })
  936. },
  937. tipWindow:function(){
  938. this.setData({
  939. mycenterTipWindow:0
  940. })
  941. },
  942. lookAddress:function(){
  943. this.addressControl();
  944. },
  945. copyExchangeCode:function(){
  946. var text = this.data.recordList[this.data.lookDescId].couponCode || this.data.recordList[this.data.lookDescId].productCode || "";
  947. this.contentCopy(text);
  948. },
  949. contentCopy:function(text){//内容复制
  950. wx.setClipboardData({
  951. data: text
  952. })
  953. },
  954. getAddress: function () {//获取地址
  955. app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => {
  956. if (res.code == 200) {
  957. if (res.data) {
  958. this.data.isAddress = true;
  959. this.setData({
  960. mycenterTipWindow:0
  961. })
  962. }
  963. } else {
  964. wx.showToast({
  965. title: res.msg,
  966. icon: "none"
  967. })
  968. }
  969. }, this);
  970. },
  971. starGo:function(){//去完成
  972. wx.reLaunch({
  973. url: '/pages/star/star',
  974. })
  975. },
  976. enterLucky:function(){
  977. wx.reLaunch({
  978. url: '/pages/luckyStar/luckyStar',
  979. })
  980. },
  981. enterEvery:function(){
  982. wx.navigateTo({
  983. url: '/pages/everyday/everyday',
  984. })
  985. },
  986. vipDetailControl:function(e){
  987. var index = e.currentTarget.dataset.index;
  988. if (!this.data.couponList[index].addressState){
  989. this.setData({
  990. mycenterTipWindow:1,
  991. })
  992. return;
  993. }
  994. this.setData({
  995. couponListCode:this.data.couponList[index].couponCode?this.data.couponList[index].couponCode:""
  996. })
  997. if(this.data.couponList[index].couponId=="175978"){
  998. this.vipDetailHide();
  999. }else if(this.data.couponList[index].couponId=="171748"){
  1000. this.machineHide();
  1001. }else if(this.data.couponList[index].couponId=="177275"){
  1002. this.upgradeHide();
  1003. }else if(this.data.couponList[index].couponId=="179478"){
  1004. this.starMoveHide();
  1005. }
  1006. },
  1007. vipDetailHide:function(){
  1008. this.setData({
  1009. vipDetailShow:!this.data.vipDetailShow
  1010. })
  1011. },
  1012. machineHide:function(){
  1013. this.setData({
  1014. machineShow:!this.data.machineShow
  1015. })
  1016. },
  1017. upgradeHide:function(){
  1018. this.setData({
  1019. upgradeShow:!this.data.upgradeShow
  1020. })
  1021. },
  1022. starMoveHide:function(){
  1023. this.setData({
  1024. starMoveShow:!this.data.starMoveShow
  1025. })
  1026. },
  1027. cardCodeCopy:function(){
  1028. this.contentCopy(this.data.couponListCode);
  1029. },
  1030. lookOrder:function(){//跳转到智趣启辰小程序的订单页面
  1031. console.log("小程序跳转");
  1032. wx.navigateToMiniProgram({
  1033. appId:'wx1d585c8c2fffe589',
  1034. path:"/pages/carorder_info/carorder_info",
  1035. success(res) {
  1036. // 打开成功
  1037. },
  1038. complete(res){
  1039. console.log(res);
  1040. }
  1041. })
  1042. }
  1043. })