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.

225 lines
4.3 KiB

  1. const config = require('../../config/config.js')
  2. const Http = require('../../utils/HttpBasics.js')
  3. const util = require('../../utils/util.js')
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. couponOrderStatus:0,
  11. idss: 1,
  12. pageNum: 1,
  13. seekFlag:"",
  14. selectArray: [
  15. {
  16. "id": "0",
  17. "value": "全部"
  18. },
  19. {
  20. "id": "1",
  21. "value": "商品名称搜索"
  22. }, {
  23. "id": "2",
  24. "text": "用户手机号搜索"
  25. }],
  26. tabTxt: [{
  27. title: '待发货',
  28. idss: 1,
  29. couponorderstatus:0,
  30. },
  31. {
  32. title: '已发货',
  33. idss: 2,
  34. couponorderstatus: 0,
  35. },
  36. {
  37. title: '已完成',
  38. idss: 3,
  39. couponorderstatus: 1,
  40. },
  41. {
  42. title: '全部',
  43. idss: 100,
  44. couponorderstatus: "",
  45. }
  46. ],
  47. list:[],
  48. pageNum: 1,
  49. title:"",
  50. cUserPhone:"",
  51. value:"",
  52. },
  53. setValue(e){
  54. let value = e.detail.value
  55. if(this.data.seekFlag==0){
  56. this.setData({
  57. title: "",
  58. cUserPhone: "",
  59. })
  60. }else if (this.data.seekFlag == 1){
  61. this.setData({
  62. title: value,
  63. cUserPhone: "",
  64. })
  65. }else{
  66. this.setData({
  67. title: "",
  68. cUserPhone: value,
  69. })
  70. }
  71. },
  72. gokuaidi(e) {
  73. let nu = e.currentTarget.dataset.nu
  74. wx.navigateToMiniProgram({
  75. appId: 'wx6885acbedba59c14',
  76. path: `pages/result/result?nu=${nu}&com=&querysource=third_xcx`
  77. })
  78. },
  79. search(e){
  80. if (e.currentTarget.dataset.pagenum == 1) {
  81. this.setData({
  82. pageNum: 1
  83. })
  84. }
  85. this.getList()
  86. },
  87. getList(){
  88. let data = {
  89. pageNum: this.data.pageNum,
  90. pageSize: 7,
  91. shippingStatus:this.data.idss,
  92. couponOrderStatus: this.data.couponOrderStatus
  93. }
  94. if (this.data.seekFlag==1){
  95. data.title = this.data.title
  96. } else if (this.data.seekFlag == 2){
  97. data.cUserPhone = this.data.cUserPhone
  98. }
  99. Http.get({
  100. url: config.api.goodsList,
  101. data
  102. }).then(res=>{
  103. let tempList = res.data.list
  104. tempList.map(item=>{
  105. item.createDate = util.formatTime(item.createDate, 'yyyy-MM-dddd hh:mm:ss')
  106. if (item.deliveryInfo){
  107. item.deliveryInfo = JSON.parse(item.deliveryInfo)
  108. }
  109. })
  110. let thenList = this.data.list
  111. let allLsit = [...thenList,...tempList]
  112. if(this.data.pageNum>1){
  113. this.setData({
  114. list: allLsit
  115. })
  116. }else{
  117. // tempList.map(item => {
  118. // item.createDate = util.formatTime(item.createDate, 'yyyy-MM-dddd hh:mm:ss')
  119. // })
  120. this.setData({
  121. list: tempList
  122. })
  123. }
  124. }).catch(err=>{
  125. wx.showToast({
  126. title: err.message,
  127. icon:"none"
  128. })
  129. })
  130. },
  131. select: function(e) {
  132. this.setData({
  133. seekFlag:e.detail.id,
  134. title: "",
  135. cUserPhone: "",
  136. value:"",
  137. })
  138. },
  139. // 选项卡
  140. filterTab: function(e) {
  141. let that = this;
  142. that.setData({
  143. idss: e.target.dataset.idss || e.currentTarget.dataset.idss,
  144. pageNum: 1,
  145. title: "",
  146. cUserPhone: "",
  147. value: "",
  148. pageNum:1,
  149. couponOrderStatus: e.currentTarget.dataset.couponorderstatus
  150. })
  151. this.getList()
  152. },
  153. goShipments(e){
  154. let id = e.currentTarget.dataset.id
  155. wx.navigateTo({
  156. url: `/pages/deliveryDetails/deliveryDetails?id=${id}`,
  157. })
  158. },
  159. /**
  160. * 生命周期函数--监听页面加载
  161. */
  162. onLoad: function(options) {
  163. },
  164. /**
  165. * 生命周期函数--监听页面初次渲染完成
  166. */
  167. onReady: function() {
  168. },
  169. /**
  170. * 生命周期函数--监听页面显示
  171. */
  172. onShow: function() {
  173. this.getList()
  174. },
  175. /**
  176. * 生命周期函数--监听页面隐藏
  177. */
  178. onHide: function() {
  179. },
  180. /**
  181. * 生命周期函数--监听页面卸载
  182. */
  183. onUnload: function() {
  184. },
  185. /**
  186. * 页面相关事件处理函数--监听用户下拉动作
  187. */
  188. onPullDownRefresh: function() {
  189. },
  190. /**
  191. * 页面上拉触底事件的处理函数
  192. */
  193. onReachBottom: function() {
  194. console.log("到底了")
  195. this.setData({
  196. pageNum: this.data.pageNum+1
  197. })
  198. this.getList()
  199. },
  200. /**
  201. * 用户点击右上角分享
  202. */
  203. onShareAppMessage: function() {
  204. }
  205. })