qukaidi 4 år sedan
förälder
incheckning
3432f2ef5a
3 ändrade filer med 60 tillägg och 27 borttagningar
  1. 49 14
      luntai/rukutongji_body.html
  2. 7 13
      luntai/saomaruku.html
  3. 4 0
      script/httpRequest.js

+ 49 - 14
luntai/rukutongji_body.html

@@ -240,7 +240,7 @@
 				 * 扫码入库
 				 */
 				showPopups: function (item) {
-					if(this.checkNum>=this.couponNum){
+					if (this.checkNum >= this.couponNum) {
 						api.toast({
 							msg: "最多使用" + this.couponNum + "张优惠券"
 						});
@@ -262,9 +262,6 @@
 					this.selectedData = item
 					this.$post(url, data, function (ret) {
 						if (ret.code == 0) {
-							ret.data.map(function (e) {
-								e.checked = false;
-							})
 							_this.couponList = ret.data
 						}
 					})
@@ -272,15 +269,53 @@
 				selected: function (a) {
 					this.selectedData
 					var _this = this;
-					this.store
-						.filter(function (e) {
-							return e.tirenumber == _this.selectedData.tirenumber
-						})
-						.forEach(function (e) {
-							e.couponName = "-¥" + a.bonus;
-							e.couponId = a.id;
-							// e.checked=true
-						})
+					if (a.checked == false && this.selectedData.couponId == "") {
+						var data = {
+							"id": a.id,
+							"status": 3,
+							"type": 'body',
+							"url": 'json'
+						}
+						this.store
+							.filter(function (e) {
+								return e.tirenumber == _this.selectedData.tirenumber
+							})
+							.forEach(function (e) {
+								e.couponName = "-¥" + a.bonus;
+								e.couponId = a.id;
+							})
+					} else if (a.checked == true && this.selectedData.couponId == a.id) {
+						var data = {
+							"id": a.id,
+							"status": 1,
+							"type": 'body',
+							"url": 'json'
+						}
+						this.store
+							.filter(function (e) {
+								return e.tirenumber == _this.selectedData.tirenumber
+							})
+							.forEach(function (e) {
+								e.couponName = "选择优惠券";
+								e.couponId = "";
+							})
+					} else if (a.checked == true && this.selectedData.couponId != a.id) {
+						api.toast({
+							msg: '此优惠券已被选中,请选择其它优惠券',
+						});
+						return
+					} else {
+						api.toast({
+							msg: '最多选一张',
+						});
+						return
+					}
+					var url = "Couponupdate",
+						_this = this;
+					this.$post(url, data, function (ret) {
+						if (ret.code == 0) {
+						}
+					})
 					this.checkNum = 0
 					this.store.map(function (cart, index) {
 						if (cart.couponName != "选择优惠券") {
@@ -338,7 +373,7 @@
 			},
 			mounted: function () {
 				this.init();
-			}
+			},
 		})
 	}
 </script>

+ 7 - 13
luntai/saomaruku.html

@@ -301,19 +301,13 @@
 						type: 1
 					}
 					this.goWin('rukutongji_win', 'rukutongji_win.html', param);
-					//					    var data = {
-					//					        "materialList" : this.inputStore,
-					//					        "url" : 'json',
-					//					        "type" : 'body'
-					//					    },_this = this,url = "scanDoneU";
-					//					    this.$post(url,data,function(ret){
-					//					        if(ret.code == 0 || ret.code == '0'){
-					//					           api.toast({
-					//	                               msg:'预入库成功'
-					//                             });
-					//                             _this.goWin('rukutongji_win', 'rukutongji_win.html', '');
-					//					        }
-					//					    })
+					var data = {
+						"storeId": this.userId,
+						"url": 'json',
+						"type": 'body'
+					}, _this = this, url = "CouponupdateStatus";
+					this.$post(url, data, function (ret) {
+					})
 				}
 			},
 			mounted: function () {

+ 4 - 0
script/httpRequest.js

@@ -286,6 +286,10 @@ var $http = function () {
 	this.storeCouponMessage="/web/biz/bizGoods/storeCouponMessage"
 	//获取优惠券余数
 	this.residueCoupon="/web/biz/bizGoods/residueCoupon"
+	//更改修改状态
+	this.Couponupdate="/web/sys/bizStoreRegistrationSpree/update"
+	//返回时更改修改状态
+	this.CouponupdateStatus="/web/sys/bizStoreRegistrationSpree/updateStatus"
 }
 $http.prototype.$postFile = function (url, data, callback) {
 	var urlT = this.ip + eval('this.' + url);