balancePayment.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. const util = require('../../../utils/util.js');
  2. const app = getApp();
  3. Page({
  4. data: {
  5. num: 0,//套餐数量
  6. agreement: false,//同意合同
  7. pay: true,//同意微信支付
  8. qptype: 0,
  9. recommender: '', //推荐人
  10. recommenderStatus: '',
  11. street: '', //街道社区
  12. streetStatus: '',
  13. atype: 0,//0活动1电商
  14. recommenderShow: false,
  15. recommenderShowText: '',
  16. datas: {},//payinfo数据
  17. imgPath: util.config.imgPath,
  18. userInfo: app.globalData.userInfo,
  19. formData: {
  20. aid: '',
  21. sid: '',
  22. vid: '',
  23. cid: '',
  24. useCoin: 0,
  25. useBalance: 0,
  26. useUserCoin: 0,
  27. meals: ''
  28. },
  29. total: {
  30. coin: '0.00', //钱包
  31. coupons: '0.00', //现金券
  32. ldiscount: '0.00', //早鸟优惠价格
  33. mdiscount: '0.00', //会员折扣价
  34. price: '0.00', //总价
  35. sumBalance: '0.00', //账户余额
  36. ableBalance: '0.00', //账户余额可用
  37. },
  38. idcards: {},
  39. textarea: '',//备注
  40. phoneNum: '',//手机号码
  41. mailAddress: '',//邮寄地址
  42. shipAddress: '',//收货地址
  43. email: '',//邮箱
  44. familyCommittee: '',//家委会
  45. travelDates: '',//出行日期
  46. groupid: '',//拼团号
  47. shareId: '',//分享id
  48. paying: false,//支付中
  49. percent: 0,
  50. alone: 0, //0单独报名,1拼团
  51. initialSku: {},
  52. sku: {
  53. quantity: 0,//购买数量
  54. sessions: {},
  55. meals: {},
  56. quota: 999,//限购
  57. presellDeduction: 0.00
  58. },
  59. show: {
  60. address: false,
  61. vouche: false,
  62. integral: false
  63. },
  64. voucheConfig: {},
  65. maskShow: false,
  66. presellOpen: 0,
  67. optionsData: {
  68. aid: '',
  69. otype: '',
  70. orderid: '',
  71. presellstatus: '',
  72. campsex: '',
  73. military: ''
  74. },
  75. },
  76. onLoad(options) {
  77. console.log(options)
  78. // wx.removeStorageSync('idcards');
  79. this.setData({ optionsData: options })
  80. this.data.formData.aid = options.aid;
  81. // this.setData({
  82. // formData: this.data.formData,
  83. // qptype: options.qptype || '',
  84. // groupid: options.groupid || '',
  85. // recommenderStatus:options.recommender,
  86. // streetStatus:options.street,
  87. // alone: options.createGroup != undefined ? options.createGroup : 0,
  88. // initialSku: { sessionsIndex: parseInt(options.sessionsIndex), mealsIndex: parseInt(options.mealsIndex), quantity: parseInt(options.quantity)},
  89. // atype: parseInt(options.atype),
  90. // presellOpen:options.presellOpen
  91. // });
  92. this.payinfo();
  93. },
  94. onShow() {
  95. let idcards = wx.getStorageSync('idcards');
  96. this.data.formData.cid = !util.isObjEmpty(idcards) ? idcards.ids.join(",") : '';
  97. this.setData({ idcards, formData: this.data.formData });
  98. this.setData({ userInfo: app.globalData.userInfo });
  99. if (!util.isObjEmpty(this.data.sku.meals)) this.safe();
  100. },
  101. onUnload() {
  102. wx.removeStorageSync('idcards');
  103. },
  104. payinfo() {
  105. let that = this, userInfo = app.globalData.userInfo;
  106. let data = {};
  107. data.aid = that.data.formData.aid;
  108. data.qptype = that.data.qptype ? that.data.qptype : 0;
  109. if (that.data.optionsData.orderid) {
  110. data.orderid = that.data.optionsData.orderid // 参数有orderinfo返回数据场次只有一条
  111. }
  112. util.ajax({
  113. func: "article/payinfo",
  114. data: data
  115. }, function (res) {
  116. if (res.code == 0) {
  117. let idcards = {
  118. ids: [],
  119. names: [],
  120. idCards: [],
  121. parentNames: []
  122. };
  123. res.data.attendants.forEach(el => {
  124. idcards.ids.push(el.id)
  125. idcards.names.push(el.name)
  126. idcards.idCards.push(el.idcard)
  127. if (el.parent) {
  128. idcards.parentNames.push(el.parent.name)
  129. } else {
  130. idcards.parentNames.push('( 无 )')
  131. }
  132. });
  133. wx.setStorageSync("idcards", idcards);
  134. that.setData({
  135. datas: res.data,
  136. userInfo,
  137. formData: that.data.formData,
  138. phoneNum: res.data.buyInfo.contactPhone || '',
  139. mailAddress: res.data.buyInfo.mailAddress ? res.data.buyInfo.mailAddress : '',
  140. email: res.data.buyInfo.email || '',
  141. 'sku.quantity': parseInt(res.data.num),
  142. 'sku.presellDeduction': res.data.presellDiscount,
  143. idcards,
  144. streetStatus: res.data.street,
  145. street: res.data.buyInfo.street || '',
  146. travelDates: res.data.travelDates,
  147. recommender: res.data.recommenderName,
  148. textarea: res.data.orderRemark || ''
  149. });
  150. wx.reportAnalytics('enter_enlist', {
  151. aid: that.data.formData.aid,
  152. title: res.data.title
  153. });
  154. that.getSku();
  155. that.safe();
  156. that.shipInfo();
  157. that.RecommenderMsg()
  158. } else if (res.code == 3003) {
  159. wx.showModal({
  160. title: '提示',
  161. content: res.reason,
  162. showCancel: false,
  163. success: function (data) {
  164. if (data.confirm) {
  165. wx.navigateBack();
  166. }
  167. }
  168. })
  169. } else {
  170. util.showTips(res.reason);
  171. }
  172. })
  173. },
  174. // 设定推荐人表单资料
  175. RecommenderMsg() {
  176. let info = this.data.datas;
  177. if (info.recommender == "0" || util.isEmpty(info.recommender)) {
  178. this.setData({
  179. recommenderShow: false
  180. })
  181. } else if (info.recommender == "1") {
  182. this.setData({
  183. recommenderShow: true,
  184. recommenderShowText: '请填写推荐人,没有填无'
  185. })
  186. } else if (info.recommender == "2") {
  187. this.setData({
  188. recommenderShow: true,
  189. recommenderShowText: '非必填,若有请填写'
  190. })
  191. }
  192. },
  193. getSku() {//sku
  194. let sku = this.data.sku, info = this.data.datas, initialSku = this.data.initialSku, that = this;
  195. info.sessions.forEach(item => {
  196. if (item.sid == info.sid) {
  197. sku.sessions = item;
  198. item.alipays.forEach(el => {
  199. if (el.pid == info.pid) {
  200. sku.meals = el;
  201. }
  202. });
  203. }
  204. });
  205. this.data.formData.sid = sku.sessions.sid;
  206. sku.meals.originalPrice = util.toMoney(sku.meals.originalPrice)
  207. sku.meals.price = util.toMoney(sku.meals.price)
  208. sku.quota = info.attendants.length;
  209. // sku.quota = parseInt(sku.meals.actNum) < sku.meals.maxT ? parseInt(sku.meals.actNum) : sku.meals.maxT;
  210. this.setData({ sku, formData: this.data.formData })
  211. console.log(this.data.sku)
  212. },
  213. // 购买数量加
  214. numAdd() {
  215. let sku = this.data.sku;
  216. if (sku.quantity >= sku.quota) {
  217. util.showTips("超出预付人数");
  218. } else {
  219. console.log(sku.quantity, this.data.idcards)
  220. sku.quantity = parseInt(sku.quantity) + 1;
  221. this.setData({ sku });
  222. this.safe();
  223. }
  224. },
  225. // 购买数量减
  226. numReduce() {
  227. let sku = this.data.sku;
  228. if (sku.quantity <= 1) {
  229. util.showTips("至少选择1件");
  230. } else {
  231. sku.quantity = parseInt(sku.quantity) - 1;
  232. console.log(sku.quantity, this.data.idcards)
  233. if (sku.quantity == this.data.idcards.idCards.length - 1) {
  234. this.data.idcards.idCards.pop();
  235. this.data.idcards.ids.pop();
  236. this.data.idcards.names.pop();
  237. this.data.idcards.parentNames.pop();
  238. }
  239. this.setData({ sku, idcards: this.data.idcards });
  240. wx.setStorageSync("idcards", this.data.idcards);
  241. this.safe();
  242. }
  243. },
  244. // 设置订单量
  245. numChange(e) {
  246. let sku = this.data.sku;
  247. if (parseInt(e.detail.value) > sku.quota) {
  248. util.showTips("库存不足");
  249. sku.quantity = sku.quota;
  250. } else if (parseInt(e.detail.value) <= 0 || util.isEmpty(e.detail.value)) {
  251. util.showTips("至少选择1件");
  252. sku.quantitym = 1;
  253. } else {
  254. sku.quantity = e.detail.value;
  255. }
  256. this.setData({ sku });
  257. this.safe();
  258. },
  259. openQuestion() {
  260. this.setData({ maskShow: true })
  261. },
  262. maskClose() {
  263. this.setData({ maskShow: false })
  264. },
  265. agree() {
  266. this.setData({
  267. agreement: !this.data.agreement
  268. })
  269. },
  270. choosePay() {
  271. this.setData({
  272. pay: !this.data.pay
  273. })
  274. },
  275. // 选择出行人信息
  276. chooseCard() {
  277. var quantity = this.data.sku.quantity;
  278. if (quantity > 0) {
  279. console.log(this.data.optionsData)
  280. wx.navigateTo({
  281. url: '/pages/account/cards/index?quantity=' + quantity + '&mage=' + this.data.datas.mage + '&lage=' + this.data.datas.lage + '&sparent=' + this.data.datas.sparent + '&adultMinAge=' + this.data.datas.adultMinAge + '&adultMaxAge=' + this.data.datas.adultMaxAge + '&military=' + this.data.optionsData.military + '&campSex=' + this.data.optionsData.campsex + '&sid=' + this.data.datas.sid + '&ageLimit=' + this.data.datas.ages
  282. })
  283. } else {
  284. util.showTips('请选择场次或者套餐数量');
  285. }
  286. },
  287. safe() {
  288. let that = this;
  289. that.data.formData.meals = that.data.sku.meals.pid + '|' + that.data.sku.quantity;
  290. that.data.formData.btype = that.data.optionsData.presellstatus == 1 ? 2 : 0; //购买类型: 0(默认)-普通购买 1-预付 2-付尾款
  291. util.ajax({
  292. func: "voucher/pay_mvoucher",//会员折扣,现金券,钱包
  293. data: that.data.formData,
  294. load: false
  295. }, function (res) {
  296. if (res.code == 0 && res.data != "") {
  297. let data = res.data;
  298. that.data.total.coin = util.toMoney(data.coin, ',');
  299. that.data.total.coupons = util.toMoney(data.price, ',');
  300. that.data.total.ldiscount = util.toMoney(data.ldiscount, ',');
  301. that.data.total.mdiscount = util.toMoney(data.mdiscount, ',');
  302. that.data.total.price = util.toMoney(data.totalFee, ',');
  303. that.data.total.sumBalance = util.toMoney(data.sumBalance, ',');
  304. that.data.total.sumBalanceNum = data.sumBalance;
  305. that.data.total.sumUserCoin = data.sumUserCoin || 0;
  306. that.data.total.userCoin = data.userCoin || 0;
  307. that.data.total.ableBalance = util.toMoney(data.ableBalance, ',');
  308. that.data.formData.vid = data.id || '';
  309. that.data.sku.presellDeduction = util.toMoney(data.presellDiscount, ',');
  310. that.setData({
  311. sku: that.data.sku,
  312. total: that.data.total,
  313. formData: that.data.formData,
  314. });
  315. } else {
  316. // that.clearSafe();
  317. }
  318. })
  319. },
  320. getPackId() {
  321. return (this.data.sku.meals.pid || '') + '|' + this.data.sku.quantity;
  322. },
  323. goCoupon() {
  324. var packIds = this.getPackId();
  325. if (this.data.datas.needIdcard != 'no' && util.isObjEmpty(this.data.idcards)) {
  326. util.showTips('请先选择购买儿童的身份信息。');
  327. return false;
  328. }
  329. this.data.show = { address: false, vouche: true, integral: false };
  330. let voucheConfig = {
  331. packIds: packIds,
  332. aid: this.data.formData.aid,
  333. sid: this.data.formData.sid,
  334. vid: this.data.formData.vid,
  335. cid: this.data.formData.cid
  336. }
  337. this.setData({ voucheConfig, show: this.data.show })
  338. },
  339. goPay() {
  340. var packIds = this.getPackId(),
  341. phoneNum = this.data.phoneNum,
  342. idcards = this.data.idcards,
  343. num = this.data.sku.quantity,
  344. datas = this.data.datas,
  345. userInfo = app.globalData.userInfo,
  346. email = this.data.email;
  347. if (util.isObjEmpty(this.data.sku.meals)) {
  348. util.showTips('请先选择场次套餐,再付款。');
  349. return false;
  350. }
  351. if (datas.needIdcard != 'no' && this.data.atype == 0) {
  352. if (idcards.ids) {
  353. if (idcards.ids.length == 0) {
  354. util.showTips('请先选择出行人的身份信息。');
  355. return false;
  356. } else if (idcards.ids.length != num) {
  357. util.showTips('请设置' + num + '人的身份信息。');
  358. return false;
  359. }
  360. } else {
  361. util.showTips('请先选择出行人的身份信息。');
  362. return false;
  363. }
  364. }
  365. if (datas.sphone == 'yes' && util.isPhone(phoneNum)) {
  366. util.showTips('请填写正确的用户联系手机号码。');
  367. return false;
  368. }
  369. if (datas.smailAddress == 'yes' && !this.data.mailAddress) {
  370. util.showTips('请填写邮寄信息。');
  371. return false;
  372. }
  373. var myreg = /^([a-zA-Z0-9]+[_|\_|\.|-]+)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]+)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi;
  374. console.log(email)
  375. if (datas.needEmail == 'yes' && !email) {
  376. util.showTips('请填写电子邮箱。');
  377. return false;
  378. }
  379. if (datas.needEmail == 'yes' && !myreg.test(email)) {
  380. util.showTips('请正确填写电子邮箱。');
  381. return false;
  382. }
  383. if (datas.familyCommittee == '1' && this.data.familyCommittee == '') {
  384. util.showTips('请填写是否为家委会');
  385. return false;
  386. }
  387. if (this.data.streetStatus == '1' && this.data.street == '') {
  388. util.showTips('请填写街道社区,没有填无');
  389. return false;
  390. }
  391. if (this.data.recommenderStatus == '1' && this.data.recommender == '') {
  392. util.showTips('请填写推荐人,没有填无');
  393. return false;
  394. }
  395. if (this.data.recommenderStatus == '1' && this.data.recommender.length > 10) {
  396. util.showTips('请正确填写推荐人');
  397. return false;
  398. }
  399. if (datas.travelDates == 'yes' && !this.data.travelDates && this.data.atype == 0) {
  400. util.showTips('请选择出行日期。');
  401. return false;
  402. }
  403. if (this.data.atype == 0 && datas.sremark == 'yes' && this.data.textarea == '') {
  404. util.showTips('请填写家长叮嘱等备注信息。');
  405. return false;
  406. }
  407. if (datas.agreement && !this.data.agreement && this.data.atype == 0) {
  408. util.showTips('请认真阅读相关协议条款,并认可同意。');
  409. return false;
  410. }
  411. if (!this.data.paying) {
  412. this.setData({ paying: true });
  413. this.WeChatPay();
  414. }
  415. },
  416. WeChatPay() {
  417. var data = {}, getPackId = this.getPackId(), userInfo = app.globalData.userInfo, that = this;
  418. data['meals'] = getPackId;//支付套餐字符串 如:pid|num,pid|num
  419. data['aid'] = this.data.formData.aid;//活动唯一标识
  420. data['sid'] = this.data.formData.sid;//场次id
  421. data['orderTitle'] = this.data.datas.title;//商品名
  422. data['phone'] = userInfo.phoneNum;//用户联系电话
  423. data['vid'] = this.data.formData.vid == -1 ? "" : this.data.formData.vid;//现金券id
  424. data['idcards'] = this.data.idcards.ids != undefined ? this.data.idcards.ids.join(",") : "";//身份证信息 ,字符串多个","隔开 如: id1,id2 remark
  425. data['remark'] = this.data.textarea;//备注
  426. data['contactPhone'] = this.data.phoneNum;//联系手机号
  427. data['recommender'] = this.data.recommender;//推荐人
  428. data['street'] = this.data.street;//街道社区
  429. data['travelDates'] = this.data.travelDates;//出行日期
  430. data['mailAddress'] = this.data.mailAddress;//邮寄地址
  431. data['openid'] = userInfo.socialUid;//微信用户的openid
  432. data['email'] = this.data.email;//邮件地址
  433. data['wallet'] = this.data.formData.useCoin;
  434. data['useBalance'] = this.data.formData.useBalance;
  435. data.useUserCoin = this.data.formData.useUserCoin;
  436. data['groupid'] = this.data.groupid;//拼团号
  437. data['shareId'] = this.data.shareId;//分享id
  438. data['product'] = 0;//产品: 0(默认)-活动 1-年卡
  439. data.createGroup = this.data.alone;
  440. data.orderid = this.data.optionsData.orderid;
  441. data.btype = 2; //付尾款
  442. util.WXPay(data, this.data.formData.aid, this.data.datas.title, that.data.alone, that.data.optionsData.presellstatus).then(function (res) {
  443. console.log(data.btype, res)
  444. wx.navigateTo({
  445. url: '/pages/order/success/index?orderid=' + res.orderid + '&alone=' + that.data.alone + '&presellStatus=' + that.data.optionsData.presellstatus + '&btype=' + data.btype + '&tradeChannelWeixin=' + res.tradeChannelWeixin
  446. });
  447. }, function (res) {
  448. util.showTips(res.reason)
  449. });
  450. that.setData({ paying: false });
  451. wx.reportAnalytics('gopay', {
  452. aid: that.data.aid,
  453. title: that.data.datas.title,
  454. });
  455. },
  456. coinChange(e) {
  457. this.data.formData.useUserCoin = Number(e.detail.value);
  458. this.setData({ formData: this.data.formData });
  459. this.safe();
  460. },
  461. switchChange(e) {
  462. this.data.formData.useCoin = Number(e.detail.value);
  463. this.setData({ formData: this.data.formData });
  464. this.safe();
  465. },
  466. balanceChange(e) {
  467. this.data.formData.useBalance = Number(e.detail.value);
  468. this.setData({ formData: this.data.formData });
  469. this.safe();
  470. },
  471. textarea(e) {
  472. this.setData({ textarea: e.detail.value });
  473. },
  474. phoneNum(e) {
  475. this.setData({ phoneNum: e.detail.value });
  476. },
  477. chooseAddress() {
  478. this.data.show = { address: true, vouche: false, integral: false };
  479. this.setData({ show: this.data.show });
  480. },
  481. weixinAddress() {
  482. let that = this;
  483. wx.chooseAddress({
  484. success(res) {
  485. let mailAddress = `${res.userName} ${res.telNumber} ${res.provinceName}/${res.cityName}/${res.countyName} ${res.detailInfo}`;
  486. that.setData({ mailAddress, shipAddress: res });
  487. }
  488. })
  489. },
  490. submitAddress(e) {
  491. let data = e.detail;
  492. this.setData({ mailAddress: data.name + ' ' + data.mobile + ' ' + data.provincial + ' ' + data.address });
  493. this.shipInfo();
  494. },
  495. shipInfo() {
  496. if (this.data.mailAddress) {
  497. let address = this.data.mailAddress.split(' ');
  498. let addressInfo = address[2].split('/');
  499. let shipAddress = {
  500. userName: address[0],
  501. telNumber: address[1],
  502. provinceName: addressInfo[0],
  503. cityName: addressInfo[1],
  504. countyName: addressInfo[2],
  505. detailInfo: address[3],
  506. }
  507. this.setData({ shipAddress });
  508. }
  509. },
  510. changeVouche(e) {
  511. this.data.formData.vid = e.detail;
  512. this.setData({ formData: this.data.formData });
  513. this.safe();
  514. },
  515. // 推荐人
  516. recommender(e) {
  517. this.setData({ recommender: util.trim(e.detail.value) });
  518. },
  519. // 街道社区
  520. streetInput(e) {
  521. this.setData({ street: util.trim(e.detail.value) });
  522. },
  523. // 邮箱
  524. email(e) {
  525. this.setData({ email: e.detail.value });
  526. console.log(this.data.email)
  527. let userInfo = app.globalData.userInfo;
  528. userInfo.email = e.detail.value;
  529. wx.setStorageSync('WXuserInfo', userInfo);
  530. },
  531. // 家委会
  532. familyCommittee(e) {
  533. this.setData({ familyCommittee: util.trim(e.detail.value) });
  534. },
  535. bindDateChange(e) {
  536. this.setData({
  537. travelDates: e.detail.value
  538. });
  539. },
  540. openDoc() {
  541. let datas = this.data.datas, url = '', that = this;
  542. switch (datas.agreement) {
  543. case 'default': //境内旅游合同
  544. url = util.config.imgUrl + '/doc/jingneihetong.pdf'
  545. break;
  546. case 'foreign': //境外旅游合同
  547. url = util.config.imgUrl + '/doc/jingwaihetong.pdf'
  548. break;
  549. case 'within': //沐童境内旅游合同
  550. url = util.config.imgUrl + '/doc/jingneimutong.pdf'
  551. break;
  552. case 'leave': //沐童境外旅游合同
  553. url = util.config.imgUrl + '/doc/jingwaimutong.pdf'
  554. break;
  555. case 'pay': //知识付费协议
  556. url = util.config.imgUrl + '/doc/knowledge.pdf'
  557. break;
  558. case 'bicycleDomestic': //沐童境内旅游合同(含骑行)
  559. url = util.config.imgUrl + '/doc/bicycleDomestic.pdf'
  560. break;
  561. case 'bicycleAbroad': //沐童出境旅游合同(含骑行)
  562. url = util.config.imgUrl + '/doc/bicycleAbroad.pdf'
  563. break;
  564. case 'within1': //境内旅游合同(沐童旅行社单日版)
  565. url = util.config.imgUrl + '/doc/singleDayContract.pdf'
  566. break;
  567. case 'within1_bicycle': //境内旅游合同(沐童旅行社单日骑行版)
  568. url = util.config.imgUrl + '/doc/singleDayBicycle.pdf'
  569. break;
  570. case 'within3': //境内旅游合同(沐童旅行社多日版)
  571. url = util.config.imgUrl + '/doc/manyDayContract.pdf'
  572. break;
  573. case 'within3_bicycle': //境内旅游合同(沐童旅行社多日骑行版)
  574. url = util.config.imgUrl + '/doc/manyDayBicycle.pdf'
  575. break;
  576. }
  577. const downloadTask = wx.downloadFile({
  578. url: url,
  579. success: function (res) {
  580. wx.openDocument({
  581. filePath: res.tempFilePath,
  582. fileType: "pdf"
  583. })
  584. }
  585. })
  586. downloadTask.onProgressUpdate((res) => {
  587. that.setData({ percent: res.progress })
  588. });
  589. },
  590. integral() {
  591. if (this.data.datas.needIdcard != 'no' && util.isObjEmpty(this.data.idcards)) {
  592. util.showTips('请先选择购买儿童的身份信息。');
  593. return false;
  594. }
  595. this.data.show = { address: false, vouche: false, integral: true };
  596. this.setData({ show: this.data.show, integralConfig: { idcards: this.data.idcards, sid: this.data.formData.sid, aid: this.data.formData.aid } });
  597. },
  598. close(e) {
  599. this.data.show[e.currentTarget.dataset.name] = false;
  600. this.setData({ show: this.data.show })
  601. },
  602. onShareAppMessage() {
  603. return {
  604. title: '分享自@宝贝走天下微信小程序',
  605. path: '/pages/home/index'
  606. }
  607. }
  608. })