123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- // pages/error/jiesuan/index.js
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- id: 0,
- order_id:0,
- isprice: false,
- info: '',
- updateprive: 0,
- choosetype: 0,
- typelist:['应付','退款'],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options)
- this.setData({id: options.id,order_id:options.order_id})
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getinfo()
- },
- getinfo() {
- let that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/abnormal_settlement", {id:that.data.id,order_id:that.data.order_id}, "get").then(function (res) {
- if (res.code != 200) {
- console.log(res.message.msg)
- wx.showLoading({
- title: res.message.msg,
- })
- } else {
- let pp = (res.message.data.order_price - res.message.data.coupon_money) - (res.message.data.total_price - res.message.data.freight)>=0?(res.message.data.order_price - res.message.data.coupon_money) - (res.message.data.total_price - res.message.data.freight) : 0
- that.setData({
- info: res.message.data,
- updateprive: pp
- })
- }
- wx.hideLoading();
- }).catch(function (err) {
- console.log(222);
- })
- },
- goover(){
- let that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/abnormal_end", {
- id:that.data.id,
- order_id:that.data.order_id
- }, "post").then(function (res) {
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(() => {
- wx.hideLoading();
- }, 2000);
- } else {
- wx.showLoading({
- title: '成功',
- })
- setTimeout(() => {
- wx.navigateBack()
- }, 2000);
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- changep(e){
- this.setData({updateprive:e.detail.value})
- console.log(e.detail.value)
- },
- goback(){
- wx.navigateBack()
- },
- gophone(){
- wx.makePhoneCall({
- phoneNumber: this.data.info.phone
- })
- },
- changeisprice(){
- let that = this
- if(that.data.isprice){
- that.setData({isprice:!that.data.isprice})
- }else{
- wx.showActionSheet({
- itemList: that.data.typelist,
- success (res) {
- that.setData({choosetype: res.tapIndex,isprice:!that.data.isprice})
- }
- })
- }
- },
- goconfirm(){
- let that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/abnormal_submit", {
- id:that.data.id,
- type:that.data.choosetype+1,
- price:that.data.updateprive
- }, "post").then(function (res) {
- if (res.code != 200) {
- console.log(res.message.msg)
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(() => {
- wx.hideLoading();
- that.changeisprice()
- }, 2000);
- } else {
- wx.showLoading({
- title: '成功',
- })
- setTimeout(() => {
- wx.navigateBack()
- }, 2000);
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|