Authored by 李奇

选择验证添加

@@ -508,6 +508,34 @@ class BuyNowController { @@ -508,6 +508,34 @@ class BuyNowController {
508 } 508 }
509 509
510 /** 510 /**
  511 + * 拼团预提交验证
  512 + * @param {*} req
  513 + * @param {*} res
  514 + * @param {*} next
  515 + */
  516 + groupOrderPreSub(req, res, next) {
  517 + let uid = req.user.uid;
  518 + let productSku = req.body.productSku;
  519 + let activityId = req.body.activityId;
  520 + let groupNo = req.body.groupNo || '';
  521 +
  522 + let params = {
  523 + uid: uid,
  524 + product_sku: productSku,
  525 + group_no: groupNo,
  526 + activity_id: activityId,
  527 + buy_number: 10
  528 + };
  529 +
  530 + co(function * () {
  531 + let result = yield req.ctx(BuyNowModel).groupBuyPayment(params);
  532 +
  533 + return res.json(result);
  534 + })().catch(next);
  535 + }
  536 +
  537 +
  538 + /**
511 * 选择地址 539 * 选择地址
512 * @param {*} req 540 * @param {*} req
513 * @param {*} res 541 * @param {*} res
@@ -71,6 +71,7 @@ router.get('/index/buynow/orderensure', authMW, disableBFCache, BuyNowController @@ -71,6 +71,7 @@ router.get('/index/buynow/orderensure', authMW, disableBFCache, BuyNowController
71 router.post('/index/buynow/ordercompute', authMW, BuyNowController.orderCompute); // 立即购买订单重新计算 71 router.post('/index/buynow/ordercompute', authMW, BuyNowController.orderCompute); // 立即购买订单重新计算
72 router.post('/index/buynow/ordersub', authMW, BuyNowController.orderSub); // 立即购买订单提交 72 router.post('/index/buynow/ordersub', authMW, BuyNowController.orderSub); // 立即购买订单提交
73 router.post('/index/buynow/groupordersub', authMW, BuyNowController.groupOrderSub); // 立即拼团订单提交 73 router.post('/index/buynow/groupordersub', authMW, BuyNowController.groupOrderSub); // 立即拼团订单提交
  74 +router.post('/index/buynow/grouporderPreSub', authMW, BuyNowController.groupOrderPreSub); // 立即拼团选择确定
74 router.get('/index/buynow/selectAddress', authMW, csrf, BuyNowController.selectAddress); // 选择地址 75 router.get('/index/buynow/selectAddress', authMW, csrf, BuyNowController.selectAddress); // 选择地址
75 router.get('/index/buynow/selectInvoice', authMW, BuyNowController.selectInvoice); // 发票信息 76 router.get('/index/buynow/selectInvoice', authMW, BuyNowController.selectInvoice); // 发票信息
76 router.get('/index/buynow/selectCoupon', authMW, BuyNowController.selectCoupon); // 选择优惠券页面 77 router.get('/index/buynow/selectCoupon', authMW, BuyNowController.selectCoupon); // 选择优惠券页面
@@ -292,6 +292,8 @@ class GroupProgress extends Page { @@ -292,6 +292,8 @@ class GroupProgress extends Page {
292 } 292 }
293 293
294 this.pickData._fullData = data.data; 294 this.pickData._fullData = data.data;
  295 + this.pickData.groupNo = this.data.groupNo;
  296 + this.pickData.activityId = this.data.activityId;
295 this.pickData.buyNumber = 1; 297 this.pickData.buyNumber = 1;
296 this.pickData.buy_limit_number = 1; 298 this.pickData.buy_limit_number = 1;
297 this.pickData.goodsList = data.data.goods_list; 299 this.pickData.goodsList = data.data.goods_list;
@@ -193,14 +193,29 @@ class ChosePanel { @@ -193,14 +193,29 @@ class ChosePanel {
193 * 点击确定 193 * 点击确定
194 */ 194 */
195 _choseBtnSureClick() { 195 _choseBtnSureClick() {
  196 + let self = this;
196 let skuId = this._checkSku(); 197 let skuId = this._checkSku();
197 198
198 if (skuId) { 199 if (skuId) {
  200 + $.ajax({
  201 + method: 'post',
  202 + url: '/cart/index/buynow/grouporderPreSub',
  203 + data: {
  204 + productSku: skuId,
  205 + activityId: self.data.activityId,
  206 + groupNo: self.data.groupNo,
  207 + }
  208 + }).then(data => {
  209 + if (data && data.code === 200) {
199 this._resolve && this._resolve({ 210 this._resolve && this._resolve({
200 sku: {skuId}, 211 sku: {skuId},
201 buyNum: 1, // 拼团只支持一件 212 buyNum: 1, // 拼团只支持一件
202 buyNow: true 213 buyNow: true
203 }); 214 });
  215 + } else {
  216 + data.message && tip.show(data.message);
  217 + }
  218 + });
204 } 219 }
205 } 220 }
206 221