东风启辰小程序端
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 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  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. recordList:[],//获奖记录列表
  23. provinceArr: [],//省
  24. provinceValue: 0,//选中的省下标
  25. storeArr: [],//店铺
  26. storeValue: 0,//选中的店铺下标
  27. verificationCode: '获取验证码',//验证码文案
  28. sendCode: true,
  29. appointment: true,
  30. subscribeData: {
  31. realname: "",//姓名
  32. mobile: "",//手机号
  33. captcha: "",//验证码
  34. province: "",//省份
  35. agent_code: "",//经销商编码
  36. agentDetail: "",//经销商详细信息
  37. parentOpenid: app.globalData.parentOpenid,//好友openid
  38. },
  39. userData:{
  40. avatarUrl: null,
  41. nickName: null,
  42. userLevel: 1
  43. },
  44. descFrameShow:false,//是否显示奖品详情
  45. ruleShow: false,//是否显示星探等级规则
  46. // isRegister: false,//查询是否已注册
  47. parames:{
  48. page:1,
  49. count:20
  50. },
  51. noData:false,
  52. optionsData:null,
  53. lookDescId: null,
  54. agreement: false,//是否显示协议
  55. addressShow:false,
  56. mycenterTipWindow:0,
  57. barNums:0,
  58. getState:true,
  59. scoutRule:false,
  60. vipDetailShow:false,
  61. lookPrizeDetail:false,
  62. lookIndex:null,
  63. testData:[
  64. // {
  65. // awardDetailPicContentHeight:0,
  66. // awardName: "头等舱机票", //奖品名称
  67. // awardPicurl:"https://xingb.venucia.com/award/10_1.png",//奖品小图
  68. // productCode:"3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  69. // awardState: 0,
  70. // cdate: "2020-03-23",
  71. // awardId:1
  72. // },
  73. // {
  74. // awardDetailPicContentHeight: 0,
  75. // awardName: "小米扫地机器人", //奖品名称
  76. // awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  77. // productCode: "3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  78. // awardState: 0,
  79. // cdate: "2020-03-23",
  80. // awardId: 2
  81. // },
  82. // {
  83. // awardDetailPicContentHeight: 0,
  84. // awardName: "索尼无线蓝牙耳机", //奖品名称
  85. // awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  86. // productCode: "3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  87. // awardState: 0,
  88. // cdate: "2020-03-23",
  89. // awardId: 3
  90. // },
  91. // {
  92. // awardDetailPicContentHeight: 0,
  93. // awardName: "美的烤箱", //奖品名称
  94. // awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  95. // productCode: "3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  96. // awardState: 0,
  97. // cdate: "2020-03-23",
  98. // awardId: 4
  99. // },
  100. // {
  101. // awardDetailPicContentHeight: 0,
  102. // awardName: "200元油卡", //奖品名称
  103. // awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  104. // productCode: "3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  105. // awardState: 0,
  106. // cdate: "2020-03-23",
  107. // awardId: 5
  108. // },
  109. {
  110. awardDetailPicContentHeight: 0,
  111. awardName: "100元京东E卡", //奖品名称
  112. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  113. productCode: "3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  114. awardState: 0,
  115. cdate: "2020-03-23",
  116. awardId: 6
  117. },
  118. {
  119. awardDetailPicContentHeight: 0,
  120. awardName: "50元京东E卡", //奖品名称
  121. awardPicurl: "https://xingb.venucia.com/award/10_1.png",//奖品小图
  122. productCode: "3cce61eac692e0dd37f0330dd2bb4df7",//奖品兑换码
  123. awardState: 0,
  124. cdate: "2020-03-23",
  125. awardId: 7
  126. },
  127. ]
  128. },
  129. /**
  130. * 生命周期函数--监听页面加载
  131. */
  132. onLoad: function (options) {
  133. app.globalData.nowPage = 4;
  134. if (options.sourcePage){
  135. this.data.optionsData = options.sourcePage;
  136. }
  137. if (app.globalData.openid) {
  138. this.loadFun();
  139. } else {
  140. app.globalData.openidSuccessFuc = this.loadFun;
  141. }
  142. },
  143. loadFun: function () {
  144. if (!app.globalData.addPageEnterState.myCenter) {
  145. app.addPageEnter("BDAB6E93ECCD815EE83371E16EE42886");
  146. app.globalData.addPageEnterState.myCenter = true;
  147. }
  148. this.getUserInfo();
  149. this.getAddress();
  150. if (app.globalData.userMobile) {
  151. this.data.subscribeData.mobile = app.globalData.userMobile;
  152. this.setData({
  153. phoneInputShow: true,
  154. subscribeData: this.data.subscribeData
  155. })
  156. }
  157. if (app.globalData.myCenterData) {
  158. this.setData({
  159. provinceArr: app.globalData.myCenterData.provinceArr,
  160. storeArr: app.globalData.myCenterData.storeArr,
  161. provinceValue: app.globalData.myCenterData.provinceValue,
  162. storeValue: app.globalData.myCenterData.storeValue,
  163. // isRegister: app.globalData.isRegister
  164. })
  165. this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
  166. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  167. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  168. }
  169. // if (!app.globalData.isRegister) {
  170. // this.getOrderInfo();
  171. // }
  172. if (app.globalData.userInfoData) {
  173. this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
  174. this.data.userData.nickName = app.globalData.userInfoData.nickName;
  175. this.data.userData.userLevel = app.globalData.userInfoData.userLevel;
  176. this.setData({
  177. isLogin: true,
  178. userData: this.data.userData
  179. })
  180. }
  181. },
  182. /**
  183. * 生命周期函数--监听页面初次渲染完成
  184. */
  185. onReady: function () {
  186. },
  187. /**
  188. * 生命周期函数--监听页面显示
  189. */
  190. onShow: function () {
  191. if (app.globalData.getBuyState) {
  192. this.getBuyStates();
  193. } else {
  194. app.globalData.buyStateSuccessFuc = this.getBuyStates;
  195. }
  196. this.data.subscribeData.parentOpenid = app.globalData.parentOpenid;
  197. },
  198. getBuyStates: function () {
  199. this.setData({
  200. buyState: app.globalData.getBuyState.success,
  201. buyStateTime: app.globalData.getBuyState.cdate
  202. })
  203. },
  204. /**
  205. * 生命周期函数--监听页面隐藏
  206. */
  207. onHide: function () {
  208. },
  209. /**
  210. * 生命周期函数--监听页面卸载
  211. */
  212. onUnload: function () {
  213. },
  214. /**
  215. * 页面相关事件处理函数--监听用户下拉动作
  216. */
  217. onPullDownRefresh: function () {
  218. },
  219. /**
  220. * 页面上拉触底事件的处理函数
  221. */
  222. onReachBottom: function () {
  223. },
  224. /**
  225. * 用户点击右上角分享
  226. */
  227. onShareAppMessage: function () {
  228. return app.sharePack();
  229. },
  230. selectChange:function(e){
  231. this.setData({
  232. selectNow: e.currentTarget.dataset.value
  233. })
  234. if (e.currentTarget.dataset.value == 1) {
  235. this.getTaskProgress();
  236. } else if (e.currentTarget.dataset.value == 2) {
  237. this.getMyAwardList();
  238. } else if (e.currentTarget.dataset.value == 3){
  239. this.data.parames.page = 0;
  240. this.setData({
  241. parames: this.data.parames,
  242. shareFriendList:[]
  243. })
  244. this.getShareList();
  245. }
  246. },
  247. selectTask: function (e) {
  248. this.setData({
  249. taskNow: e.currentTarget.dataset.type
  250. })
  251. if (this.data.taskNow==2){
  252. this.getFriendBuCarNum();
  253. }
  254. },
  255. getFriendBuCarNum:function(){
  256. app.wxRequest(app.globalData.urlRoot +"/share/getFriendBuCarNum",{},res=>{
  257. if(res.code==200){
  258. this.setData({
  259. barNums: res.data.total
  260. })
  261. }
  262. },this);
  263. },
  264. selectRecord: function (e) {
  265. if (this.data.recordNow == e.currentTarget.dataset.type) {
  266. return;
  267. }
  268. this.setData({
  269. recordList:[],
  270. recordNow: e.currentTarget.dataset.type
  271. })
  272. this.getMyAwardList();
  273. },
  274. getUserLocation: function (e) {
  275. wx.getLocation({
  276. type: 'gcj02', //wgs84
  277. success: (res) => {
  278. this.getDistributorList(res.longitude, res.latitude);
  279. },
  280. fail: (res) => {
  281. this.getDistributorList("", "");
  282. },
  283. complete: (res) => {
  284. this.setData({
  285. siteSelect: true,
  286. })
  287. }
  288. })
  289. },
  290. getDistributorList: function (longitude, latitude) {//获取经销商列表
  291. app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude }, res => {
  292. if (res.code == 200) {
  293. app.globalData.myCenterData = {};
  294. this.setData({
  295. provinceArr: res.data.list,
  296. storeArr: res.data.list[res.data.nearData.provinceIndex].children,
  297. provinceValue: res.data.nearData.provinceIndex,
  298. storeValue: res.data.nearData.cityIndex
  299. })
  300. this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
  301. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  302. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  303. app.globalData.myCenterData.provinceArr = res.data.list;
  304. app.globalData.myCenterData.storeArr = res.data.list[res.data.nearData.provinceIndex].children;
  305. app.globalData.myCenterData.provinceValue = res.data.nearData.provinceIndex;
  306. app.globalData.myCenterData.storeValue = res.data.nearData.cityIndex;
  307. } else {
  308. wx.showToast({
  309. title: res.msg,
  310. icon: "none"
  311. })
  312. }
  313. }, this);
  314. },
  315. provinceChane: function (e) {//选中省
  316. this.setData({
  317. provinceValue: e.detail.value,
  318. storeArr: this.data.provinceArr[e.detail.value].children,
  319. storeValue: 0
  320. })
  321. this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
  322. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  323. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  324. },
  325. storeChane: function (e) {//选中店铺
  326. this.setData({
  327. storeValue: e.detail.value,
  328. })
  329. this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
  330. this.data.subscribeData.agent_code = this.data.storeArr[this.data.storeValue].agent_code;
  331. },
  332. getCode: function (e) {//获取验证码
  333. if (!app.mobileVerify(this.data.subscribeData.mobile)) {
  334. if (this.data.subscribeData.mobile) {
  335. wx.showToast({
  336. title: '请输入正确的电话',
  337. icon: 'none'
  338. })
  339. } else {
  340. wx.showToast({
  341. title: '请输入电话',
  342. icon: 'none'
  343. })
  344. }
  345. return;
  346. }
  347. if (!this.data.sendCode) {
  348. return;
  349. }
  350. this.data.sendCode = false;
  351. app.wxRequest(app.globalData.urlRoot + "captcha/sendCaptcha", { mobile: this.data.subscribeData.mobile }, res => {
  352. if (res.code == 200) {
  353. this.countDown();
  354. wx.showToast({
  355. title: '验证码获取成功',
  356. icon: "none"
  357. })
  358. this.setData({
  359. verificationCode: 60
  360. })
  361. } else {
  362. this.data.sendCode = true;
  363. wx.showToast({
  364. title: res.msg,
  365. icon: "none"
  366. })
  367. }
  368. }, this)
  369. },
  370. countDown: function () {//倒计时
  371. setTimeout(() => {
  372. this.setData({
  373. verificationCode: this.data.verificationCode - 1
  374. })
  375. if (this.data.verificationCode > 0) {
  376. this.countDown();
  377. } else {
  378. this.setData({
  379. verificationCode: "获取验证码"
  380. })
  381. this.data.sendCode = true;
  382. }
  383. }, 1000);
  384. },
  385. getRealname: function (e) {//获取用户输入的姓名
  386. this.data.subscribeData.realname = e.detail.value;
  387. },
  388. getMobile: function (e) {//获取用户输入的电话
  389. this.data.subscribeData.mobile = e.detail.value;
  390. },
  391. getCaptcha: function (e) {//获取用户输入的验证码
  392. this.data.subscribeData.captcha = e.detail.value;
  393. },
  394. subscribeFun: function (e) {//预约鉴赏
  395. if(!this.data.subscribeData.realname){
  396. wx.showToast({
  397. title: '请输入姓名',
  398. icon:"none"
  399. })
  400. return;
  401. }
  402. if (!this.data.subscribeData.mobile) {
  403. wx.showToast({
  404. title: '请输入电话',
  405. icon: "none"
  406. })
  407. return;
  408. }
  409. if (!this.data.subscribeData.captcha) {
  410. wx.showToast({
  411. title: '请输入验证码',
  412. icon: "none"
  413. })
  414. return;
  415. }
  416. if (!this.data.isAgreement) {
  417. wx.showToast({
  418. title: '请同意协议',
  419. icon: 'none'
  420. })
  421. return;
  422. }
  423. if (!this.data.appointment) {
  424. return;
  425. }
  426. this.data.appointment = false;
  427. app.wxRequest(app.globalData.urlRoot + "userInfo/submitOrderInfo", this.data.subscribeData, res => {
  428. this.data.appointment = true;
  429. if (res.code == 200) {
  430. wx.showToast({
  431. title: '预约成功'
  432. })
  433. this.data.subscribeData.realname = "";
  434. this.data.subscribeData.captcha = "";
  435. this.setData({
  436. subscribeData: this.data.subscribeData,
  437. verificationCode: '获取验证码',
  438. })
  439. this.setData({
  440. siteSelect: false
  441. })
  442. // this.setData({
  443. // isRegister: true
  444. // })
  445. // app.globalData.isRegister = true;
  446. app.globalData.userMobile = this.data.subscribeData.mobile;
  447. } else {
  448. wx.showToast({
  449. title: res.msg,
  450. icon: "none"
  451. })
  452. }
  453. }, this, "POST")
  454. },
  455. getUserWxMsg:function(e){//通过微信获取用户信息
  456. if (e.detail.errMsg == "getUserInfo:ok") {
  457. this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
  458. this.data.userData.nickName = e.detail.userInfo.nickName;
  459. this.setData({
  460. userData: this.data.userData,
  461. isLogin: true
  462. })
  463. app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
  464. }
  465. },
  466. getUserInfo:function(e){//获取个人信息
  467. app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
  468. if(res.code==200){
  469. if (res.data && res.data.avatarUrl) {
  470. if (!app.globalData.userInfoData) {
  471. this.data.userData.avatarUrl = res.data.avatarUrl;
  472. this.data.userData.nickName = res.data.nickName;
  473. this.data.userData.userLevel = res.data.userLevel;
  474. app.globalData.userInfoData = {};
  475. app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
  476. app.globalData.userInfoData.nickName = res.data.nickName;
  477. app.globalData.userInfoData.userLevel = res.data.userLevel;
  478. wx.setStorageSync('userInfoData', {
  479. avatarUrl: res.data.avatarUrl,
  480. nickName: res.data.nickName,
  481. userLevel: res.data.userLevel,
  482. })
  483. } else if (app.globalData.userInfoData){
  484. if (app.globalData.userInfoData.userLevel != res.data.userLevel) {
  485. this.data.userData.userLevel = res.data.userLevel;
  486. app.globalData.userInfoData.userLevel = res.data.userLevel;
  487. wx.setStorageSync('userInfoData', app.globalData.userInfoData);
  488. }
  489. if (app.globalData.userInfoData.avatarUrl != res.data.avatarUrl) {
  490. this.data.userData.avatarUrl = res.data.avatarUrl;
  491. app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
  492. wx.setStorageSync('userInfoData', app.globalData.userInfoData);
  493. }
  494. if (app.globalData.userInfoData.nickName != res.data.nickName) {
  495. this.data.userData.nickName = res.data.nickName;
  496. app.globalData.userInfoData.nickName = res.data.nickName;
  497. wx.setStorageSync('userInfoData', app.globalData.userInfoData);
  498. }
  499. }
  500. this.setData({
  501. userData: this.data.userData
  502. })
  503. if (!app.globalData.userInfoData){
  504. this.setData({
  505. isLogin: true
  506. })
  507. }
  508. }
  509. }
  510. },this)
  511. },
  512. getTaskProgress: function () {//获取任务完成度 1每日任务
  513. app.wxRequest(app.globalData.urlRoot + "task/getTaskProgress", { taskType: this.data.taskNow},res=>{
  514. if(res.code==200){
  515. if(res.data){
  516. for (let i = 0; i < res.data.taskData.length; i++) {
  517. res.data.taskData[i]['unlockNum'] = 0;
  518. for (let j = 0; j < res.data.taskData[i].childIdArr.length; j++) {
  519. if (res.data.taskData[i].childIdArr[j]) {
  520. res.data.taskData[i]['unlockNum'] += 1;
  521. }
  522. }
  523. }
  524. this.setData({
  525. taskList: res.data.taskData
  526. })
  527. }
  528. }
  529. },this)
  530. },
  531. lookDesc:function(e){//查看奖品详情
  532. var index = e.currentTarget.dataset.index;
  533. this.setData({
  534. lookIndex: (index || index == 0) ? this.data.recordList[index]:null,
  535. lookPrizeDetail: !this.data.lookPrizeDetail
  536. })
  537. // if (this.data.descFrameShow){
  538. // this.setData({
  539. // descFrameShow: !this.data.descFrameShow,
  540. // })
  541. // return;
  542. // }
  543. // if (this.data.recordList[e.currentTarget.dataset.value].awardState == 0){
  544. // this.setData({
  545. // mycenterTipWindow:this.data.isAddress?2:1,
  546. // lookDescId: e.currentTarget.dataset.value || e.currentTarget.dataset.value == 0 ? e.currentTarget.dataset.value : null
  547. // })
  548. // } else {
  549. // this.setData({
  550. // descFrameShow: !this.data.descFrameShow,
  551. // lookDescId: e.currentTarget.dataset.value || e.currentTarget.dataset.value == 0 ? e.currentTarget.dataset.value : null
  552. // })
  553. // }
  554. },
  555. lookRule: function (e) {//查看奖品详情
  556. this.setData({
  557. ruleShow: e.currentTarget.dataset.value
  558. })
  559. },
  560. getShareList: function () {//星探小分队
  561. app.wxRequest(app.globalData.urlRoot + "share/getFriendRegisterList", this.data.parames,res=>{
  562. if(res.code==200){
  563. for(let i=0;i<res.data.length;i++){
  564. this.data.shareFriendList.push(res.data[i]);
  565. }
  566. this.setData({
  567. shareFriendList: this.data.shareFriendList
  568. })
  569. if (res.data.length<this.data.parames.count){
  570. this.setData({
  571. noData: true
  572. })
  573. }
  574. }
  575. },this);
  576. },
  577. getOrderInfo: function () {//查询是否已注册
  578. app.wxRequest(app.globalData.urlRoot + "userInfo/getOrderInfo", {}, res => {
  579. if (res.code == 200) {
  580. if (res.data) {
  581. this.setData({
  582. isRegister: true
  583. })
  584. app.globalData.isRegister = true;
  585. app.globalData.userMobile = res.data.mobile;
  586. } else {
  587. if (app.globalData.userMobile) {
  588. this.data.subscribeData.mobile = app.globalData.userMobile;
  589. this.setData({
  590. phoneInputShow: true,
  591. subscribeData: this.data.subscribeData
  592. })
  593. }
  594. }
  595. } else {
  596. console.log(res.msg)
  597. }
  598. }, this);
  599. },
  600. scrolltolower:function(){//星探小分队滚动条触底时执行
  601. if(!this.data.noData){
  602. this.data.parames.page+=1;
  603. this.getShareList();
  604. }
  605. },
  606. getMyAwardList: function () {//获取获奖记录
  607. this.setData({
  608. getState:true
  609. })
  610. wx.showLoading({
  611. title: '获取数据中'
  612. })
  613. app.wxRequest(app.globalData.urlRoot + "award/getMyAwardList", { awardSource: this.data.recordNow }, res => {
  614. wx.hideLoading();
  615. this.setData({
  616. getState: false
  617. })
  618. if(res.code == 200){
  619. res.data = this.data.testData;
  620. this.setData({
  621. recordList:res.data
  622. })
  623. }
  624. },this)
  625. },
  626. getUserPhone: function (e) {//获取用户手机号
  627. this.setData({
  628. phoneInputShow: true
  629. })
  630. if (e.detail.errMsg == 'getPhoneNumber:ok') {
  631. app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
  632. if (res.code == 200) {
  633. if (res.data && res.data.decodeData){
  634. this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
  635. this.setData({
  636. subscribeData: this.data.subscribeData
  637. })
  638. }
  639. } else {
  640. wx.showToast({
  641. title: res.msg,
  642. icon: "none"
  643. })
  644. }
  645. }, this);
  646. }
  647. },
  648. addressControl: function () {//跳转到地址管理
  649. if (app.globalData.userInfoData) {
  650. this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
  651. this.data.userData.nickName = app.globalData.userInfoData.nickName;
  652. this.setData({
  653. userData: this.data.userData
  654. })
  655. }
  656. this.setData({
  657. addressShow:!this.data.addressShow
  658. })
  659. if (this.data.isAddress== false){
  660. this.getAddress();
  661. }
  662. },
  663. agreementState: function () {//协议
  664. this.setData({
  665. isAgreement: !this.data.isAgreement
  666. })
  667. },
  668. agreementControl: function () {
  669. this.setData({
  670. agreement: !this.data.agreement
  671. })
  672. },
  673. lookMore:function(){
  674. wx.navigateTo({
  675. url: '/pages/moreType/moreType',
  676. })
  677. },
  678. showSite: function () {//显示地址选择框
  679. if (!this.data.siteSelect) {
  680. if (!app.globalData.myCenterData) {
  681. this.getUserLocation();//获取用户当前位置
  682. }else{
  683. this.setData({
  684. siteSelect:true
  685. })
  686. }
  687. }
  688. },
  689. placingControl: function () {
  690. if (app.globalData.getBuyState.success != this.data.buyState) {
  691. this.setData({
  692. buyState: app.globalData.getBuyState.success,
  693. buyStateTime: app.globalData.getBuyState.cdate
  694. })
  695. }
  696. this.setData({
  697. placing: !this.data.placing
  698. })
  699. },
  700. scoutRuleControl:function(){
  701. this.setData({
  702. scoutRule: !this.data.scoutRule
  703. })
  704. },
  705. tipWindow:function(){
  706. this.setData({
  707. mycenterTipWindow:0
  708. })
  709. },
  710. lookAddress:function(){
  711. this.addressControl();
  712. },
  713. copyExchangeCode:function(){
  714. var text = this.data.recordList[this.data.lookDescId].couponCode || this.data.recordList[this.data.lookDescId].productCode || "";
  715. this.contentCopy(text);
  716. },
  717. contentCopy:function(text){//内容复制
  718. wx.setClipboardData({
  719. data: text
  720. })
  721. },
  722. getAddress: function () {//获取地址
  723. app.wxRequest(app.globalData.urlRoot + "address/getAddress", {}, res => {
  724. if (res.code == 200) {
  725. if (res.data) {
  726. this.data.isAddress = true;
  727. }
  728. } else {
  729. wx.showToast({
  730. title: res.msg,
  731. icon: "none"
  732. })
  733. }
  734. }, this);
  735. },
  736. starGo:function(){//去完成
  737. wx.reLaunch({
  738. url: '/pages/star/star',
  739. })
  740. },
  741. enterLucky:function(){
  742. wx.reLaunch({
  743. url: '/pages/luckyStar/luckyStar',
  744. })
  745. },
  746. enterEvery:function(){
  747. wx.navigateTo({
  748. url: '/pages/everyday/everyday',
  749. })
  750. },
  751. vipDetailControl:function(){
  752. this.setData({
  753. vipDetailShow:!this.data.vipDetailShow
  754. })
  755. }
  756. })