actExchangeCoupon: function() { var that = this; Alert.prompt('请输入优惠码', function ( code ) { if (code && $.trim( code ).length) { that.model.add(code); } }); },
success: function( response ) { if ( response && response.ret === 0 ) { Alert.show('优惠券添加成功!'); var list = that.get('couponList'); var currentCoupon = response.content.coupon_info; list.unshift( currentCoupon ); that.set({ list: list, currentCoupon: currentCoupon, index: that.get('index') + 1 }); } else if ( response && response.ret === 100021 ) { Alert.show( response.msg, function() { location.reload(); }); } else { Alert.show( response.msg ); } }
success: function (_, response) { if (response && response.ret === 0) { var content = response.content; that.set( $.extend( chooseData, { couponList: couponData.concat( content.coupon_list ), total: content.total, index: couponDataLen - 1, unable_total: content.unable_total })); } else { that.set( $.extend( chooseData, { couponList: [] }) ); if (response && response.ret === 100021) { Alert.show(response.msg, function() { location.reload(); }); } } },
error: function () { that.set( $.extend( chooseData, { couponList: [] })); Alert.show("网络不太好"); }
errorHandle: function () { var errMsg = this.model.get('errMsg'); Loading.hide(); Alert.show( errMsg ); },