sugar1569 пре 7 година
родитељ
комит
c3b57d3ded

+ 11 - 11
application/admin/view/system/system_databackup/index.php

@@ -84,12 +84,12 @@
             elem: '#fileList'
             elem: '#fileList'
             ,url:"{:Url('fileList')}"
             ,url:"{:Url('fileList')}"
             ,cols: [[
             ,cols: [[
-                {field: 'filename', title: '备份名称', sort: true},
-                {field: 'part', title: 'part'},
-                {field: 'size', title: '大小'},
-                {field: 'compress', title: 'compress'},
-                {field: 'backtime', title: '时间'},
-                {fixed: 'right', title: '操作', width: '20%', align: 'center', toolbar: '#fileListtool'}
+                {field: 'filename', title: '备份名称', sort: true,width:'25%'},
+                {field: 'part', title: 'part',width:'10%'},
+                {field: 'size', title: '大小',width:'10%'},
+                {field: 'compress', title: 'compress',width:'10%'},
+                {field: 'backtime', title: '时间',width:'20%'},
+                {fixed: 'right', title: '操作', width: '25%', align: 'center', toolbar: '#fileListtool'}
             ]]
             ]]
             ,page: false
             ,page: false
         });
         });
@@ -128,11 +128,11 @@
             ,toolbar: '#toolbarDemo'
             ,toolbar: '#toolbarDemo'
             ,cols: [[
             ,cols: [[
                 {type:'checkbox'},
                 {type:'checkbox'},
-                {field: 'name', title: '表名称', sort: true},
-                {field: 'comment', title: '备注' },
-                {field: 'engine', title: '类型', sort: true},
-                {field: 'data_length', title: '大小', sort: true,totalRow: true},
-                {field: 'update_time', title: '更新时间', sort: true},
+                {field: 'name', title: '表名称', sort: true,width:'20%'},
+                {field: 'comment', title: '备注',width:'20%'},
+                {field: 'engine', title: '类型', sort: true,width:'10%'},
+                {field: 'data_length', title: '大小',width:'10%', sort: true,totalRow: true},
+                {field: 'update_time', title: '更新时间',width:'20%', sort: true},
                 {field: 'rows', title: '行数'},
                 {field: 'rows', title: '行数'},
                 {fixed: 'right', title: '操作', width: '10%', align: 'center', toolbar: '#barDemo'}
                 {fixed: 'right', title: '操作', width: '10%', align: 'center', toolbar: '#barDemo'}
             ]]
             ]]

+ 2 - 2
application/admin/view/wechat/wechat_user/index.php

@@ -471,7 +471,7 @@
             }
             }
         }
         }
         var str = chk_value.join(',');
         var str = chk_value.join(',');
-        var url = "http://"+window.location.host+"/admin/store.store_coupon/grant/id/"+str;
+        var url = "http://"+window.location.host+"/admin/ump.store_coupon/grant/id/"+str;
         $eb.createModalFrame(this.innerText,url,{'w':800});
         $eb.createModalFrame(this.innerText,url,{'w':800});
     })
     })
     $('.news').on('click',function (e) {
     $('.news').on('click',function (e) {
@@ -494,7 +494,7 @@
             }
             }
         }
         }
         var str = chk_value.join(',');
         var str = chk_value.join(',');
-        var url = "http://"+window.location.host+"/admin/wechat.wechat_news_category/send_news/id/"+str;
+        var url = "{:Url('wechat.wechat_news_category/send_news')}?id="+str;
         $eb.createModalFrame(this.innerText,url,{'w':800});
         $eb.createModalFrame(this.innerText,url,{'w':800});
     })
     })
     $('.synchro').on('click',function(){
     $('.synchro').on('click',function(){

+ 26 - 4
application/routine/controller/AuthApi.php

@@ -1441,7 +1441,9 @@ class AuthApi extends AuthController{
         if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain));
         if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain));
         if(file_exists($picname)) return JsonService::successful($domain.$picname);
         if(file_exists($picname)) return JsonService::successful($domain.$picname);
         else{
         else{
-            file_put_contents($picname,RoutineCode::getCode($this->userInfo['uid']));
+            $res = RoutineCode::getCode($this->userInfo['uid'],$picname);
+            if($res) file_put_contents($picname,$res);
+            else return JsonService::fail('二维码生成失败');
         }
         }
         return JsonService::successful($domain.$picname);
         return JsonService::successful($domain.$picname);
     }
     }
@@ -1949,6 +1951,27 @@ class AuthApi extends AuthController{
         return JsonService::successful($content);
         return JsonService::successful($content);
     }
     }
 
 
+    /**
+     * 产品海报二维码
+     * @param int $id
+     */
+    public function product_promotion_code($id = 0){
+        if(!$id) return JsonService::fail('参数错误');
+        $count = StoreProduct::validWhere()->count();
+        if(!$count) return JsonService::fail('参数错误');
+        $path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
+        $codePath = $path.DS.$id.'_'.$this->userInfo['uid'].'.jpg';
+        $domain = SystemConfigService::get('site_url').'/';
+        if(!file_exists($codePath)){
+            if(!is_dir($path)) mkdir($path,0777,true);
+            $res = RoutineCode::getCode($this->userInfo['uid'],$codePath,[],'/pages/product-con/index?id='.$id,'product_spread');
+            if($res) file_put_contents($codePath,$res);
+            else return JsonService::fail('二维码生成失败');
+        }
+        return JsonService::successful($domain.$codePath);
+    }
+
+
     public function poster($id = 0){
     public function poster($id = 0){
         if(!$id) return JsonService::fail('参数错误');
         if(!$id) return JsonService::fail('参数错误');
         $productInfo = StoreProduct::getValidProduct($id,'store_name,id,price,image,code_path');
         $productInfo = StoreProduct::getValidProduct($id,'store_name,id,price,image,code_path');
@@ -1957,9 +1980,8 @@ class AuthApi extends AuthController{
             $path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
             $path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
             $codePath = $path.DS.$productInfo['id'].'.jpg';
             $codePath = $path.DS.$productInfo['id'].'.jpg';
             if(!file_exists($codePath)){
             if(!file_exists($codePath)){
-                if(!is_dir($path))
-                    mkdir($path,0777,true);
-                file_put_contents($codePath,RoutineCode::getPages('pages/product-con/index?id='.$productInfo['id']));
+                if(!is_dir($path)) mkdir($path,0777,true);
+                $res = file_put_contents($codePath,RoutineCode::getPages('pages/product-con/index?id='.$productInfo['id']));
             }
             }
             $res = StoreProduct::edit(['code_path'=>$codePath],$id);
             $res = StoreProduct::edit(['code_path'=>$codePath],$id);
             if($res) $productInfo['code_path'] = $codePath;
             if($res) $productInfo['code_path'] = $codePath;

+ 3 - 1
application/routine/controller/Login.php

@@ -30,7 +30,9 @@ class Login extends Controller{
         else $data['unionid'] = '';
         else $data['unionid'] = '';
         $data['routine_openid'] = $res['openid'];
         $data['routine_openid'] = $res['openid'];
         $data['session_key'] = $res['session_key'];
         $data['session_key'] = $res['session_key'];
-        $data['uid'] = RoutineUser::routineOauth($data);
+        $dataOauthInfo = RoutineUser::routineOauth($data);
+        $data['uid'] = $dataOauthInfo['uid'];
+        $data['page'] = $dataOauthInfo['page'];
         $data['status'] = RoutineUser::isUserStatus($data['uid']);
         $data['status'] = RoutineUser::isUserStatus($data['uid']);
         return JsonService::successful($data);
         return JsonService::successful($data);
     }
     }

+ 25 - 15
application/routine/model/routine/RoutineCode.php

@@ -10,22 +10,32 @@ class RoutineCode{
      * @param array $color 二维码线条颜色
      * @param array $color 二维码线条颜色
      * @return mixed
      * @return mixed
      */
      */
-    public static function getCode($uid = 0,$color = array()){
+    public static function getCode($uid = 0,$imgUrl = '',$color = array(),$page = '',$thirdType = 'spread'){
         $accessToken = RoutineServer::get_access_token();
         $accessToken = RoutineServer::get_access_token();
-        $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$accessToken;
-        if($uid) $data['scene'] = $uid;
-        else $data['scene'] = 0;
-        if(empty($color)){
-            $color['r'] = 0;
-            $color['g'] = 0;
-            $color['b'] = 0;
-        }
-        $data['page'] = '';
-        $data['width'] = 430;
-        $data['auto_color'] = false;
-        $data['line_color'] = $color;
-        $data['is_hyaline'] = false;
-        return RoutineServer::curlPost($url,json_encode($data));
+        $res = RoutineQrcode::setRoutineQrcodeForever($uid,$thirdType,$page,$imgUrl);
+        if($res){
+            $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$accessToken;
+            if($uid) $data['scene'] = $res->id;
+            else $data['scene'] = 0;
+            if(empty($color)){
+                $color['r'] = 0;
+                $color['g'] = 0;
+                $color['b'] = 0;
+            }
+            $data['page'] = '';
+            $data['width'] = 430;
+            $data['auto_color'] = false;
+            $data['line_color'] = $color;
+            $data['is_hyaline'] = false;
+            $resCode = RoutineServer::curlPost($url,json_encode($data));
+            if($resCode){
+                $dataQrcode['status'] = 1;
+                $dataQrcode['url_time'] = time();
+                $res = RoutineQrcode::setRoutineQrcodeFind($res->id,$dataQrcode);
+                if($res) return $resCode;
+                else return false;
+            }else return false;
+        }else return false;
     }
     }
 
 
     /**
     /**

+ 74 - 0
application/routine/model/routine/RoutineQrcode.php

@@ -0,0 +1,74 @@
+<?php
+namespace  app\routine\model\routine;
+
+
+use basic\ModelBasic;
+use traits\ModelTrait;
+
+/**
+ * 小程序二维码Model
+ * Class RoutineQrcode
+ * @package app\routine\model\routine
+ */
+class RoutineQrcode extends ModelBasic {
+
+    use ModelTrait;
+
+    /**
+     * 添加二维码记录
+     * @param string $thirdType
+     * @param int $thirdId
+     * @return object
+     */
+    public static function setRoutineQrcodeForever($thirdId = 0,$thirdType = 'spread',$page = '',$imgUrl = ''){
+       $data['third_type'] = $thirdType;
+       $data['third_id'] = $thirdId;
+       $data['status'] = 0;
+       $data['add_time'] = time();
+       $data['page'] = $page;
+       $data['url_time'] = '';
+       $data['qrcode_url'] = $imgUrl;
+       return self::set($data);
+    }
+
+    /**
+     * 修改二维码地址
+     * @param int $id
+     * @param array $data
+     * @return bool
+     */
+    public static function setRoutineQrcodeFind($id = 0,$data = array()){
+        if(!$id) return false;
+        $count = self::getRoutineQrcodeFind($id);
+        if(!$count) return false;
+        return self::edit($data,$id,'id');
+    }
+
+    /**
+     * 获取二维码是否存在
+     * @param int $id
+     * @return int|string
+     */
+    public static function getRoutineQrcodeFind($id = 0){
+        if(!$id) return 0;
+        return self::where('id',$id)->count();
+    }
+
+    /**
+     * 获取小程序二维码信息
+     * @param int $id
+     * @param string $field
+     * @return array|bool|false|\PDOStatement|string|\think\Model
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function getRoutineQrcodeFindType($id = 0,$field = 'third_type,third_id,page'){
+        if(!$id) return false;
+        $count = self::getRoutineQrcodeFind($id);
+        if(!$count) return false;
+        return self::where('id',$id)->where('status',1)->field($field)->find();
+    }
+
+
+}

+ 18 - 10
application/routine/model/user/RoutineUser.php

@@ -7,6 +7,7 @@
 
 
 namespace app\routine\model\user;
 namespace app\routine\model\user;
 
 
+use app\routine\model\routine\RoutineQrcode;
 use basic\ModelBasic;
 use basic\ModelBasic;
 use traits\ModelTrait;
 use traits\ModelTrait;
 use app\routine\model\user\User;
 use app\routine\model\user\User;
@@ -33,6 +34,16 @@ class RoutineUser extends ModelBasic
         $routineInfo['session_key'] = $routine['session_key'];//会话密匙
         $routineInfo['session_key'] = $routine['session_key'];//会话密匙
         $routineInfo['unionid'] = $routine['unionid'];//用户在开放平台的唯一标识符
         $routineInfo['unionid'] = $routine['unionid'];//用户在开放平台的唯一标识符
         $routineInfo['user_type'] = 'routine';//用户类型
         $routineInfo['user_type'] = 'routine';//用户类型
+        $page = '';//跳转小程序的页面
+        $spid = 0;//绑定关系uid
+        //获取是否有扫码进小程序
+        if($routine['spid']){
+            $info = RoutineQrcode::getRoutineQrcodeFindType($routine['spid']);
+            if($info){
+                $spid = $info['third_id'];
+                $page = $info['page'];
+            }
+        }
         //  判断unionid  存在根据unionid判断
         //  判断unionid  存在根据unionid判断
         if($routineInfo['unionid'] != '' && WechatUser::be(['unionid'=>$routineInfo['unionid']])){
         if($routineInfo['unionid'] != '' && WechatUser::be(['unionid'=>$routineInfo['unionid']])){
             WechatUser::edit($routineInfo,$routineInfo['unionid'],'unionid');
             WechatUser::edit($routineInfo,$routineInfo['unionid'],'unionid');
@@ -41,21 +52,18 @@ class RoutineUser extends ModelBasic
         }else if(WechatUser::be(['routine_openid'=>$routineInfo['routine_openid']])){ //根据小程序openid判断
         }else if(WechatUser::be(['routine_openid'=>$routineInfo['routine_openid']])){ //根据小程序openid判断
             WechatUser::edit($routineInfo,$routineInfo['routine_openid'],'routine_openid');
             WechatUser::edit($routineInfo,$routineInfo['routine_openid'],'routine_openid');
             $uid = WechatUser::where('routine_openid',$routineInfo['routine_openid'])->value('uid');
             $uid = WechatUser::where('routine_openid',$routineInfo['routine_openid'])->value('uid');
-            if(!User::be(['uid'=>$uid])){
-                $routineInfo = WechatUser::where('uid',$uid)->find();
-                User::setRoutineUser($routineInfo);
-            }else{
-                User::updateWechatUser($routineInfo,$uid);
-            }
+            User::updateWechatUser($routineInfo,$uid);
         }else{
         }else{
             $routineInfo['add_time'] = time();//用户添加时间
             $routineInfo['add_time'] = time();//用户添加时间
             $routineInfo = WechatUser::set($routineInfo);
             $routineInfo = WechatUser::set($routineInfo);
-            if(User::isUserSpread($routine['spid'])) {
-                $res = User::setRoutineUser($routineInfo,$routine['spid']); //用户上级
-            } else  $res = User::setRoutineUser($routineInfo);
+            if(User::isUserSpread($spid)) {
+                $res = User::setRoutineUser($routineInfo,$spid); //用户上级
+            }else $res = User::setRoutineUser($routineInfo);
             $uid = $res->uid;
             $uid = $res->uid;
         }
         }
-        return $uid;
+        $data['page'] = $page;
+        $data['uid'] = $uid;
+        return $data;
     }
     }
 
 
     /**
     /**

+ 161 - 0
application/wap/controller/Store.php

@@ -107,7 +107,9 @@ class Store extends AuthController
         $storeInfo['userCollect'] = StoreProductRelation::isProductRelation($id,$this->userInfo['uid'],'collect');
         $storeInfo['userCollect'] = StoreProductRelation::isProductRelation($id,$this->userInfo['uid'],'collect');
         list($productAttr,$productValue) = StoreProductAttr::getProductAttrDetail($id);
         list($productAttr,$productValue) = StoreProductAttr::getProductAttrDetail($id);
         setView($this->userInfo['uid'],$id,$storeInfo['cate_id'],'viwe');
         setView($this->userInfo['uid'],$id,$storeInfo['cate_id'],'viwe');
+        $urlShare = SystemConfigService::get('site_url').Url::build('wap/Store/detail',['id'=>$id,'spuid'=>$this->uid]);
         $this->assign([
         $this->assign([
+            'urlShare'=>$urlShare,
             'storeInfo'=>$storeInfo,
             'storeInfo'=>$storeInfo,
             'similarity'=>StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'],'id,store_name,image,price,sales',4),
             'similarity'=>StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'],'id,store_name,image,price,sales',4),
             'productAttr'=>$productAttr,
             'productAttr'=>$productAttr,
@@ -176,10 +178,98 @@ class Store extends AuthController
 
 
         return $this->fetch();
         return $this->fetch();
     }
     }
+
+    public function combination(){
+        $where = array();
+        $store_combination = StoreCombination::getAll(0,20);
+        $this->assign('list',$store_combination);
+        return $this->fetch();
+    }
     //获取列表
     //获取列表
     public function get_list(){
     public function get_list(){
         return JsonService::successful(StoreCombination::get_list(20));
         return JsonService::successful(StoreCombination::get_list(20));
     }
     }
+
+    public function combination_detail($id = 0){
+        if(!$id) return $this->failed('拼团不存在或已下架');
+        $combinationOne = StoreCombination::getCombinationOne($id);
+        if(!$combinationOne) return $this->failed('拼团不存在或已下架');
+        $combinationOne['images'] = json_decode($combinationOne['images'],true);
+        $combinationOne['userLike'] = StoreProductRelation::isProductRelation($combinationOne['product_id'],$this->userInfo['uid'],'like');
+        $combinationOne['like_num'] = StoreProductRelation::productRelationNum($combinationOne['product_id'],'like');
+        $combinationOne['userCollect'] = StoreProductRelation::isProductRelation($combinationOne['product_id'],$this->userInfo['uid'],'collect');
+        $pink = StorePink::getPinkAll($id);//拼团列表
+        setView($this->userInfo['uid'],$id,$combinationOne['cate_id'],'viwe','combination');
+        StoreCombination::editIncBrowse($id);
+        $pindAll = array();
+        foreach ($pink as $k=>$v){
+            $pink[$k]['count'] = StorePink::getPinkPeople($v['id'],$v['people']);
+            $pink[$k]['h'] = date('H',$v['stop_time']);
+            $pink[$k]['i'] = date('i',$v['stop_time']);
+            $pink[$k]['s'] = date('s',$v['stop_time']);
+            $pindAll[] = $v['id'];//开团团长ID
+        }
+        $user = WechatUser::get($this->uid)->toArray();//用户信息
+        $site_name = SystemConfig::getValue('site_name');//网站名称
+        $site_logo = SystemConfig::getValue('site_logo');//网站LOGO
+        $wechat_qrcode = SystemConfig::getValue('wechat_qrcode');//公众号二维码
+        $this->assign([
+            'pink'=>$pink,
+            'user'=>$user,
+            'site_name'=>$site_name,
+            'site_logo'=>$site_logo,
+            'wechat_qrcode'=>$wechat_qrcode,
+            'pindAll'=>$pindAll,
+            'storeInfo'=>$combinationOne,
+            'reply'=>StoreProductReply::getRecProductReply($combinationOne['product_id']),
+            'replyCount'=>StoreProductReply::productValidWhere()->where('product_id',$combinationOne['product_id'])->count(),
+            'mer_id' => StoreProduct::where('id',$combinationOne['product_id'])->value('mer_id')
+        ]);
+
+        return $this->fetch();
+    }
+
+    public function combination_order(Request $request){
+        $data = UtilService::getMore([
+            ['cartId',0],
+            ['pinkId',0],
+        ],$request);
+
+        if($data['pinkId']) if(StorePink::getIsPinkUid($data['pinkId'])) return $this->redirect(Url::build('my/order',['uni'=>StoreOrder::getStoreIdPink($data['pinkId'])]));
+        if($data['pinkId']) if(StoreOrder::getIsOrderPink($data['pinkId'])) return $this->redirect(Url::build('my/order',['uni'=>StoreOrder::getStoreIdPink($data['pinkId'])]));;
+        $cartId = $data['cartId'];
+        $pinkId = $data['pinkId'];
+        if(!is_string($cartId) || !$cartId )
+            return $this->failed('请提交购买的商品!');
+        $cartGroup = StoreCart::getUserCombinationProductCartList($this->userInfo['uid'],$cartId);
+        if(count($cartGroup['invalid']))
+            return $this->failed($cartGroup['invalid'][0]['productInfo']['store_name'].'已失效!');
+        if(!$cartGroup['valid']) return $this->failed('请提交购买的商品!');
+        $cartInfo = $cartGroup['valid'];
+        foreach ($cartInfo as $k=>$cart){
+            if($cart['combination_id']){
+                $cartInfo[$k]['productInfo']['price'] = StoreCombination::where('id',$cart['combination_id'])->value('price');
+                $cartInfo[$k]['productInfo']['image'] = StoreCombination::where('id',$cart['combination_id'])->value('image');
+                $cartInfo[$k]['productInfo']['slider_image'] = json_decode(StoreCombination::where('id',$cart['combination_id'])->value('images'),true);
+            }
+        }
+        $priceGroup = StoreOrder::getCombinationOrderPriceGroup($cartInfo);
+        $other = [
+            'offlinePostage'=>SystemConfigService::get('offline_postage'),
+            'integralRatio'=>SystemConfigService::get('integral_ratio')
+        ];
+        $this->assign([
+            'cartInfo'=>$cartInfo,
+            'priceGroup'=>$priceGroup,
+            'orderKey'=>StoreOrder::cacheOrderInfo($this->userInfo['uid'],$cartInfo,$priceGroup,$other),
+            'offlinePostage'=>$other['offlinePostage'],
+            'userInfo'=>User::getUserInfo($this->userInfo['uid']),
+            'integralRatio'=>$other['integralRatio'],
+            'pinkId'=>$pinkId
+        ]);
+
+        return $this->fetch();
+    }
     /**
     /**
      * 秒杀列表页
      * 秒杀列表页
      *
      *
@@ -224,4 +314,75 @@ class Store extends AuthController
         return $this->fetch();
         return $this->fetch();
     }
     }
 
 
+    public function cut_list(){
+        $bargain = StoreBargain::getList();
+        $bargain = StoreBargainUser::getUserList($bargain);
+        $bargainUser = StoreBargainUser::getBargainUserStatusSuccess();
+        $this->assign([
+            'bargain'=>$bargain,
+            'bargainUser'=>$bargainUser,
+        ]);
+        return $this->fetch();
+    }
+    public function cut_con($id = 0,$bargainUid = 0){
+       if(!$id) return $this->failed('参数错误');
+        //砍价产品
+        $bargain = StoreBargain::getBargainTerm($id);
+        $bargain['time'] = time();
+        $description = htmlspecialchars_decode($bargain['description']);
+        $rule = isset($bargain['rule']) ? htmlspecialchars_decode($bargain['rule']) : '';
+        if(!$bargainUid)
+            //判断当前登录人是不是砍价
+            if(!StoreBargainUser::isBargainUser($id,$this->userInfo['uid']))
+                // 参与砍价
+                if(!StoreBargainUser::setBargain($id,$this->userInfo['uid'])) return $this->failed('参与失败,请重新参与砍价',Url::build('store/bargain'));
+        //顶部人数
+        StoreBargain::addBargainLook($id);
+        $lookCount = StoreBargain::getBargainLook()['look'];//观看人数
+        $shareCount = StoreBargain::getBargainShare()['share'];//观看人数
+        //砍价
+        $selfCut = 0;
+        if(!$bargainUid){
+            $res = StoreBargainUserHelp::setBargainUserHelp($id,$bargainUid ? $bargainUid : $this->userInfo['uid'],$this->userInfo['uid']);
+            if($res) {
+                $selfCut = 1;
+                if(!StoreBargainUserHelp::getSurplusPrice($id,$bargainUid ? $bargainUid : $this->userInfo['uid'])){
+                    $bargainUserTableId = StoreBargainUser::getBargainUserTableId($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
+                    $bargain = StoreBargain::where('id',$id)->find()->toArray();
+                    $bargainUser = StoreBargainUser::where('id',$bargainUserTableId)->find()->toArray();
+                }
+            }
+            $userInfoBargain = $this->userInfo;
+        }else $userInfoBargain = User::getUserInfo($bargainUid);
+        //砍价帮
+        $bargainUserTableId = StoreBargainUser::setUserBargain($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
+        $storeBargainUserHelp = StoreBargainUserHelp::getList($bargainUserTableId,15);
+        //获取砍价帮总人数
+        $count = StoreBargainUserHelp::getBargainUserHelpPeopleCount($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
+        //获取用户还剩余的砍价金额
+        $price = StoreBargainUserHelp::getSurplusPrice($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
+        //获取砍价进度条
+        $pricePercent = StoreBargainUserHelp::getSurplusPricePercent($id,$bargainUid ? $bargainUid : $this->userInfo['uid']);
+        $selfCutPrice = bcsub(bcsub($bargain['price'],$price,2),$bargain['min_price'],2);
+        //判断当前登录人是否砍价   1 微砍价  2 已砍价
+        $userInfoBargainBool = StoreBargainUserHelp::isBargainUserHelpCount($id,$bargainUid,$this->userInfo['uid']) ? 1 : 2;
+        $this->assign([
+            'userInfoBargainBool'=>$userInfoBargainBool,
+            'selfCut'=>$selfCut,
+            'userInfoBargain'=>$userInfoBargain,
+            'selfCutPrice'=>$selfCutPrice,
+            'bargain'=>$bargain,
+            'description'=>$description,
+            'rule'=>$rule,
+            'shareCount'=>$shareCount,
+            'lookCount'=>$lookCount,
+            'userCount'=>StoreBargainUser::count(),
+            'userHelpList'=>$storeBargainUserHelp,
+            'count'=>$count,
+            'price'=>$price,
+            'pricePercent'=>$pricePercent,
+            'bargainUid'=>$bargainUid,
+        ]);
+       return $this->fetch();
+    }
 }
 }

+ 6 - 3
application/wap/view/first/store/detail.html

@@ -86,7 +86,9 @@
     <script ref="store_desc_temp" type="text/template">{$storeInfo.description}</script>
     <script ref="store_desc_temp" type="text/template">{$storeInfo.description}</script>
     <div style="height:1rem;"></div>
     <div style="height:1rem;"></div>
 </div>
 </div>
-<script>    window.$product = <?php unset($storeInfo['description']); echo json_encode($storeInfo);?>;
+<script>
+    window.$urlShare = "{$urlShare}";
+    window.$product = <?php unset($storeInfo['description']); echo json_encode($storeInfo);?>;
     window.$productAttr = <?php echo json_encode($productAttr) ?: '[]'; ?>;
     window.$productAttr = <?php echo json_encode($productAttr) ?: '[]'; ?>;
     window.$productValue = <?php echo json_encode($productValue) ?: '{}'; ?>;</script>
     window.$productValue = <?php echo json_encode($productValue) ?: '{}'; ?>;</script>
 <script
 <script
@@ -225,8 +227,9 @@
                     this.onMenuShareAll({
                     this.onMenuShareAll({
                         title: $product.store_name,
                         title: $product.store_name,
                         desc: $product.store_info || $product.store_name,
                         desc: $product.store_info || $product.store_name,
-                        imgUrl: location.origin + $product.image,
-                        link: location.href
+//                        imgUrl: location.origin + $product.image,
+                        imgUrl: $product.image,
+                        link: $urlShare || location.href
                     });
                     });
                 });
                 });
                 this.$nextTick(function () {
                 this.$nextTick(function () {

+ 21 - 10
application/wap/view/first/store/seckill_detail.html

@@ -3,6 +3,7 @@
 {block name="head_top"}
 {block name="head_top"}
 <link rel="stylesheet" href="{__PLUG_PATH}swiper/swiper-3.4.1.min.css">
 <link rel="stylesheet" href="{__PLUG_PATH}swiper/swiper-3.4.1.min.css">
 <script type="text/javascript" src="{__PLUG_PATH}swiper/swiper-3.4.1.jquery.min.js"></script>
 <script type="text/javascript" src="{__PLUG_PATH}swiper/swiper-3.4.1.jquery.min.js"></script>
+<script type="text/javascript" src="{__PLUG_PATH}layer/layer.js"></script>
 <script type="text/javascript" src="{__WAP_PATH}crmeb/js/jquery.downCount.js"></script>
 <script type="text/javascript" src="{__WAP_PATH}crmeb/js/jquery.downCount.js"></script>
 <style>
 <style>
     .product-con .product-info{position: relative;}
     .product-con .product-info{position: relative;}
@@ -33,16 +34,10 @@
                 <img class="logo" src="{$site.wechat_avatar}" alt="">
                 <img class="logo" src="{$site.wechat_avatar}" alt="">
                 <span>{$site.wechat_name}</span>
                 <span>{$site.wechat_name}</span>
             </div>
             </div>
-            <a class="go" href="javascript:void(0);" @click="qrShow = true">立即关注</a>
+            <a class="go" href="javascript:void(0);" @click="ShowQrcode">立即关注</a>
+            <!--<a class="go" href="javascript:void(0);" @click="qrShow = true">立即关注</a>-->
         </div>
         </div>
-        <div class="model-bg" :class="{on:qrShow == true}" v-cloak="" @click="qrShow = false" @touchmove.prevent></div>
         {/eq}
         {/eq}
-        <div class="rw-code-model" v-cloak="" v-show="qrShow == true">
-            <div class="rw-code-title"><p>{$site.wechat_name}</p ></div>
-            <div class="rw-code-img"><img src="{$site.wechat_qrcode}"></div>
-            <div class="rw-code-tips">长按二维码即可关注公众号</div>
-            <div class="rw-code-close" @click="qrShow = false"></div>
-        </div>
         <div class="banner">
         <div class="banner">
             <ul class="swiper-wrapper">
             <ul class="swiper-wrapper">
                 {volist name="storeInfo.images" id="vo"}
                 {volist name="storeInfo.images" id="vo"}
@@ -146,8 +141,10 @@
     window.$productAttr = <?php echo json_encode($productAttr)?:'[]'; ?>;
     window.$productAttr = <?php echo json_encode($productAttr)?:'[]'; ?>;
 </script>
 </script>
 <script type="text/javascript">
 <script type="text/javascript">
+    window.$wechat_qrcode = "{$site.wechat_qrcode}";
+    window.$site_name = "{$site.wechat_name}";
     (function ($) {
     (function ($) {
-        requirejs(['vue','axios','helper','store','wap/crmeb/module/store/seckill-card'],function(Vue,axios,$h,storeApi,shopCard){
+        requirejs(['vue','axios','helper','store','{__WAP_PATH}crmeb/module/store/seckill-card.js'],function(Vue,axios,$h,storeApi,shopCard){
             var mid = "<?=$mer_id?>";
             var mid = "<?=$mer_id?>";
             new Vue({
             new Vue({
                 el:"#store_detail",
                 el:"#store_detail",
@@ -157,6 +154,8 @@
                 data:{
                 data:{
                     cardShow:false,
                     cardShow:false,
                     product:$product,
                     product:$product,
+                    wechatQrcode: $wechat_qrcode,
+                    siteName: $site_name,
                     productAttr:$productAttr || [],
                     productAttr:$productAttr || [],
                     productCardInfo:{},
                     productCardInfo:{},
                     status:{
                     status:{
@@ -178,6 +177,18 @@
                     }
                     }
                 },
                 },
                 methods:{
                 methods:{
+                    ShowQrcode:function () {
+                        that = this;
+                        layer.open({
+                            type: 1,
+                            shade: true,
+                            shadeClose : true,
+                            anim  : 2,
+                            area: ['5rem', '5.1rem'],
+                            title: false, //不显示标题
+                            content: '<img src="'+that.wechatQrcode+'" alt="'+that.siteName+'" title="'+that.siteName+'" style="width: 5rem;"/>', //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
+                        });
+                    },
                     getProductTag:function(){
                     getProductTag:function(){
                         if(this.product.postage <= 0 || this.product.is_postage == 1)
                         if(this.product.postage <= 0 || this.product.is_postage == 1)
                             return ('<i class="send-txt">包邮</i>');
                             return ('<i class="send-txt">包邮</i>');
@@ -344,7 +355,7 @@
                         this.onMenuShareAll({
                         this.onMenuShareAll({
                             title:$product.store_name,
                             title:$product.store_name,
                             desc:$product.store_info || $product.store_name,
                             desc:$product.store_info || $product.store_name,
-                            imgUrl:location.origin+$product.image,
+                            imgUrl:$product.image,
                             link:location.href
                             link:location.href
                         });
                         });
                     });
                     });

+ 2 - 7
extend/behavior/wechat/UserBehavior.php

@@ -21,15 +21,10 @@ class UserBehavior
     public static function wechatOauthAfter($openid,$wechatInfo)
     public static function wechatOauthAfter($openid,$wechatInfo)
     {
     {
         Cookie::set('is_login',1);
         Cookie::set('is_login',1);
-        if($wechatInfo['unionid'] != '' && WechatUser::be(['unionid'=>$wechatInfo['unionid']])){
+        if(isset($wechatInfo['unionid']) && $wechatInfo['unionid'] != '' && WechatUser::be(['unionid'=>$wechatInfo['unionid']])){
             WechatUser::edit($wechatInfo,$wechatInfo['unionid'],'unionid');
             WechatUser::edit($wechatInfo,$wechatInfo['unionid'],'unionid');
             $uid = WechatUser::where('unionid',$wechatInfo['unionid'])->value('uid');
             $uid = WechatUser::where('unionid',$wechatInfo['unionid'])->value('uid');
-            if(!User::be(['uid'=>$uid])){
-                $wechatInfo = WechatUser::where('uid',$uid)->find();
-                User::setWechatUser($wechatInfo);
-            }else{
-                User::updateWechatUser($wechatInfo,$uid);
-            }
+            User::updateWechatUser($wechatInfo,$uid);
         }else if(WechatUser::be(['openid'=>$wechatInfo['openid']])){
         }else if(WechatUser::be(['openid'=>$wechatInfo['openid']])){
             WechatUser::edit($wechatInfo,$wechatInfo['openid'],'openid');
             WechatUser::edit($wechatInfo,$wechatInfo['openid'],'openid');
             User::updateWechatUser($wechatInfo,WechatUser::openidToUid($wechatInfo['openid']));
             User::updateWechatUser($wechatInfo,WechatUser::openidToUid($wechatInfo['openid']));

BIN
view/crmebN/images/poster-close.png


BIN
view/crmebN/images/posterbackgd.png


+ 9 - 3
view/crmebN/pages/load/load.js

@@ -46,9 +46,15 @@ Page({
                   url: app.globalData.openPages
                   url: app.globalData.openPages
                 })
                 })
               } else {//跳转到首页
               } else {//跳转到首页
-                wx.reLaunch({
-                  url: '/pages/index/index'
-                })
+                if(res.data.data.page){
+                    wx.navigateTo({
+                        url: res.data.data.page
+                    })
+                }else{
+                    wx.reLaunch({
+                        url: '/pages/index/index'
+                    })
+                }
               }
               }
             }
             }
           })
           })

Разлика између датотеке није приказан због своје велике величине
+ 845 - 626
view/crmebN/pages/product-con/index.js


+ 11 - 4
view/crmebN/pages/product-con/index.wxml

@@ -78,10 +78,10 @@
       <view class='txt-msg'>{{reply.comment}}</view>
       <view class='txt-msg'>{{reply.comment}}</view>
       <view class='time-bar'>{{reply.add_time}}</view>
       <view class='time-bar'>{{reply.add_time}}</view>
     </view>
     </view>
-    <view  wx:if="{{reply.merchant_reply_content != null}}">
-        <view></view>
-        <view class='time-bar'>回复:{{reply.merchant_reply_time}}</view>
-        <view class='txt-msg'>{{reply.merchant_reply_content}}</view>
+    <view>
+       <view>管理员回复:</view>
+      <view class='txt-msg'>{{reply.merchant_reply_content}}</view>
+      <view class='time-bar'>{{reply.merchant_reply_time}}</view>
     </view>
     </view>
     <navigator wx:if="{{replyCount > 0}}" hover-class="none" url="/pages/comment/comment?productId={{storeInfo.id}}">查看全部评价</navigator>
     <navigator wx:if="{{replyCount > 0}}" hover-class="none" url="/pages/comment/comment?productId={{storeInfo.id}}">查看全部评价</navigator>
   </view>
   </view>
@@ -116,6 +116,13 @@
     <view class='payment-btn' bindtap='goOrder'>确认下单</view>
     <view class='payment-btn' bindtap='goOrder'>确认下单</view>
   </view>
   </view>
 </view>
 </view>
+<view class='poster-pop' wx:if="{{posterImageStatus}}">
+   <image src='/images/poster-close.png' class='close' bindtap='posterImageClose'></image>
+   <image src='{{posterImage}}'></image>
+   <view class='save-poster' bindtap='savePosterPath'>保存到手机</view>
+</view>
+<view class='mask' wx:if="{{posterImageStatus}}"></view>
+<canvas class="canvas" canvas-id='myCanvas' wx:if="{{canvasStatus}}"></canvas>
 <include src="/pages/home/home.wxml"/>
 <include src="/pages/home/home.wxml"/>
 <include src="/pages/foo-tan/foo-tan.wxml"/>  
 <include src="/pages/foo-tan/foo-tan.wxml"/>  
 <import src="/wxParse/wxParse.wxml"/>
 <import src="/wxParse/wxParse.wxml"/>

Разлика између датотеке није приказан због своје велике величине
+ 12 - 9
view/crmebN/pages/product-con/index.wxss