details.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. // pages/infor/details.js
  2. const app = getApp()
  3. var sever = require("../../api.js").sever;
  4. console.log(sever)
  5. Page({
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. showinfofalse:true,
  16. showinfotrue:false,
  17. showinfo:false,
  18. pic_url: '',
  19. showpic:false,
  20. expected_time:'',
  21. msg:'',
  22. order_num: 0,
  23. order_status: '',
  24. order_created_time: '',
  25. gType: '',
  26. gCategory: '',
  27. gColor: '',
  28. gDescription: '',
  29. uName: '',
  30. uMobile: '',
  31. uAddress: '',
  32. theimgs: [],
  33. steps: [{
  34. // 此步骤是否当前完成状态
  35. current: false,
  36. // 此步骤是否已经完成
  37. done: true,
  38. // 此步骤显示文案
  39. text: '10.01',
  40. // 此步骤描述语
  41. desc: '步骤一'
  42. },
  43. {
  44. done: true,
  45. current: false,
  46. desc: '步骤二',
  47. text: '10.02'
  48. },
  49. {
  50. done: true,
  51. current: true,
  52. text: '10.03',
  53. desc: '步骤三'
  54. }
  55. ],
  56. pingjia: 0,
  57. status: 0,
  58. },
  59. si:function(){
  60. var that = this
  61. if(that.data.showinfo == true){
  62. that.setData({
  63. showinfo:false,
  64. showinfofalse: true,
  65. showinfotrue: false,
  66. })
  67. }else{
  68. that.setData({
  69. showinfo: true,
  70. showinfofalse: false,
  71. showinfotrue: true,
  72. })
  73. }
  74. },
  75. onLoad: function() {
  76. var that = this
  77. console.log('detailpage')
  78. app.request({
  79. url: sever+'getorderdetail',
  80. method: 'get',
  81. data: {
  82. store_id: wx.getStorageSync('user').store_id,
  83. order_id: wx.getStorageSync('detail_order_id')
  84. },
  85. success: function(res) {
  86. console.log(res.data)
  87. var order = res.data.data.order
  88. var picArr = []
  89. picArr = [...order.picture]
  90. console.log(picArr)
  91. //picArr.push(order.picture.split(','))
  92. var stateArr = ["待审核", "待生产", "生产中", "待发货", "运输中", "待评价", "已评价", "已取消"]
  93. // that.setData({
  94. // msg:res.data.message
  95. // })
  96. that.setData({
  97. status:order.status,
  98. pic_url:order.qrcode,
  99. msg:order.remark,
  100. expected_time: order.expected_time,
  101. order_num: order.sno,
  102. order_status: stateArr[order.status],
  103. order_created_time: order.created_at,
  104. gCategory: order.category,
  105. gType: order.type,
  106. gColor: order.color,
  107. gDescription: order.question,
  108. uName: order.customer_name,
  109. uMobile: order.customer_phone,
  110. uAddress: order.customer_address,
  111. theimgs: [...picArr]
  112. })
  113. var progress = res.data.data.progress
  114. var pArr = []
  115. for (var i = 0; i < progress.length;i++){
  116. var pObj = {}
  117. pObj.done= true
  118. pObj.current=false
  119. pObj.text=progress[i].created_at
  120. pObj.desc=progress[i].description
  121. pArr.push(pObj)
  122. }
  123. if (that.data.status!=0) pArr[pArr.length - 1].current = true
  124. that.setData({
  125. steps:[...pArr]
  126. })
  127. }
  128. })
  129. },
  130. /**
  131. * 组件的方法列表
  132. */
  133. //methods: {
  134. assess: function() {
  135. wx.navigateTo({
  136. url: '../infor/assess',
  137. success: function() {},
  138. fail: function() {},
  139. complete: function() {}
  140. })
  141. },
  142. backhome: function () {
  143. wx.reLaunch({
  144. url: '/page/homePage/homePage',
  145. })
  146. },
  147. quxiao: function() {
  148. app.request({
  149. url: sever+'updatestatus',
  150. method: 'post',
  151. data: {
  152. store_id: wx.getStorageSync('user').store_id,
  153. order_id: wx.getStorageSync('detail_order_id'),
  154. status: 7,
  155. },
  156. success: function (res) {
  157. console.log(res.data)
  158. if(res.data.data.ok == true){
  159. wx.showToast({
  160. title: '取消成功',
  161. icon:'success',
  162. duration:1000,
  163. success: function () {
  164. wx.reLaunch({
  165. url: 'infor',
  166. })
  167. }
  168. })
  169. }else{
  170. wx.showToast({
  171. title: '取消失败',
  172. icon: 'none',
  173. duration: 1000
  174. })
  175. }
  176. },
  177. fail:()=>{
  178. wx.showToast({
  179. title: '取消失败',
  180. icon: 'none',
  181. duration: 1000
  182. })
  183. }
  184. })
  185. },
  186. shouhuo: function() {
  187. app.request({
  188. url: sever+'updatestatus',
  189. method: 'post',
  190. data: {
  191. store_id: wx.getStorageSync('user').store_id,
  192. order_id: wx.getStorageSync('detail_order_id'),
  193. status: 5,
  194. },
  195. success: function (res) {
  196. console.log(res.data)
  197. if (res.data.data.ok == true) {
  198. wx.showToast({
  199. title: '收货成功',
  200. icon: 'success',
  201. duration: 1000,
  202. success: function () {
  203. wx.reLaunch({
  204. url: 'infor',
  205. })
  206. }
  207. })
  208. } else {
  209. wx.showToast({
  210. title: '收货失败',
  211. icon: 'none',
  212. duration: 1000
  213. })
  214. }
  215. },
  216. fail:()=>{
  217. wx.showToast({
  218. title: '收货失败',
  219. icon: 'none',
  220. duration: 1000
  221. })
  222. }
  223. })
  224. },
  225. fanhui: function() {
  226. wx.navigateBack({
  227. delta: 1
  228. })
  229. },
  230. preImg:function(event){
  231. var src = event.currentTarget.dataset.src;//获取data-src
  232. var imgList = event.currentTarget.dataset.list;//获取data-list
  233. //图片预览
  234. wx.previewImage({
  235. current: src, // 当前显示图片的http链接
  236. urls: imgList // 需要预览的图片http链接列表
  237. })
  238. },
  239. showPic: function (event) {
  240. // var that = this
  241. // that.setData({
  242. // showpic: true
  243. // })
  244. var src = event.currentTarget.dataset.src;//获取data-src
  245. var imgList = [src];//获取data-list
  246. //图片预览
  247. wx.previewImage({
  248. current: src, // 当前显示图片的http链接
  249. urls: imgList // 需要预览的图片http链接列表
  250. })
  251. },
  252. hidepic: function () {
  253. var that = this
  254. that.setData({
  255. showpic: false
  256. })
  257. },
  258. upFormID: function (e) {
  259. console.log('....')
  260. app.request({
  261. url: sever+'saveformid',
  262. method: 'post',
  263. data: {
  264. store_id: wx.getStorageSync('user').store_id,
  265. openid: wx.getStorageSync('user').wechat_open_id,
  266. formid: e.detail.formId
  267. },
  268. success: (res) => {
  269. console.log(res.data.data.msg)
  270. }
  271. })
  272. }
  273. //}
  274. })