applyRefund.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. // pages/applyRefund/applyRefund.js
  2. var http = require('../../utils/http.js');
  3. var big = require('../../utils/big.min.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. refundType: 2, // 退款类型 1整单 2单个物品
  10. // 货物状态
  11. goodsStateArray: ['未收到货', '已收到货'],
  12. isReceiver: 0, //货物状态(1:已收到货 0:未收到货)
  13. // 退款原因(已收到货)
  14. refundProdReasonArray: ['请选择', '拍错/多拍/不喜欢', '协商一致退款', '商品破损/少件', '商品与描述不符', '卖家发错货', '质量问题', '其他'],
  15. // 退款原因(未收到货)
  16. refundPriReasonArray: ['请选择', '协商一致退款', '拍错/多拍/不喜欢', '商家一直未发货/快递一直未送达', '其他'],
  17. buyerReason: 0, //退款原因
  18. refundItem: {}, //订单项数据
  19. orderItemId: '', //订单项ID(单个物品退款时使用)
  20. orderNumber: '', //订单编号
  21. applyType: 1, //退款方式(1:仅退款 2退款退货)
  22. goodsNum: 1, //退货数量(0或不传值则为全部数量)
  23. // quantity: 1, //退货数量
  24. refundAmount: 0, //实际退款金额
  25. maxRefundAmount: 0, //最大退款金额
  26. buyerMobile: '', //手机号码(默认当前订单手机号码)
  27. buyerDesc: '', //备注说明
  28. photoFiles: [], //凭证图片列表
  29. actualTotal: 0, //总额
  30. isLastProd: false, //是否最后一样商品
  31. prodPrice: 0, //商品单价
  32. addTransfee: false, //是否可以加运费(仅一件商品)
  33. orderScore: 0, // 整单使用积分
  34. showNumAndCont: '', // 金额、积分、运费的展示(最多可退)
  35. showPriAndScore: '', // 金额、积分、运费的展示(金额+积分)
  36. },
  37. /**
  38. * 金额、积分、运费的展示
  39. *
  40. * refundType: 退款单类型(1:整单退款,2:单个退款)
  41. * applyType: 退款方式(1:仅退款 2退款退货)
  42. * refundAmount: 实际退款金额
  43. * actualTotal: 总额
  44. * orderScore: 使用积分
  45. * refundItem.status == 2 待发货
  46. * refundItem.transfee 运费
  47. * isLastProd:是否最后一个订单项item
  48. */
  49. showNumber: function() {
  50. var refundItem = this.data.refundItem
  51. var refundAmount = this.data.refundAmount
  52. var refundType = this.data.refundType
  53. var actualTotal = this.data.actualTotal
  54. var orderScore = this.data.orderScore
  55. var isLastProd = this.isLastProd
  56. var showNumAndCont = ''
  57. var showPriAndScore = ''
  58. // 待发货
  59. if(refundItem.status == 2) {
  60. // 有金额,无运费,无积分
  61. if(refundAmount > 0 && (!refundItem.transfee || refundItem.transfee == 0) && (!orderScore || orderScore == 0)){
  62. // 单个退 || 整单退
  63. if(refundType == 2 || refundType == 1) {
  64. showNumAndCont = '¥' + refundAmount
  65. showPriAndScore = '¥' + refundAmount
  66. }
  67. }
  68. // 有金额,有运费,无积分
  69. if(actualTotal > 0 && (refundItem.transfee && refundItem.transfee > 0) && (!orderScore || orderScore == 0)) {
  70. if(isLastProd && refundType == 2) {
  71. // 单个退 && 最后一个订单项
  72. showNumAndCont = '¥' + actualTotal + '+运费' + '¥' + refundItem.transfee // 最多可退
  73. showPriAndScore = '¥' + refundAmount // 显示金额+积分
  74. }else { // (单个退 && 不是最后一个订单项) || 整单退
  75. showNumAndCont = '¥' + refundAmount // 最多可退
  76. showPriAndScore = '¥' + refundAmount // 显示金额+积分
  77. }
  78. }
  79. //有金额,有运费,有积分
  80. if(actualTotal > 0 && (refundItem.transfee && refundItem.transfee > 0) && (orderScore || orderScore > 0)) {
  81. if(isLastProd && refundType == 2) {
  82. // 单个退 && 最后一个订单项
  83. showNumAndCont = '¥' + actualTotal + '+运费' + '¥' + refundItem.transfee + '+' + orderScore + '积分' // 最多可退
  84. showPriAndScore = '¥' + refundAmount + '+' + orderScore + '积分' // 显示金额+积分
  85. }else { // (单个退 && 不是最后一个订单项) || 整单退
  86. showNumAndCont = '¥' + refundAmount + '+' + orderScore + '积分' // 最多可退
  87. showPriAndScore = '¥' + refundAmount + '+' + orderScore + '积分' // 显示金额+积分
  88. }
  89. }
  90. //无金额,无运费,有积分
  91. if((!refundAmount || refundAmount == 0) && (!refundItem.transfee || refundItem.transfee == 0) && (orderScore && orderScore > 0)) {
  92. // 单个退 || 整单退
  93. if(refundType == 2 || refundType == 1){
  94. showNumAndCont = orderScore + '积分'
  95. showPriAndScore = orderScore + '积分'
  96. }
  97. }
  98. //无金额,有运费,有积分
  99. if((!refundAmount || refundAmount == 0)&& (refundItem.transfee && refundItem.transfee > 0) && (orderScore && orderScore > 0)) {
  100. // 单个退 || 整单退
  101. if(refundType == 2 || refundType == 1){
  102. showNumAndCont = '运费' + '¥' + refundItem.transfee + '+' + orderScore + '积分'
  103. showPriAndScore = '¥' + refundItem.transfee + '+' + orderScore + '积分'
  104. }
  105. }
  106. console.log('待发货(最多可退):',showNumAndCont)
  107. console.log('待发货(金额+积分):',showPriAndScore)
  108. };
  109. // 非待发货(已发货 || 已完成)任何情况都不退运费
  110. if(refundItem.status != 2) {
  111. // 有金额,无运费,无积分
  112. if(refundAmount > 0 && (!refundItem.transfee || refundItem.transfee == 0) && (!orderScore || orderScore == 0)){
  113. // 单个退 || 整单退
  114. if(refundType == 2 || refundType == 1) {
  115. showNumAndCont= '¥' + refundAmount
  116. showPriAndScore = '¥' + refundAmount
  117. }
  118. }
  119. // 有金额,有运费,无积分
  120. if(refundAmount > 0 && (refundItem.transfee && refundItem.transfee > 0) && (!orderScore || orderScore == 0)) {
  121. // 单个退 || 整单退
  122. if(refundType == 2 || refundType == 1) {
  123. showNumAndCont = '¥' + refundAmount
  124. showPriAndScore = '¥' + refundAmount
  125. }
  126. }
  127. //有金额,有运费,有积分
  128. if(refundAmount > 0 && (refundItem.transfee && refundItem.transfee > 0) && (orderScore || orderScore > 0)) {
  129. // 单个退 || 整单退
  130. if(refundType == 2 || refundType == 1){
  131. showNumAndCont = '¥' + refundAmount + '+' + orderScore + '积分'
  132. showPriAndScore = '¥' + refundAmount + '+' + orderScore + '积分' // 显示金额+积分
  133. }
  134. }
  135. //无金额,无运费,有积分
  136. if((!refundAmount || refundAmount == 0) && (!refundItem.transfee || refundItem.transfee == 0) && (orderScore && orderScore > 0)) {
  137. // 单个退 || 整单退
  138. if(refundType == 2 || refundType == 1){
  139. showNumAndCont = orderScore + '积分'
  140. showPriAndScore = orderScore + '积分' // 显示金额+积分
  141. }
  142. }
  143. //无金额,有运费,有积分
  144. if((!refundAmount || refundAmount == 0)&& (refundItem.transfee && refundItem.transfee > 0) && (orderScore && orderScore > 0)) {
  145. // 单个退 || 整单退
  146. if(refundType == 2 || refundType == 1){
  147. showNumAndCont = orderScore + '积分'
  148. showPriAndScore = orderScore + '积分' // 显示金额+积分
  149. }
  150. }
  151. console.log('已发货(最多可退):',showNumAndCont)
  152. console.log('已发货(金额+积分):',showPriAndScore)
  153. }
  154. this.setData({
  155. showNumAndCont,
  156. showPriAndScore
  157. })
  158. console.log('最多可退showNumAndCont:',this.data.showNumAndCont)
  159. console.log('金额+积分showPriAndScore:',this.data.showPriAndScore)
  160. },
  161. /**
  162. * 退款原因选择
  163. * refundType: 退款类型 1整单 2单个物品
  164. * refundItem.status: 2待发货
  165. * isReceiver: 货物状态(1:已收到货 0:未收到货)
  166. * applyType: 1仅退款 2退货退款
  167. */
  168. returnReasonList: function() {
  169. if(this.data.applyType == 2) {
  170. this.setData({
  171. isReceiver: 1 // 已收到货
  172. })
  173. }else {
  174. this.setData({
  175. isReceiver: 0 // 已收到货
  176. })
  177. }
  178. console.log('isReceiver货物状态(1:已收到货 0:未收到货)',this.data.isReceiver)
  179. },
  180. /**
  181. * 货物状态picker选择
  182. */
  183. goodsStateArray: function(e) {
  184. console.log('货物状态', e.detail.value)
  185. this.setData({
  186. isReceiver: e.detail.value,
  187. buyerReason: 0
  188. })
  189. },
  190. /**
  191. * 退款原因picker选择
  192. */
  193. refundReasonChange: function(e) {
  194. console.log('退款原因', e.detail.value)
  195. this.setData({
  196. buyerReason: e.detail.value
  197. })
  198. },
  199. /**
  200. * 生命周期函数--监听页面加载
  201. */
  202. onLoad: function(options) {
  203. console.log(options,'----参数');
  204. // 拿到上一页的参数type(判断退款方式)
  205. // console.log('type:',options.type)
  206. if (options.type) {
  207. this.setData({
  208. applyType: options.type // 1仅退款 2退货退款
  209. })
  210. // console.log(this.data.type)
  211. }
  212. // console.log('refundType:',options.refundType)
  213. this.setData({
  214. refundType: options.refundType // 退款类型 1整单 2单个物品
  215. })
  216. console.log('refundType(退款类型 1整单 2单个物品)',this.data.refundType)
  217. this.getRefundProdInfo() //获取退款商品信息
  218. },
  219. /**
  220. * 获取退款商品信息
  221. */
  222. getRefundProdInfo: function() {
  223. let refundType = this.data.refundType // 退款类型 1整单 2单个物品
  224. //拿到缓存里的订单项数据
  225. var refundItem = wx.getStorageSync("refundItem");
  226. console.log('拿到缓存里的订单项数据refundItem:',refundItem)
  227. this.setData({
  228. refundItem: refundItem,
  229. orderNumber: refundItem.orderNumber,
  230. goodsNum: refundItem.prodCount,
  231. actualTotal: refundItem.actualTotal, //总额
  232. isLastProd: refundItem.isLastProd, //是否最后一样商品
  233. addTransfee: refundItem.addTransfee, //只有一件商品可以退运费
  234. orderScore: refundItem.useScore // 单个退积分
  235. })
  236. console.log('单个退orderScore:',this.data.orderScore)
  237. // console.log('platformShareReduce:',this.data.refundItem.platformShareReduce)
  238. // console.log(refundItem.isLastProd)
  239. if(refundType == 1) { //整单退款
  240. this.setData({
  241. orderItemDtos: refundItem.orderItemDtos, //商品列表
  242. orderScore: refundItem.orderScore, //整单积分
  243. });
  244. console.log('整单退orderScore:',this.data.orderScore)
  245. }
  246. let actualTotal = this.data.actualTotal //商品总额(不含运费)
  247. let prodCount = refundItem.prodCount //商品总数
  248. // console.log('商品总数prodCount',prodCount)
  249. // console.log('商品总额(不含运费)actualTotal',actualTotal)
  250. if(refundType == 2) { //单个退
  251. // 计算商品单价
  252. if(prodCount > 0) {
  253. var x = new big(actualTotal)
  254. var y = new big(prodCount)
  255. // 保留两位小数
  256. big.DP = 2
  257. // 向下取整
  258. big.RM = 1
  259. let prodPrice = x.div(y).valueOf() //商品单价
  260. this.setData({
  261. prodPrice
  262. })
  263. // console.log(this.prodPrice)
  264. }
  265. }
  266. this.returnReasonList() // 退款原因选择列表展示
  267. this.refundAmount() //退款金额计算
  268. },
  269. /**
  270. * 退款金额计算
  271. */
  272. refundAmount: function() {
  273. let actualTotal = this.data.actualTotal
  274. // console.log('总额this.data.actualTotal:',this.data.actualTotal)
  275. let refundItem = this.data.refundItem
  276. // console.log('商品item,this.data.refundItem:',this.data.refundItem)
  277. let refundType = this.data.refundType // 退款类型 1整单 2单个物品
  278. // console.log('refundType退款类型 1整单 2单个物品:',this.data.refundType)
  279. // console.log('addTransfee是否可加运费:',this.addTransfee)
  280. if (refundItem.status == 2) { //待发货状态
  281. if(refundType == 2) { //单个退,
  282. if(refundItem.isLastProd) { //如果是最后一个可退运费(actualTotal总额不包含运费)
  283. this.setData({
  284. refundAmount: actualTotal + refundItem.transfee,
  285. });
  286. // console.log('运费:',refundItem.transfee,'+总额:',actualTotal)
  287. // console.log('待发货单个退(最后一个)金额:',this.data.refundAmount)
  288. }else { //否则不退
  289. this.setData({
  290. refundAmount: actualTotal,
  291. });
  292. if(this.addTransfee) { // 如果是只有一个商品,可退运费
  293. this.setData({
  294. refundAmount: actualTotal + refundItem.transfee,
  295. });
  296. // console.log('单个退加运费可退总额:',this.refundAmount)
  297. }
  298. // console.log('运费:',refundItem.transfee,'+总额:',actualTotal)
  299. // console.log('待发货单个退(不是最后一个)金额:',this.data.refundAmount)
  300. }
  301. } else if(refundType == 1) { //整单退,退实际金额(actualTotal总额包含运费)
  302. this.setData({
  303. refundAmount: actualTotal,
  304. });
  305. // console.log('运费:',refundItem.transfee)
  306. // console.log('待发货整单退金额:',this.data.refundAmount)
  307. }
  308. } else if (refundItem.status != 2) { // 已发货订单(整单退运费(总额包含运费);单个不退运费(总额不包含运费))
  309. this.setData({
  310. refundAmount: actualTotal,
  311. });
  312. // console.log('运费:',refundItem.transfee)
  313. // console.log('已发货整单退金额:',this.data.refundAmount)
  314. }
  315. this.showNumber() // 金额、积分、运费的显示
  316. },
  317. /**
  318. * 改变商品数量重新计算价格(数量加减)
  319. */
  320. changePordNum(e) {
  321. var st = e.currentTarget.dataset.st;
  322. let actualTotal = this.data.actualTotal //商品总额(不含运费)
  323. var prodCount = this.data.refundItem.prodCount //商品总数
  324. if(st == 0){
  325. var goodsNum = this.data.goodsNum - 1 //展示的商品总数
  326. }else if(st == 1) {
  327. var goodsNum = this.data.goodsNum + 1 //展示的商品总数
  328. }
  329. if(goodsNum < 1) {
  330. wx.showToast({
  331. title: '退货数量不能小于1!',
  332. icon: 'none',
  333. })
  334. return
  335. }
  336. if(goodsNum > prodCount) {
  337. wx.showToast({
  338. title: '退货数量不能大于订单商品数量!',
  339. icon: 'none',
  340. })
  341. return
  342. }
  343. big.DP = 2
  344. // big.RM = 0
  345. this.setData({
  346. goodsNum,
  347. refundAmount: new big(actualTotal).times(goodsNum).div(prodCount).valueOf()
  348. })
  349. },
  350. /**
  351. * 上传图片
  352. */
  353. getUploadImg: function(e) {
  354. var idx = e.target.dataset.idx
  355. // console.log(idx);
  356. var ths = this;
  357. wx.chooseMedia({
  358. count: 1, // 默认9
  359. mediaType: ['image'],
  360. sourceType: ['album', 'camera'],
  361. maxDuration: 30,
  362. success: function(res) {
  363. // 图片的本地临时文件路径列表
  364. var tempFilePaths = res.tempFiles[0].tempFilePath;
  365. wx.showLoading({
  366. mask: true
  367. })
  368. var params = {
  369. url: "/p/file/upload",
  370. filePath: tempFilePaths,
  371. name: 'file',
  372. callBack: function(res2) {
  373. wx.hideLoading();
  374. var img = {};
  375. img.path = JSON.parse(res2).filePath;
  376. img.url = JSON.parse(res2).resourcesUrl + JSON.parse(res2).filePath;
  377. var photoFiles = ths.data.photoFiles;
  378. photoFiles.push(img);
  379. ths.setData({
  380. photoFiles: photoFiles
  381. })
  382. }
  383. };
  384. http.upload(params);
  385. }
  386. })
  387. },
  388. /**
  389. * 删除图片
  390. */
  391. removeImage: function(e) {
  392. var idx = e.currentTarget.dataset.idx;
  393. var photoFiles = this.data.photoFiles;
  394. photoFiles.splice(idx, 1)
  395. this.setData({
  396. photoFiles: photoFiles
  397. });
  398. console.log('删除图片')
  399. },
  400. /**
  401. * 申请退款
  402. */
  403. applyRefund: function () {
  404. var myreg = /^1(3|4|5|6|7|8|9)\d{9}$/;
  405. var pics = '';
  406. this.data.photoFiles.forEach(function (item) {
  407. pics += item.path + ',';
  408. });
  409. if (pics != '') {
  410. pics = pics.substring(0, pics.length - 1)
  411. }
  412. // 检查数据完整性
  413. if (this.data.buyerReason == 0) {
  414. wx.showToast({
  415. icon: 'none',
  416. title: '请选择退款原因',
  417. })
  418. } else if (this.data.actualTotal < 0){
  419. wx.showToast({
  420. icon: 'none',
  421. title: '请填写正确的退款金额',
  422. })
  423. } else if (this.data.buyerMobile.length !== 11 || !myreg.test(this.data.buyerMobile)) {
  424. // console.log(this.data.buyerMobile)
  425. wx.showToast({
  426. icon: 'none',
  427. title: '请填写正确的手机号码',
  428. })
  429. } else if (this.data.buyerDesc.length == 0) {
  430. wx.showToast({
  431. icon: 'none',
  432. title: '请填写退款说明',
  433. })
  434. }else{
  435. console.log('status:',this.data.refundItem.status)
  436. console.log('isLastProd:',this.data.isLastProd)
  437. var refundReasonArray;
  438. var refundReasonArray;
  439. if(this.data.isReceiver == 0) { // 未收货
  440. refundReasonArray = this.data.refundPriReasonArray
  441. }else if(this.data.isReceiver == 1) { // 已收货
  442. refundReasonArray = this.data.refundProdReasonArray
  443. }
  444. if(this.data.refundItem.status == 2 && this.data.isLastProd ) { //待发货(包含运费)并且是最后一件
  445. console.log('待发货并且是最后一件')
  446. console.log(this.data.isLastProd)
  447. wx.showModal({
  448. title: '提示',
  449. content: '本次申请的退款商品是本单最后一件商品,退款金额中包含本单运费,一旦提交申请,本单所有商品的退款申请均不可撤销,是否确认提交',
  450. success: res => {
  451. if (res.confirm) {
  452. console.log('用户点击确定')
  453. wx.showLoading();
  454. var params = {
  455. url: "/p/orderRefund/apply",
  456. method: "POST",
  457. data: {
  458. orderNumber: this.data.orderNumber, //订单编号
  459. applyType: this.data.applyType, //退款方式(1:仅退款 2退款退货)
  460. isReceiver: Number(this.data.isReceiver), //货物状态(1:已收到货 0:未收到货)
  461. buyerReason: refundReasonArray[this.data.buyerReason], //退款原因
  462. goodsNum: this.data.goodsNum, //退款数量(0或不传值则为全部数量)
  463. refundAmount: this.data.refundAmount, //退款金额
  464. buyerMobile: this.data.buyerMobile, //手机号码(默认当前订单手机号码)
  465. buyerDesc: this.data.buyerDesc, //备注说明
  466. photoFiles: pics, //凭证图片列表
  467. refundType: this.data.refundType, //退款单类型(1:整单退款,2:单个物品退款)
  468. orderItemId: this.data.refundItem.orderItemId
  469. },
  470. callBack: (res) => {
  471. wx.hideLoading();
  472. // 去到我的退款订单页面
  473. wx.redirectTo({
  474. url: '/pages/afterSales/afterSales',
  475. })
  476. }
  477. };
  478. http.request(params);
  479. } else if (res.cancel) {
  480. console.log('用户点击取消')
  481. }
  482. }
  483. })
  484. } else {
  485. console.log('非待发货(包含运费)或者非是最后一件')
  486. console.log(this.data.isLastProd)
  487. wx.showLoading();
  488. var params = {
  489. url: "/p/orderRefund/apply",
  490. method: "POST",
  491. data: {
  492. orderNumber: this.data.orderNumber, //订单编号
  493. applyType: this.data.applyType, //退款方式(1:仅退款 2退款退货)
  494. isReceiver: Number(this.data.isReceiver), //货物状态(1:已收到货 0:未收到货)
  495. buyerReason: refundReasonArray[this.data.buyerReason], //退款原因
  496. goodsNum: this.data.goodsNum, //退款数量(0或不传值则为全部数量)
  497. refundAmount: this.data.refundAmount, //退款金额
  498. buyerMobile: this.data.buyerMobile, //手机号码(默认当前订单手机号码)
  499. buyerDesc: this.data.buyerDesc, //备注说明
  500. photoFiles: pics, //凭证图片列表
  501. refundType: this.data.refundType, //退款单类型(1:整单退款,2:单个物品退款)
  502. orderItemId: this.data.refundItem.orderItemId
  503. },
  504. callBack: (res) => {
  505. wx.hideLoading();
  506. // 去到我的退款订单页面
  507. wx.redirectTo({
  508. url: '/pages/afterSales/afterSales',
  509. })
  510. }
  511. };
  512. http.request(params);
  513. }
  514. }
  515. },
  516. /**
  517. * 修改退款申请
  518. */
  519. alterRefundApply: function(e) {
  520. },
  521. /**
  522. * 将获取到的input内容放进数据里
  523. */
  524. onDescInput: function(e) {
  525. this.setData({
  526. buyerDesc: e.detail.value
  527. });
  528. },
  529. onRefInput: function(e) {
  530. this.setData({
  531. refundAmount: e.detail.value
  532. })
  533. },
  534. onMobileInput: function(e) {
  535. this.setData({
  536. buyerMobile: e.detail.value
  537. })
  538. },
  539. /**
  540. * 退款图片预览
  541. */
  542. refundPicPreView(e) {
  543. var idx = e.currentTarget.dataset.idx
  544. var urls = []
  545. this.data.photoFiles.forEach(el => {
  546. urls.push(el.url)
  547. })
  548. wx.previewImage({
  549. current: urls[idx],
  550. urls: urls
  551. })
  552. },
  553. /**
  554. * 生命周期函数--监听页面初次渲染完成
  555. */
  556. onReady: function() {
  557. },
  558. /**
  559. * 生命周期函数--监听页面显示
  560. */
  561. onShow: function() {
  562. },
  563. /**
  564. * 生命周期函数--监听页面隐藏
  565. */
  566. onHide: function() {
  567. },
  568. /**
  569. * 生命周期函数--监听页面卸载
  570. */
  571. onUnload: function() {
  572. },
  573. /**
  574. * 页面相关事件处理函数--监听用户下拉动作
  575. */
  576. onPullDownRefresh: function() {
  577. },
  578. /**
  579. * 页面上拉触底事件的处理函数
  580. */
  581. onReachBottom: function() {
  582. },
  583. /**
  584. * 用户点击右上角分享
  585. */
  586. onShareAppMessage: function() {
  587. }
  588. })