东风启辰小程序端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

881 rinda
26KB

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