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.

203 lines
4.1 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. id: "",
  11. organizationType: "",
  12. merchantShortname: "",
  13. servicePhone: "",
  14. },
  15. save(e) {
  16. let flag = e.currentTarget.dataset.flag
  17. let errMeg = "";
  18. let errFlag = false;
  19. if (!this.data.merchantShortname) {
  20. errMeg = "请输入店铺名称"
  21. errFlag = true
  22. } else if (!this.data.servicePhone) {
  23. errMeg = "请输入客服电话"
  24. errFlag = true
  25. }
  26. if (errFlag) {
  27. wx.showToast({
  28. title: errMeg,
  29. icon: "none",
  30. duration: 2000
  31. })
  32. return
  33. }
  34. let parame = {
  35. id: this.data.id,
  36. organizationType: this.data.organizationType,
  37. merchantShortname: this.data.merchantShortname,
  38. servicePhone: this.data.servicePhone,
  39. };
  40. Http.post({
  41. url: config.api.receiverAdd,
  42. data: parame
  43. }).then(res => {
  44. console.log(res, "res")
  45. if (flag == "save") {
  46. wx.reLaunch({
  47. url: '/pages/warehouse/warehouse',
  48. })
  49. } else if (flag == "next") {
  50. wx.navigateTo({
  51. url: '/pages/warehouse/detail/industryFirm/industryFirm',
  52. })
  53. }
  54. }).catch(err => {
  55. wx.showToast({
  56. title: err.message,
  57. icon: "none",
  58. duration: 2000
  59. })
  60. })
  61. },
  62. getReceiverApply() {
  63. wx.showLoading({
  64. title: '加载中...',
  65. })
  66. Http.get({
  67. url: config.api.getReceiverApply,
  68. data: {
  69. merchantId: app.globalData.merchant.merchant_id
  70. }
  71. }).then(res => {
  72. if (res.data && res.data.organizationType) {
  73. this.setData({
  74. organizationType: res.data.organizationType
  75. })
  76. }
  77. if (res.data && res.data.id) {
  78. this.setData({
  79. id: res.data.id
  80. })
  81. }
  82. if (res.data && res.data.merchantShortname) {
  83. this.setData({
  84. merchantShortname: res.data.merchantShortname
  85. })
  86. }
  87. if (res.data && res.data.servicePhone) {
  88. this.setData({
  89. servicePhone: res.data.servicePhone
  90. })
  91. }
  92. wx.hideLoading();
  93. }).catch(err => {
  94. wx.hideLoading();
  95. wx.showToast({
  96. title: err.message,
  97. icon: "none",
  98. duration: 2000
  99. })
  100. })
  101. },
  102. setMerchantShortname(e) {
  103. let value = e.detail.value.trim()
  104. this.setData({
  105. merchantShortname: value
  106. })
  107. },
  108. setServicePhone(e) {
  109. let value = e.detail.value.trim()
  110. this.setData({
  111. servicePhone: value
  112. })
  113. },
  114. showImg1() {
  115. wx.previewImage({
  116. current: 'https://formall.oss-accelerate.aliyuncs.com/789/malinkbapi/2022-08-24/0df5c9256e8d4e32b4b99ab866a885f6.png', // 当前显示图片的 http 链接
  117. urls: ['https://formall.oss-accelerate.aliyuncs.com/789/malinkbapi/2022-08-24/0df5c9256e8d4e32b4b99ab866a885f6.png'] // 需要预览的图片 http 链接列表
  118. })
  119. },
  120. showImg2() {
  121. wx.previewImage({
  122. current: 'https://formall.oss-accelerate.aliyuncs.com/789/malinkadmin/2022-08-17/7d01489194be41bcad54f63e3188e815.png', // 当前显示图片的 http 链接
  123. urls: ['https://formall.oss-accelerate.aliyuncs.com/789/malinkadmin/2022-08-17/7d01489194be41bcad54f63e3188e815.png'] // 需要预览的图片 http 链接列表
  124. })
  125. },
  126. /**
  127. * 生命周期函数--监听页面加载
  128. */
  129. onLoad: function (options) {
  130. this.getReceiverApply()
  131. },
  132. /**
  133. * 生命周期函数--监听页面初次渲染完成
  134. */
  135. onReady: function () {
  136. },
  137. /**
  138. * 生命周期函数--监听页面显示
  139. */
  140. onShow: function () {
  141. },
  142. /**
  143. * 生命周期函数--监听页面隐藏
  144. */
  145. onHide: function () {
  146. },
  147. /**
  148. * 生命周期函数--监听页面卸载
  149. */
  150. onUnload: function () {
  151. },
  152. /**
  153. * 页面相关事件处理函数--监听用户下拉动作
  154. */
  155. onPullDownRefresh: function () {
  156. },
  157. /**
  158. * 页面上拉触底事件的处理函数
  159. */
  160. onReachBottom: function () {
  161. },
  162. /**
  163. * 用户点击右上角分享
  164. */
  165. onShareAppMessage: function () {
  166. }
  167. })