mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-18 16:02:55 +00:00
修复订单计算价格bug,添加首页推荐产品
This commit is contained in:
parent
13c13a3b07
commit
c33f99a659
@ -6,7 +6,6 @@ use app\routine\model\routine\RoutineCode;
|
|||||||
use app\routine\model\routine\RoutineFormId;
|
use app\routine\model\routine\RoutineFormId;
|
||||||
use app\routine\model\routine\RoutineTemplate;
|
use app\routine\model\routine\RoutineTemplate;
|
||||||
use app\routine\model\store\StoreCombination;
|
use app\routine\model\store\StoreCombination;
|
||||||
use behavior\routine\RoutineBehavior;
|
|
||||||
use service\JsonService;
|
use service\JsonService;
|
||||||
use service\GroupDataService;
|
use service\GroupDataService;
|
||||||
use service\RoutineBizDataCrypt;
|
use service\RoutineBizDataCrypt;
|
||||||
@ -14,10 +13,10 @@ use service\SystemConfigService;
|
|||||||
use service\UploadService;
|
use service\UploadService;
|
||||||
use service\UtilService;
|
use service\UtilService;
|
||||||
use think\Request;
|
use think\Request;
|
||||||
use behavior\wap\StoreProductBehavior;
|
|
||||||
use service\WechatTemplateService;
|
use service\WechatTemplateService;
|
||||||
use service\CacheService;
|
use service\CacheService;
|
||||||
use service\HookService;
|
use service\HookService;
|
||||||
|
use behavior\StoreProductBehavior;
|
||||||
use think\Url;
|
use think\Url;
|
||||||
use app\routine\model\store\StoreCouponUser;
|
use app\routine\model\store\StoreCouponUser;
|
||||||
use app\routine\model\store\StoreOrder;
|
use app\routine\model\store\StoreOrder;
|
||||||
@ -54,14 +53,6 @@ use app\routine\model\article\Article as ArticleModel;
|
|||||||
* Class AuthApi
|
* Class AuthApi
|
||||||
* @package app\routine\controller
|
* @package app\routine\controller
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* https://qipei.9gt.net/routine/auth_api/index 首页
|
|
||||||
* https://qipei.9gt.net/routine/auth_api/store 分类页面
|
|
||||||
* https://qipei.9gt.net/routine/auth_api/get_pid_cate 一级分类
|
|
||||||
* https://qipei.9gt.net/routine/auth_api/get_id_cate 二级分类
|
|
||||||
* https://qipei.9gt.net/routine/auth_api/get_product_list 分类页面产品
|
|
||||||
*/
|
*/
|
||||||
class AuthApi extends AuthController{
|
class AuthApi extends AuthController{
|
||||||
|
|
||||||
@ -88,7 +79,8 @@ class AuthApi extends AuthController{
|
|||||||
*/
|
*/
|
||||||
public function get_user_extract_bank(){
|
public function get_user_extract_bank(){
|
||||||
$extractBank = SystemConfig::getValue('user_extract_bank')?:[];//提现银行
|
$extractBank = SystemConfig::getValue('user_extract_bank')?:[];//提现银行
|
||||||
$extractBank = explode('=',$extractBank);
|
$extractBank = str_replace("\r\n","\n",$extractBank);//防止不兼容
|
||||||
|
$extractBank = explode("\n",$extractBank);
|
||||||
return JsonService::successful($extractBank);
|
return JsonService::successful($extractBank);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -99,14 +91,18 @@ class AuthApi extends AuthController{
|
|||||||
$menus = GroupDataService::getData('routine_home_menus')?:[];//banner图
|
$menus = GroupDataService::getData('routine_home_menus')?:[];//banner图
|
||||||
$lovely = GroupDataService::getData('routine_lovely')?:[];//猜你喜欢图
|
$lovely = GroupDataService::getData('routine_lovely')?:[];//猜你喜欢图
|
||||||
$best = StoreProduct::getBestProduct('id,image,store_name,cate_id,price,unit_name,sort',8);//精品推荐
|
$best = StoreProduct::getBestProduct('id,image,store_name,cate_id,price,unit_name,sort',8);//精品推荐
|
||||||
$new = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,sort',3);//今日上新
|
$new = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,sort',3);//首发
|
||||||
$hot = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name,sort',6);//猜你喜欢
|
$hot = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name,sort',8);//热卖
|
||||||
|
$benefit = StoreProduct::getBenefitProduct('id,image,store_name,cate_id,price,ot_price,stock,unit_name,sort',3);//促销
|
||||||
|
$like = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name,sort',6);//猜你喜欢
|
||||||
$data['banner'] = $banner;
|
$data['banner'] = $banner;
|
||||||
$data['lovely'] = $lovely[0];
|
$data['lovely'] = $lovely[0];
|
||||||
$data['menus'] = $menus;
|
$data['menus'] = $menus;
|
||||||
$data['best'] = $best;
|
$data['best'] = $best;
|
||||||
$data['new'] = $new;
|
$data['new'] = $new;
|
||||||
$data['hot'] = $hot;
|
$data['hot'] = $hot;
|
||||||
|
$data['benefit'] = $benefit;
|
||||||
|
$data['like'] = $like;
|
||||||
return JsonService::successful($data);
|
return JsonService::successful($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,14 +734,16 @@ class AuthApi extends AuthController{
|
|||||||
$orderInfo = StoreOrder::where('order_id',$orderId)->find();
|
$orderInfo = StoreOrder::where('order_id',$orderId)->find();
|
||||||
if(!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
|
if(!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
|
||||||
if($orderInfo['paid']) exception('支付已支付!');
|
if($orderInfo['paid']) exception('支付已支付!');
|
||||||
|
//如果支付金额为0
|
||||||
if(bcsub((float)$orderInfo['pay_price'],0,2) <= 0){
|
if(bcsub((float)$orderInfo['pay_price'],0,2) <= 0){
|
||||||
|
//创建订单jspay支付
|
||||||
if(StoreOrder::jsPayPrice($orderId,$this->userInfo['uid'],$formId))
|
if(StoreOrder::jsPayPrice($orderId,$this->userInfo['uid'],$formId))
|
||||||
return JsonService::status('success','微信支付成功',$info);
|
return JsonService::status('success','微信支付成功',$info);
|
||||||
else
|
else
|
||||||
return JsonService::status('pay_error',StoreOrder::getErrorInfo());
|
return JsonService::status('pay_error',StoreOrder::getErrorInfo());
|
||||||
}else{
|
}else{
|
||||||
try{
|
try{
|
||||||
$jsConfig = StoreOrder::jsPay($orderId);
|
$jsConfig = StoreOrder::jsPay($orderId);//创建订单jspay
|
||||||
}catch (\Exception $e){
|
}catch (\Exception $e){
|
||||||
return JsonService::status('pay_error',$e->getMessage(),$info);
|
return JsonService::status('pay_error',$e->getMessage(),$info);
|
||||||
}
|
}
|
||||||
@ -832,22 +830,23 @@ class AuthApi extends AuthController{
|
|||||||
else
|
else
|
||||||
return JsonService::fail(StoreOrder::getErrorInfo());
|
return JsonService::fail(StoreOrder::getErrorInfo());
|
||||||
}
|
}
|
||||||
|
//TODO 支付订单
|
||||||
/**
|
/**
|
||||||
* 支付订单
|
* 支付订单
|
||||||
* @param string $uni
|
* @param string $uni
|
||||||
* @return \think\response\Json
|
* @return \think\response\Json
|
||||||
*/
|
*/
|
||||||
public function pay_order($uni = '')
|
public function pay_order($uni = '',$paytype='weixin')
|
||||||
{
|
{
|
||||||
if(!$uni) return JsonService::fail('参数错误!');
|
if(!$uni) return JsonService::fail('参数错误!');
|
||||||
$order= StoreOrder::getUserOrderDetail($this->userInfo['uid'],$uni);
|
$order= StoreOrder::getUserOrderDetail($this->userInfo['uid'],$uni);
|
||||||
if(!$order) return JsonService::fail('订单不存在!');
|
if(!$order) return JsonService::fail('订单不存在!');
|
||||||
if($order['paid']) return JsonService::fail('该订单已支付!');
|
if($order['paid']) return JsonService::fail('该订单已支付!');
|
||||||
if($order['pink_id']) if(StorePink::isPinkStatus($order['pink_id'])) return JsonService::fail('该订单已失效!');
|
if($order['pink_id']) if(StorePink::isPinkStatus($order['pink_id'])) return JsonService::fail('该订单已失效!');
|
||||||
|
$order['pay_type'] = $paytype;//重新支付选择支付方式
|
||||||
if($order['pay_type'] == 'weixin'){
|
if($order['pay_type'] == 'weixin'){
|
||||||
try{
|
try{
|
||||||
$jsConfig = StoreOrder::jsPay($order);
|
$jsConfig = StoreOrder::jsPay($order);//订单列表发起支付
|
||||||
}catch (\Exception $e){
|
}catch (\Exception $e){
|
||||||
return JsonService::fail($e->getMessage());
|
return JsonService::fail($e->getMessage());
|
||||||
}
|
}
|
||||||
@ -1342,7 +1341,8 @@ class AuthApi extends AuthController{
|
|||||||
$arr = User::where('spread_uid',$this->userInfo['uid'])->column('uid');
|
$arr = User::where('spread_uid',$this->userInfo['uid'])->column('uid');
|
||||||
$list = StoreOrder::getUserOrderCount(implode(',',$arr),$type);
|
$list = StoreOrder::getUserOrderCount(implode(',',$arr),$type);
|
||||||
$price = [];
|
$price = [];
|
||||||
if(!empty($list)) foreach ($list as $k=>$v) $price[]=$v['pay_price'];
|
// if(!empty($list)) foreach ($list as $k=>$v) $price[]=$v['pay_price'];
|
||||||
|
if(!empty($list)) foreach ($list as $k=>$v) $price[]=$v;
|
||||||
$cont = count($list);
|
$cont = count($list);
|
||||||
$sum = array_sum($price);
|
$sum = array_sum($price);
|
||||||
return JsonService::successful(['cont'=>$cont,'sum'=>$sum]);
|
return JsonService::successful(['cont'=>$cont,'sum'=>$sum]);
|
||||||
@ -1436,7 +1436,7 @@ class AuthApi extends AuthController{
|
|||||||
$path = makePathToUrl('routine/code');
|
$path = makePathToUrl('routine/code');
|
||||||
if($path == '')
|
if($path == '')
|
||||||
return JsonService::fail('生成上传目录失败,请检查权限!');
|
return JsonService::fail('生成上传目录失败,请检查权限!');
|
||||||
$picname = $path.DS.$this->userInfo['uid'].'.jpg';
|
$picname = $path.'/'.$this->userInfo['uid'].'.jpg';
|
||||||
$domain = SystemConfigService::get('site_url').'/';
|
$domain = SystemConfigService::get('site_url').'/';
|
||||||
$domainTop = substr($domain,0,5);
|
$domainTop = substr($domain,0,5);
|
||||||
if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain));
|
if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain));
|
||||||
@ -1738,7 +1738,8 @@ class AuthApi extends AuthController{
|
|||||||
*/
|
*/
|
||||||
public function get_combination_list_banner(){
|
public function get_combination_list_banner(){
|
||||||
$lovely = GroupDataService::getData('routine_lovely')?:[];//banner图
|
$lovely = GroupDataService::getData('routine_lovely')?:[];//banner图
|
||||||
return JsonService::successful($lovely[3]);
|
$pic = isset($lovely[3])?$lovely[3]:'';
|
||||||
|
return JsonService::successful($pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1965,8 +1966,8 @@ class AuthApi extends AuthController{
|
|||||||
if(!$id) return JsonService::fail('参数错误');
|
if(!$id) return JsonService::fail('参数错误');
|
||||||
$count = StoreProduct::validWhere()->count();
|
$count = StoreProduct::validWhere()->count();
|
||||||
if(!$count) return JsonService::fail('参数错误');
|
if(!$count) return JsonService::fail('参数错误');
|
||||||
$path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product';
|
$path = UPLOAD_PATH.'/codepath/product/';
|
||||||
$codePath = $path.DS.$id.'_'.$this->userInfo['uid'].'.jpg';
|
$codePath = $path.$id.'_'.$this->userInfo['uid'].'.jpg';
|
||||||
$domain = SystemConfigService::get('site_url').'/';
|
$domain = SystemConfigService::get('site_url').'/';
|
||||||
if(!file_exists($codePath)){
|
if(!file_exists($codePath)){
|
||||||
if(!is_dir($path)) mkdir($path,0777,true);
|
if(!is_dir($path)) mkdir($path,0777,true);
|
||||||
|
|||||||
@ -136,7 +136,10 @@ class StoreBargainUserHelp extends ModelBasic
|
|||||||
$coverPrice = StoreBargainUser::getBargainUserDiffPrice($bargainId,$bargainUserId);//用户可以砍掉的金额
|
$coverPrice = StoreBargainUser::getBargainUserDiffPrice($bargainId,$bargainUserId);//用户可以砍掉的金额
|
||||||
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,$bargainUserId);
|
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,$bargainUserId);
|
||||||
$alreadyPrice= StoreBargainUser::getBargainUserPrice($bargainUserTableId);//用户已经砍掉的价格
|
$alreadyPrice= StoreBargainUser::getBargainUserPrice($bargainUserTableId);//用户已经砍掉的价格
|
||||||
|
if($alreadyPrice)
|
||||||
return bcmul(bcdiv($alreadyPrice,$coverPrice,2),100,0);
|
return bcmul(bcdiv($alreadyPrice,$coverPrice,2),100,0);
|
||||||
|
else
|
||||||
|
return 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ use service\HookService;
|
|||||||
use service\RoutineService;
|
use service\RoutineService;
|
||||||
use service\SystemConfigService;
|
use service\SystemConfigService;
|
||||||
use service\WechatService;
|
use service\WechatService;
|
||||||
use service\WechatTemplateService;
|
use service\RoutineTemplateService;
|
||||||
use think\Cache;
|
use think\Cache;
|
||||||
use think\Url;
|
use think\Url;
|
||||||
use traits\ModelTrait;
|
use traits\ModelTrait;
|
||||||
@ -56,25 +56,35 @@ class StoreOrder extends ModelBasic
|
|||||||
return json_decode($value,true);
|
return json_decode($value,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**获取订单组信息
|
||||||
|
* @param $cartInfo
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function getOrderPriceGroup($cartInfo)
|
public static function getOrderPriceGroup($cartInfo)
|
||||||
{
|
{
|
||||||
$storePostage = floatval(SystemConfigService::get('store_postage'))?:0;
|
$storePostage = floatval(SystemConfigService::get('store_postage'))?:0;//邮费基础价
|
||||||
$storeFreePostage = floatval(SystemConfigService::get('store_free_postage'))?:0;
|
$storeFreePostage = floatval(SystemConfigService::get('store_free_postage'))?:0;//满额包邮
|
||||||
$totalPrice = self::getOrderTotalPrice($cartInfo);
|
$totalPrice = self::getOrderTotalPrice($cartInfo);//获取订单总金额
|
||||||
$costPrice = self::getOrderCostPrice($cartInfo);
|
$costPrice = self::getOrderCostPrice($cartInfo);//获取订单成本价
|
||||||
|
//如果满额包邮等于0
|
||||||
if(!$storeFreePostage) {
|
if(!$storeFreePostage) {
|
||||||
$storePostage = 0;
|
$storePostage = 0;
|
||||||
}else{
|
}else{
|
||||||
foreach ($cartInfo as $cart){
|
foreach ($cartInfo as $cart){
|
||||||
if(!$cart['productInfo']['is_postage'])
|
if(!$cart['productInfo']['is_postage'])//若果产品不包邮
|
||||||
$storePostage = bcadd($storePostage,$cart['productInfo']['postage'],2);
|
$storePostage = bcadd($storePostage,$cart['productInfo']['postage'],2);
|
||||||
|
|
||||||
}
|
}
|
||||||
if($storeFreePostage <= $totalPrice) $storePostage = 0;
|
if($storeFreePostage <= $totalPrice) $storePostage = 0;//如果总价大于等于满额包邮 邮费等于0
|
||||||
}
|
}
|
||||||
|
// $totalPrice = bcadd($totalPrice,$storePostage,2);
|
||||||
return compact('storePostage','storeFreePostage','totalPrice','costPrice');
|
return compact('storePostage','storeFreePostage','totalPrice','costPrice');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**获取订单总金额
|
||||||
|
* @param $cartInfo
|
||||||
|
* @return int|string
|
||||||
|
*/
|
||||||
public static function getOrderTotalPrice($cartInfo)
|
public static function getOrderTotalPrice($cartInfo)
|
||||||
{
|
{
|
||||||
$totalPrice = 0;
|
$totalPrice = 0;
|
||||||
@ -83,6 +93,11 @@ class StoreOrder extends ModelBasic
|
|||||||
}
|
}
|
||||||
return $totalPrice;
|
return $totalPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**获取订单成本价
|
||||||
|
* @param $cartInfo
|
||||||
|
* @return int|string
|
||||||
|
*/
|
||||||
public static function getOrderCostPrice($cartInfo)
|
public static function getOrderCostPrice($cartInfo)
|
||||||
{
|
{
|
||||||
$costPrice=0;
|
$costPrice=0;
|
||||||
@ -164,6 +179,20 @@ class StoreOrder extends ModelBasic
|
|||||||
Cache::clear('user_order_'.$uid.$key);
|
Cache::clear('user_order_'.$uid.$key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**生成订单
|
||||||
|
* @param $uid
|
||||||
|
* @param $key
|
||||||
|
* @param $addressId
|
||||||
|
* @param $payType
|
||||||
|
* @param bool $useIntegral
|
||||||
|
* @param int $couponId
|
||||||
|
* @param string $mark
|
||||||
|
* @param int $combinationId
|
||||||
|
* @param int $pinkId
|
||||||
|
* @param int $seckill_id
|
||||||
|
* @param int $bargain_id
|
||||||
|
* @return bool|object
|
||||||
|
*/
|
||||||
public static function cacheKeyCreateOrder($uid,$key,$addressId,$payType,$useIntegral = false,$couponId = 0,$mark = '',$combinationId = 0,$pinkId = 0,$seckill_id=0,$bargain_id=0)
|
public static function cacheKeyCreateOrder($uid,$key,$addressId,$payType,$useIntegral = false,$couponId = 0,$mark = '',$combinationId = 0,$pinkId = 0,$seckill_id=0,$bargain_id=0)
|
||||||
{
|
{
|
||||||
if(!array_key_exists($payType,self::$payType)) return self::setErrorInfo('选择支付方式有误!');
|
if(!array_key_exists($payType,self::$payType)) return self::setErrorInfo('选择支付方式有误!');
|
||||||
@ -296,7 +325,7 @@ class StoreOrder extends ModelBasic
|
|||||||
$key = substr($orderId,16);
|
$key = substr($orderId,16);
|
||||||
return 'wx'.$ymd.date('His').$key;
|
return 'wx'.$ymd.date('His').$key;
|
||||||
}
|
}
|
||||||
|
//TODO JS支付
|
||||||
public static function jsPay($orderId,$field = 'order_id')
|
public static function jsPay($orderId,$field = 'order_id')
|
||||||
{
|
{
|
||||||
if(is_string($orderId))
|
if(is_string($orderId))
|
||||||
@ -309,20 +338,20 @@ class StoreOrder extends ModelBasic
|
|||||||
$openid = WechatUser::getOpenId($orderInfo['uid']);
|
$openid = WechatUser::getOpenId($orderInfo['uid']);
|
||||||
return RoutineService::payRoutine($openid,$orderInfo['order_id'],$orderInfo['pay_price'],'productr',SystemConfigService::get('site_name'));
|
return RoutineService::payRoutine($openid,$orderInfo['order_id'],$orderInfo['pay_price'],'productr',SystemConfigService::get('site_name'));
|
||||||
}
|
}
|
||||||
|
//TODO 余额支付
|
||||||
public static function yuePay($order_id,$uid,$formId = '')
|
public static function yuePay($order_id,$uid,$formId = '')
|
||||||
{
|
{
|
||||||
$orderInfo = self::where('uid',$uid)->where('order_id',$order_id)->where('is_del',0)->find();
|
$orderInfo = self::where('uid',$uid)->where('order_id',$order_id)->where('is_del',0)->find();
|
||||||
if(!$orderInfo) return self::setErrorInfo('订单不存在!');
|
if(!$orderInfo) return self::setErrorInfo('订单不存在!');
|
||||||
if($orderInfo['paid']) return self::setErrorInfo('该订单已支付!');
|
if($orderInfo['paid']) return self::setErrorInfo('该订单已支付!');
|
||||||
if($orderInfo['pay_type'] != 'yue') return self::setErrorInfo('该订单不能使用余额支付!');
|
// if($orderInfo['pay_type'] != 'yue') return self::setErrorInfo('该订单不能使用余额支付!');
|
||||||
$userInfo = User::getUserInfo($uid);
|
$userInfo = User::getUserInfo($uid);
|
||||||
if($userInfo['now_money'] < $orderInfo['pay_price'])
|
if($userInfo['now_money'] < $orderInfo['pay_price'])
|
||||||
return self::setErrorInfo('余额不足'.floatval($orderInfo['pay_price']));
|
return self::setErrorInfo('余额不足'.floatval($orderInfo['pay_price']));
|
||||||
self::beginTrans();
|
self::beginTrans();
|
||||||
$res1 = false !== User::bcDec($uid,'now_money',$orderInfo['pay_price'],'uid');
|
$res1 = false !== User::bcDec($uid,'now_money',$orderInfo['pay_price'],'uid');
|
||||||
$res2 = UserBill::expend('购买商品',$uid,'now_money','pay_product',$orderInfo['pay_price'],$orderInfo['id'],$userInfo['now_money'],'余额支付'.floatval($orderInfo['pay_price']).'元购买商品');
|
$res2 = UserBill::expend('购买商品',$uid,'now_money','pay_product',$orderInfo['pay_price'],$orderInfo['id'],$userInfo['now_money'],'余额支付'.floatval($orderInfo['pay_price']).'元购买商品');
|
||||||
$res3 = self::paySuccess($order_id,$formId);
|
$res3 = self::paySuccess($order_id,'yue',$formId);//余额支付成功
|
||||||
try{
|
try{
|
||||||
// HookService::listen('yue_pay_product',$userInfo,$orderInfo,false,PaymentBehavior::class);
|
// HookService::listen('yue_pay_product',$userInfo,$orderInfo,false,PaymentBehavior::class);
|
||||||
}catch (\Exception $e){
|
}catch (\Exception $e){
|
||||||
@ -347,7 +376,7 @@ class StoreOrder extends ModelBasic
|
|||||||
$userInfo = User::getUserInfo($uid);
|
$userInfo = User::getUserInfo($uid);
|
||||||
self::beginTrans();
|
self::beginTrans();
|
||||||
$res1 = UserBill::expend('购买商品',$uid,'now_money','pay_product',$orderInfo['pay_price'],$orderInfo['id'],$userInfo['now_money'],'微信支付'.floatval($orderInfo['pay_price']).'元购买商品');
|
$res1 = UserBill::expend('购买商品',$uid,'now_money','pay_product',$orderInfo['pay_price'],$orderInfo['id'],$userInfo['now_money'],'微信支付'.floatval($orderInfo['pay_price']).'元购买商品');
|
||||||
$res2 = self::paySuccess($order_id,$formId);
|
$res2 = self::paySuccess($order_id,'weixin',$formId);//微信支付为0时
|
||||||
$res = $res1 && $res2;
|
$res = $res1 && $res2;
|
||||||
self::checkTrans($res);
|
self::checkTrans($res);
|
||||||
return $res;
|
return $res;
|
||||||
@ -394,14 +423,15 @@ class StoreOrder extends ModelBasic
|
|||||||
/**
|
/**
|
||||||
* //TODO 支付成功后
|
* //TODO 支付成功后
|
||||||
* @param $orderId
|
* @param $orderId
|
||||||
|
* @param $paytype
|
||||||
* @param $notify
|
* @param $notify
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function paySuccess($orderId,$formId = '')
|
public static function paySuccess($orderId,$paytype='weixin',$formId = '')
|
||||||
{
|
{
|
||||||
$order = self::where('order_id',$orderId)->find();
|
$order = self::where('order_id',$orderId)->find();
|
||||||
$resPink = true;
|
$resPink = true;
|
||||||
$res1 = self::where('order_id',$orderId)->update(['paid'=>1,'pay_time'=>time()]);
|
$res1 = self::where('order_id',$orderId)->update(['paid'=>1,'pay_type'=>$paytype,'pay_time'=>time()]);//订单改为支付
|
||||||
User::bcInc($order['uid'],'pay_count',1,'uid');
|
User::bcInc($order['uid'],'pay_count',1,'uid');
|
||||||
if($order->combination_id && $res1 && !$order->refund_status) $resPink = StorePink::createPink($order);//创建拼团
|
if($order->combination_id && $res1 && !$order->refund_status) $resPink = StorePink::createPink($order);//创建拼团
|
||||||
$oid = self::where('order_id',$orderId)->value('id');
|
$oid = self::where('order_id',$orderId)->value('id');
|
||||||
@ -414,20 +444,20 @@ class StoreOrder extends ModelBasic
|
|||||||
public static function createOrderTemplate($order)
|
public static function createOrderTemplate($order)
|
||||||
{
|
{
|
||||||
$goodsName = StoreOrderCartInfo::getProductNameList($order['id']);
|
$goodsName = StoreOrderCartInfo::getProductNameList($order['id']);
|
||||||
WechatTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),WechatTemplateService::ORDER_CREATE, [
|
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::ORDER_CREATE, [
|
||||||
'first'=>'亲,您购买的商品已支付成功',
|
'first'=>'亲,您购买的商品已支付成功',
|
||||||
'keyword1'=>date('Y/m/d H:i',$order['add_time']),
|
'keyword1'=>date('Y/m/d H:i',$order['add_time']),
|
||||||
'keyword2'=>implode(',',$goodsName),
|
'keyword2'=>implode(',',$goodsName),
|
||||||
'keyword3'=>$order['order_id'],
|
'keyword3'=>$order['order_id'],
|
||||||
'remark'=>'点击查看订单详情'
|
'remark'=>'点击查看订单详情'
|
||||||
],Url::build('/wap/My/order',['uni'=>$order['order_id']],true,true));
|
],Url::build('/wap/My/order',['uni'=>$order['order_id']],true,true));
|
||||||
WechatTemplateService::sendAdminNoticeTemplate([
|
// RoutineTemplateService::sendAdminNoticeTemplate([
|
||||||
'first'=>"亲,您有一个新订单 \n订单号:{$order['order_id']}",
|
// 'first'=>"亲,您有一个新订单 \n订单号:{$order['order_id']}",
|
||||||
'keyword1'=>'新订单',
|
// 'keyword1'=>'新订单',
|
||||||
'keyword2'=>'线下支付',
|
// 'keyword2'=>'线下支付',
|
||||||
'keyword3'=>date('Y/m/d H:i',time()),
|
// 'keyword3'=>date('Y/m/d H:i',time()),
|
||||||
'remark'=>'请及时处理'
|
// 'remark'=>'请及时处理'
|
||||||
]);
|
// ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUserOrderDetail($uid,$key)
|
public static function getUserOrderDetail($uid,$key)
|
||||||
@ -459,7 +489,7 @@ class StoreOrder extends ModelBasic
|
|||||||
'keyword4'=>$postageData['delivery_name'],
|
'keyword4'=>$postageData['delivery_name'],
|
||||||
'keyword5'=>$postageData['delivery_id']
|
'keyword5'=>$postageData['delivery_id']
|
||||||
]);
|
]);
|
||||||
WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_DELIVER_SUCCESS,$group,$url);
|
RoutineTemplateService::sendTemplate($openid,RoutineTemplateService::ORDER_DELIVER_SUCCESS,$group,$url);
|
||||||
|
|
||||||
}else if($postageData['delivery_type'] == 'express'){//发货
|
}else if($postageData['delivery_type'] == 'express'){//发货
|
||||||
$group = array_merge($group,[
|
$group = array_merge($group,[
|
||||||
@ -467,21 +497,21 @@ class StoreOrder extends ModelBasic
|
|||||||
'keyword2'=>$postageData['delivery_name'],
|
'keyword2'=>$postageData['delivery_name'],
|
||||||
'keyword3'=>$postageData['delivery_id']
|
'keyword3'=>$postageData['delivery_id']
|
||||||
]);
|
]);
|
||||||
WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_POSTAGE_SUCCESS,$group,$url);
|
RoutineTemplateService::sendTemplate($openid,RoutineTemplateService::ORDER_POSTAGE_SUCCESS,$group,$url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function orderTakeAfter($order)
|
public static function orderTakeAfter($order)
|
||||||
{
|
{
|
||||||
$openid = WechatUser::getOpenId($order['uid']);
|
// $openid = WechatUser::getOpenId($order['uid']);
|
||||||
WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_TAKE_SUCCESS,[
|
// RoutineTemplateService::sendTemplate($openid,RoutineTemplateService::ORDER_TAKE_SUCCESS,[
|
||||||
'first'=>'亲,您的订单以成功签收,快去评价一下吧',
|
// 'first'=>'亲,您的订单已成功签收,快去评价一下吧',
|
||||||
'keyword1'=>$order['order_id'],
|
// 'keyword1'=>$order['order_id'],
|
||||||
'keyword2'=>'已收货',
|
// 'keyword2'=>'已收货',
|
||||||
'keyword3'=>date('Y/m/d H:i',time()),
|
// 'keyword3'=>date('Y/m/d H:i',time()),
|
||||||
'keyword4'=>implode(',',StoreOrderCartInfo::getProductNameList($order['id'])),
|
// 'keyword4'=>implode(',',StoreOrderCartInfo::getProductNameList($order['id'])),
|
||||||
'remark'=>'点击查看订单详情'
|
// 'remark'=>'点击查看订单详情'
|
||||||
],Url::build('My/order',['uni'=>$order['order_id']],true,true));
|
// ],Url::build('My/order',['uni'=>$order['order_id']],true,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class StoreProduct extends ModelBasic
|
|||||||
return $model->select();
|
return $model->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 热卖产品
|
* 热卖产品
|
||||||
* @param string $field
|
* @param string $field
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace app\routine\model\store;
|
namespace app\routine\model\store;
|
||||||
|
|
||||||
use behavior\wap\StoreProductBehavior;
|
use behavior\routine\StoreProductBehavior;
|
||||||
use service\HookService;
|
use service\HookService;
|
||||||
use traits\ModelTrait;
|
use traits\ModelTrait;
|
||||||
use basic\ModelBasic;
|
use basic\ModelBasic;
|
||||||
|
|||||||
@ -17,8 +17,10 @@ Page({
|
|||||||
duration: 500,//动画播放的时长;
|
duration: 500,//动画播放的时长;
|
||||||
indicatorColor: "rgba(51, 51, 51, .3)",
|
indicatorColor: "rgba(51, 51, 51, .3)",
|
||||||
indicatorActivecolor: "#ffffff",
|
indicatorActivecolor: "#ffffff",
|
||||||
recommendLsit:[],
|
recommendList:[],
|
||||||
newList:[],
|
newList:[],
|
||||||
|
hotList:[],
|
||||||
|
benefitList:[],
|
||||||
likeList:[],
|
likeList:[],
|
||||||
offset: 0,
|
offset: 0,
|
||||||
title: "玩命加载中...",
|
title: "玩命加载中...",
|
||||||
@ -60,11 +62,13 @@ Page({
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
that.setData({
|
that.setData({
|
||||||
imgUrls: res.data.data.banner,
|
imgUrls: res.data.data.banner,
|
||||||
recommendLsit: res.data.data.best,
|
recommendList: res.data.data.best,//精品
|
||||||
newList: res.data.data.new,
|
newList: res.data.data.new,//首发新品
|
||||||
lovely: res.data.data.lovely,
|
hotList: res.data.data.hot,//热卖单品
|
||||||
menus: res.data.data.menus,
|
benefitList: res.data.data.benefit,//促销
|
||||||
likeList: res.data.data.hot
|
lovely: res.data.data.lovely,//猜猜你喜欢上面广告位
|
||||||
|
menus: res.data.data.menus,//导航
|
||||||
|
likeList: res.data.data.like//猜猜喜欢
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class='scroll-product'>
|
<view class='scroll-product'>
|
||||||
<scroll-view class="scroll-view_x" scroll-x style="width: auto;overflow:hidden;">
|
<scroll-view class="scroll-view_x" scroll-x style="width: auto;overflow:hidden;">
|
||||||
<block wx:for="{{recommendLsit}}">
|
<block wx:for="{{recommendList}}">
|
||||||
<view class='item'>
|
<view class='item'>
|
||||||
<navigator hover-class="none" url="/pages/product-con/index?id={{item.id}}">
|
<navigator hover-class="none" url="/pages/product-con/index?id={{item.id}}">
|
||||||
<view class='img-box'><image src='{{url}}{{item.image}}'></image></view>
|
<view class='img-box'><image src='{{url}}{{item.image}}'></image></view>
|
||||||
@ -46,11 +46,11 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 今日上新 -->
|
<!-- 首发新品 -->
|
||||||
<view class='today-new'>
|
<view class='today-new'>
|
||||||
<view class='title-bar' bindtap='torday'>
|
<view class='title-bar' bindtap='torday'>
|
||||||
<view class='iconfont icon-shangxinfuwu'></view>
|
<view class='iconfont icon-shangxinfuwu'></view>
|
||||||
<text>今日上新</text>
|
<text>首发新品</text>
|
||||||
<navigator hover-class="none" bindtap='torday' class='flex'><text>更多新品</text><text class='iconfont icon-xiala'></text></navigator>
|
<navigator hover-class="none" bindtap='torday' class='flex'><text>更多新品</text><text class='iconfont icon-xiala'></text></navigator>
|
||||||
</view>
|
</view>
|
||||||
<view class='new-pro-wrapper'>
|
<view class='new-pro-wrapper'>
|
||||||
@ -67,6 +67,54 @@
|
|||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 热卖单品 -->
|
||||||
|
<view class='new-product2'>
|
||||||
|
<view class='title-bar' bindtap='torday' >
|
||||||
|
<view class='iconfont icon-jingpintuijian'></view>
|
||||||
|
<text>热卖单品</text>
|
||||||
|
<navigator hover-class="none" class='flex'><text>更多推荐</text><text class='iconfont icon-xiala'></text></navigator>
|
||||||
|
</view>
|
||||||
|
<view class='scroll-product2'>
|
||||||
|
<scroll-view class="scroll-view_x" scroll-x style="width: auto;overflow:hidden;">
|
||||||
|
<block wx:for="{{hotList}}">
|
||||||
|
<view class='item'>
|
||||||
|
<navigator hover-class="none" url="/pages/product-con/index?id={{item.id}}">
|
||||||
|
<view class='img-box'><image src='{{url}}{{item.image}}'></image></view>
|
||||||
|
<view class='pro-info'>
|
||||||
|
<view class='pro-title'>{{item.store_name}}</view>
|
||||||
|
<view class='price-small'>¥{{item.price}}</view>
|
||||||
|
<view class='buy flex'><image src="/images/carts.png"></image>立即购买</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class='today-new'>
|
||||||
|
<view class='title-bar' bindtap='torday'>
|
||||||
|
<view class='iconfont icon-shangxinfuwu'></view>
|
||||||
|
<text>促销单品</text>
|
||||||
|
<navigator hover-class="none" bindtap='torday' class='flex'><text>更多新品</text><text class='iconfont icon-xiala'></text></navigator>
|
||||||
|
</view>
|
||||||
|
<view class='new-pro-wrapper2'>
|
||||||
|
<block wx:for="{{benefitList}}">
|
||||||
|
<view class='item'>
|
||||||
|
<navigator class='flex' hover-class="none" url="/pages/product-con/index?id={{item.id}}">
|
||||||
|
<view class='text-box flex'>
|
||||||
|
<view class='title'>{{item.store_name}}</view>
|
||||||
|
<view class='salePrice'>促销价: ¥<text>{{item.price}}</text></view>
|
||||||
|
<view class='price flex'>
|
||||||
|
<view class='dailyPrice'>日常价:{{item.ot_price}}</view>
|
||||||
|
<view>仅剩:{{item.stock}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class='img-box'><image src='{{url}}{{item.image}}'></image></view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<block wx:for="{{lovely}}" wx:if="{{index < 1}}">
|
<block wx:for="{{lovely}}" wx:if="{{index < 1}}">
|
||||||
<view class='hot-banner'>
|
<view class='hot-banner'>
|
||||||
<image src='{{url}}{{item.img}}'></image>
|
<image src='{{url}}{{item.img}}'></image>
|
||||||
|
|||||||
@ -42,3 +42,26 @@
|
|||||||
.product-like .like-box .item .text-info .title{overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
.product-like .like-box .item .text-info .title{overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||||
.product-like .like-box .item .text-info .price{color:#ff3d3d;}
|
.product-like .like-box .item .text-info .price{color:#ff3d3d;}
|
||||||
|
|
||||||
|
.new-product2{margin-top: 30rpx; background-color: #fff;}
|
||||||
|
.scroll-product2{width: 100%; overflow: hidden; white-space: nowrap; padding:25rpx 0 35rpx 30rpx; box-sizing: border-box;}
|
||||||
|
.scroll-product2 .item{width: 304rpx;margin-right: 28rpx; display: inline-block;border:1rpx solid #eee;border-radius:20rpx;}
|
||||||
|
.scroll-product2 .item .img-box{width: 100%; height: 304rpx;}
|
||||||
|
.scroll-product2 .item .img-box image{width: 100%; height: 304rpx;border-radius:20rpx 20rpx 0 0;}
|
||||||
|
.scroll-product2 .item .pro-info .price-small{color: #ff3d3d;font-size:26rpx;
|
||||||
|
margin-top:10rpx;text-align:center;}
|
||||||
|
.scroll-product2 .item .pro-info .pro-title{text-align:center;margin-top:25rpx;}
|
||||||
|
.scroll-product2 .item .pro-info .buy{width:250rpx;height:54rpx;background-color:#e6413a;border-radius:50rpx;font-size:24rpx;color:#fff;align-items:center;justify-content:center;margin:17rpx auto 25rpx auto;}
|
||||||
|
.scroll-product2 .item .pro-info .buy image{width:27rpx;height:26rpx;margin-right:12rpx;}
|
||||||
|
|
||||||
|
|
||||||
|
.new-pro-wrapper2{padding: 0 30rpx;}
|
||||||
|
.new-pro-wrapper2 .item navigator{width: 100%; padding:36rpx 0; border-bottom: 1px solid #eee; justify-content: space-between; box-sizing: border-box;flex-direction:row-reverse;}
|
||||||
|
.new-pro-wrapper2 .item .text-box{width:470rpx; flex-direction: column; justify-content: space-around;}
|
||||||
|
.new-pro-wrapper2 .item .text-box .salePrice{width:210rpx;height:46rpx;text-align:center;line-height:46rpx;font-size:20rpx;color:#fff;background-image:linear-gradient(to right,#ff6248 0%,#ff3e1e 100%);border-radius:30rpx 0 30rpx 0rpx;margin-top:18rpx;}
|
||||||
|
.new-pro-wrapper2 .item .text-box .salePrice text{font-size:24rpx;}
|
||||||
|
.new-pro-wrapper2 .item .text-box .title{display: -webkit-box; display:-moz-box; display:box;-webkit-box-orient: vertical; -moz-box-orient: vertical; -webkit-line-clamp: 1;-moz-line-clamp: 1;overflow: hidden;}
|
||||||
|
.new-pro-wrapper2 .item .text-box .price{color: #999; font-size:24rpx;justify-content:space-between;align-items:center;}
|
||||||
|
.new-pro-wrapper2 .item .text-box .price .dailyPrice{text-decoration:line-through;}
|
||||||
|
.new-pro-wrapper2 .item .text-box .price text{font-size: 28rpx;}
|
||||||
|
.new-pro-wrapper2 .item .img-box image{width:188rpx; height:188rpx;border-radius:10rpx;}
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ Page({
|
|||||||
cartInfo : [],
|
cartInfo : [],
|
||||||
cartId : '',
|
cartId : '',
|
||||||
priceGroup :[],
|
priceGroup :[],
|
||||||
|
totalPrice:0,
|
||||||
orderKey:'',
|
orderKey:'',
|
||||||
seckillId:0,
|
seckillId:0,
|
||||||
BargainId:0,
|
BargainId:0,
|
||||||
@ -27,7 +28,7 @@ Page({
|
|||||||
url: app.globalData.urlImages,
|
url: app.globalData.urlImages,
|
||||||
addressId:0,
|
addressId:0,
|
||||||
couponId:0,
|
couponId:0,
|
||||||
couponPrice:'',
|
couponPrice:0,
|
||||||
couponInfo:[],
|
couponInfo:[],
|
||||||
addressInfo:[],
|
addressInfo:[],
|
||||||
mark:'',
|
mark:'',
|
||||||
@ -70,6 +71,7 @@ Page({
|
|||||||
}
|
}
|
||||||
that.getaddressInfo();
|
that.getaddressInfo();
|
||||||
that.getCouponRope();
|
that.getCouponRope();
|
||||||
|
|
||||||
},
|
},
|
||||||
bindHideKeyboard:function(e){
|
bindHideKeyboard:function(e){
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -183,7 +185,7 @@ Page({
|
|||||||
},
|
},
|
||||||
fail: function(res) {
|
fail: function(res) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '支付失败',
|
title: '支付取消',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
@ -232,7 +234,8 @@ Page({
|
|||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
that.setData({
|
that.setData({
|
||||||
couponInfo: res.data.data,
|
couponInfo: res.data.data,
|
||||||
couponPrice: '-' + res.data.data.coupon_price
|
// couponPrice: '-' + res.data.data.coupon_price,
|
||||||
|
totalPrice: Number(that.data.totalPrice) - Number(res.data.data.coupon_price)
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
that.setData({
|
that.setData({
|
||||||
@ -263,7 +266,7 @@ Page({
|
|||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
wx.request({
|
wx.request({
|
||||||
url: app.globalData.url + '/routine/auth_api/user_default_address?uid=' + app.globalData.uid,
|
url: app.globalData.url + '/routine/auth_api/user_default_address?uid=' + app.globalData.uid+ '&openid=' + app.globalData.openid,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
@ -282,7 +285,7 @@ Page({
|
|||||||
'content-type': 'application/x-www-form-urlencoded'
|
'content-type': 'application/x-www-form-urlencoded'
|
||||||
};
|
};
|
||||||
wx.request({
|
wx.request({
|
||||||
url: app.globalData.url + '/routine/auth_api/user_address_list?uid=' + app.globalData.uid,
|
url: app.globalData.url + '/routine/auth_api/user_address_list?uid=' + app.globalData.uid + '&openid=' + app.globalData.openid,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
header: header,
|
header: header,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@ -332,6 +335,7 @@ Page({
|
|||||||
offlinePostage: res.data.data.offlinePostage,
|
offlinePostage: res.data.data.offlinePostage,
|
||||||
orderKey: res.data.data.orderKey,
|
orderKey: res.data.data.orderKey,
|
||||||
priceGroup: res.data.data.priceGroup,
|
priceGroup: res.data.data.priceGroup,
|
||||||
|
totalPrice: Number(res.data.data.priceGroup.totalPrice) + Number(res.data.data.priceGroup.storePostage),
|
||||||
cartId: res.data.data.cartId,
|
cartId: res.data.data.cartId,
|
||||||
seckillId: res.data.data.seckill_id,
|
seckillId: res.data.data.seckill_id,
|
||||||
usableCoupon: res.data.data.usableCoupon
|
usableCoupon: res.data.data.usableCoupon
|
||||||
|
|||||||
@ -47,10 +47,12 @@
|
|||||||
<view class='warapper'>
|
<view class='warapper'>
|
||||||
<view class='item '>
|
<view class='item '>
|
||||||
<radio-group >
|
<radio-group >
|
||||||
<label class='radio-wrapper' wx:for="{{cartArr}}">
|
<label class='radio-wrapper' wx:for="{{cartArr}}" bindtap="radioChange" data-value="{{item.value}}">
|
||||||
<view class='left-wrapper flex'><view class='iconfont {{item.icon}}'></view> {{item.name}}</view>
|
<view class='left-wrapper flex'>
|
||||||
<radio value="{{index}}" wx:if="{{item.value == payType}}" checked='checked' bindtap="radioChange" data-value="{{item.value}}"></radio>
|
<view class='iconfont {{item.icon}}'></view> {{item.name}}
|
||||||
<radio value="{{index}}" wx:else bindtap="radioChange" data-value="{{item.value}}"></radio>
|
</view>
|
||||||
|
<radio value="{{index}}" wx:if="{{item.value == payType}}" checked='checked' ></radio>
|
||||||
|
<radio value="{{index}}" wx:else></radio>
|
||||||
<!-- 其他布局代码 -->
|
<!-- 其他布局代码 -->
|
||||||
</label>
|
</label>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
@ -72,7 +74,7 @@
|
|||||||
<view style='height:120rpx;'></view>
|
<view style='height:120rpx;'></view>
|
||||||
<view class='foot flex'>
|
<view class='foot flex'>
|
||||||
<view class='text'>
|
<view class='text'>
|
||||||
合计: <text class='price'>¥{{priceGroup.totalPrice}}{{couponPrice}}</text>
|
合计: <text class='price'>¥{{totalPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
<form bindsubmit="subOrder" report-submit='true'>
|
<form bindsubmit="subOrder" report-submit='true'>
|
||||||
<button class='submit-btn' formType="submit">立即结算</button>
|
<button class='submit-btn' formType="submit">立即结算</button>
|
||||||
|
|||||||
@ -31,7 +31,7 @@ Page({
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
that.setData({
|
that.setData({
|
||||||
ordercon:res.data.data
|
ordercon: res.data.data
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: function (res) {
|
fail: function (res) {
|
||||||
@ -42,10 +42,114 @@ Page({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getPay:function(e){
|
//选择付款方式
|
||||||
|
checkPay: function (e) {
|
||||||
|
var that = this;
|
||||||
|
wx.showActionSheet({
|
||||||
|
itemList: ['微信支付', '余额支付'],
|
||||||
|
success(res) {
|
||||||
|
console.log(res.tapIndex)
|
||||||
|
if (res.tapIndex == 0) {//微信支付
|
||||||
|
wx.request({
|
||||||
|
url: app.globalData.url + '/routine/auth_api/pay_order?uid=' + app.globalData.uid + '&uni=' + e.target.dataset.id + '&paytype=weixin',
|
||||||
|
method: 'get',
|
||||||
|
success: function (res) {
|
||||||
|
var data = res.data.data;
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
var jsConfig = res.data.data.result.jsConfig;
|
||||||
|
console.log(jsConfig);
|
||||||
|
wx.requestPayment({
|
||||||
|
timeStamp: jsConfig.timeStamp,
|
||||||
|
nonceStr: jsConfig.nonceStr,
|
||||||
|
package: jsConfig.package,
|
||||||
|
signType: jsConfig.signType,
|
||||||
|
paySign: jsConfig.paySign,
|
||||||
|
success: function (res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '支付成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
})
|
||||||
|
setTimeout(function () {
|
||||||
|
wx.navigateTo({ //跳转至指定页面并关闭其他打开的所有页面
|
||||||
|
url: '/pages/orders-list/orders-list?uid=' + app.globalData.uid
|
||||||
|
// url: '/pages/orders-con/orders-con?order_id=' + data.result.order_id
|
||||||
|
})
|
||||||
|
}, 1200)
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '取消支付',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 1000,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
complete: function (res) {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errMsg == 'requestPayment:cancel') {
|
||||||
|
wx.showToast({
|
||||||
|
title: '取消支付',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log('submit fail');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
wx.request({
|
||||||
|
url: app.globalData.url + '/routine/auth_api/pay_order?uid=' + app.globalData.uid + '&uni=' + e.target.dataset.id + '&paytype=yue',
|
||||||
|
method: 'get',
|
||||||
|
success: function (res) {
|
||||||
|
var data = res.data.data;
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
wx.showToast({
|
||||||
|
title: res.data.msg,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
setTimeout(function () {
|
||||||
|
wx.navigateTo({ //跳转至指定页面并关闭其他打开的所有页面(这个最好用在返回至首页的的时候)
|
||||||
|
url: '/pages/orders-list/orders-list?uid=' + app.globalData.uid
|
||||||
|
// url: '/pages/orders-con/orders-con?order_id=' + data.result.orderId
|
||||||
|
})
|
||||||
|
}, 1200)
|
||||||
|
} else {
|
||||||
|
wx.showToast({
|
||||||
|
title: res.data.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log('submit fail');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
console.log(res.errMsg)
|
||||||
|
},
|
||||||
|
// complete(res) {
|
||||||
|
// setTimeout(function () {
|
||||||
|
// wx.navigateTo({
|
||||||
|
// url: '/pages/orders-list/orders-list',
|
||||||
|
// })
|
||||||
|
// }, 1500)
|
||||||
|
// },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//立即付款
|
||||||
|
getPay: function (e) {
|
||||||
var that = this;
|
var that = this;
|
||||||
wx.request({
|
wx.request({
|
||||||
url: app.globalData.url + '/routine/auth_api/pay_order?uid=' + app.globalData.uid +'&uni='+e.target.dataset.id,
|
url: app.globalData.url + '/routine/auth_api/pay_order?uid=' + app.globalData.uid + '&uni=' + e.target.dataset.id,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
var data = res.data.data;
|
var data = res.data.data;
|
||||||
@ -66,7 +170,7 @@ Page({
|
|||||||
})
|
})
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
wx.navigateTo({ //跳转至指定页面并关闭其他打开的所有页面(这个最好用在返回至首页的的时候)
|
wx.navigateTo({ //跳转至指定页面并关闭其他打开的所有页面(这个最好用在返回至首页的的时候)
|
||||||
url: '/pages/orders-con/orders-con?order_id=' + data.result.order_id
|
url: '/pages/orders-list/orders-list?uid=' + app.globalData.uid
|
||||||
})
|
})
|
||||||
}, 1200)
|
}, 1200)
|
||||||
},
|
},
|
||||||
@ -76,11 +180,11 @@ Page({
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
// setTimeout(function () {
|
setTimeout(function () {
|
||||||
// wx.navigateTo({
|
wx.navigateTo({
|
||||||
// url: '/pages/orders-con/orders-con?order_id=' + data.result.orderId
|
url: '/pages/orders-list/orders-list?uid=' + app.globalData.uid
|
||||||
// })
|
})
|
||||||
// }, 1200)
|
}, 1200)
|
||||||
},
|
},
|
||||||
complete: function (res) {
|
complete: function (res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
@ -90,15 +194,15 @@ Page({
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
// setTimeout(function () {
|
setTimeout(function () {
|
||||||
// wx.navigateTo({ //跳转至指定页面并关闭其他打开的所有页面(这个最好用在返回至首页的的时候)
|
wx.navigateTo({ //跳转至指定页面并关闭其他打开的所有页面(这个最好用在返回至首页的的时候)
|
||||||
// url: '/pages/orders-con/orders-con?order_id=' + data.result.orderId
|
url: '/pages/orders-list/orders-list?uid=' + app.globalData.uid
|
||||||
// })
|
})
|
||||||
// }, 1200)
|
}, 1200)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else if (res.data.code == 200){
|
} else if (res.data.code == 200) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -109,7 +213,7 @@ Page({
|
|||||||
url: '/pages/orders-con/orders-con?order_id=' + data.result.orderId
|
url: '/pages/orders-con/orders-con?order_id=' + data.result.orderId
|
||||||
})
|
})
|
||||||
}, 1200)
|
}, 1200)
|
||||||
}else{
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -127,7 +231,7 @@ Page({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
delOrder:function(e){
|
delOrder: function (e) {
|
||||||
var header = {
|
var header = {
|
||||||
'content-type': 'application/x-www-form-urlencoded'
|
'content-type': 'application/x-www-form-urlencoded'
|
||||||
};
|
};
|
||||||
@ -150,11 +254,11 @@ Page({
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
setTimeout(function(){
|
setTimeout(function () {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/orders-list/orders-list',
|
url: '/pages/orders-list/orders-list',
|
||||||
})
|
})
|
||||||
},1500)
|
}, 1500)
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
@ -179,19 +283,19 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goTel:function(e){
|
goTel: function (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
wx.makePhoneCall({
|
wx.makePhoneCall({
|
||||||
phoneNumber: e.currentTarget.dataset.tel //仅为示例,并非真实的电话号码
|
phoneNumber: e.currentTarget.dataset.tel //仅为示例,并非真实的电话号码
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goJoinPink:function(e){
|
goJoinPink: function (e) {
|
||||||
var uni = e.currentTarget.dataset.uni;
|
var uni = e.currentTarget.dataset.uni;
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/join-pink/index?id=' + uni,
|
url: '/pages/join-pink/index?id=' + uni,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
confirmOrder:function(e){
|
confirmOrder: function (e) {
|
||||||
var header = {
|
var header = {
|
||||||
'content-type': 'application/x-www-form-urlencoded'
|
'content-type': 'application/x-www-form-urlencoded'
|
||||||
};
|
};
|
||||||
@ -208,11 +312,11 @@ Page({
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
header: header,
|
header: header,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if(res.data.code==200){
|
if (res.data.code == 200) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/orders-list/orders-list?nowstatus=4',
|
url: '/pages/orders-list/orders-list?nowstatus=4',
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -236,7 +340,7 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goIndex:function(){
|
goIndex: function () {
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
|
|||||||
@ -111,7 +111,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view style='height:120rpx;'></view>
|
<view style='height:120rpx;'></view>
|
||||||
<view class='foot'>
|
<view class='foot'>
|
||||||
<view class='pay-btn' data-id="{{ordercon.order_id}}" bindtap='getPay' wx:if="{{ordercon._status._type==0}}">立即付款</view>
|
<view class='pay-btn' data-id="{{ordercon.order_id}}" bindtap='checkPay' wx:if="{{ordercon._status._type==0}}">立即付款</view>
|
||||||
<navigator wx:elif="{{ordercon._status._type==1}}" hover-class="none" url='/pages/refund-page/refund-page?orderId={{ordercon.order_id}}'><view class='delete-btn'>申请退款</view></navigator>
|
<navigator wx:elif="{{ordercon._status._type==1}}" hover-class="none" url='/pages/refund-page/refund-page?orderId={{ordercon.order_id}}'><view class='delete-btn'>申请退款</view></navigator>
|
||||||
<view wx:if="{{ordercon._status._type==1 && ordercon.combination_id > 0}}" class='pay-btn' bindtap='goJoinPink' data-uni='{{ordercon.pink_id}}'>查看拼团</view>
|
<view wx:if="{{ordercon._status._type==1 && ordercon.combination_id > 0}}" class='pay-btn' bindtap='goJoinPink' data-uni='{{ordercon.pink_id}}'>查看拼团</view>
|
||||||
<navigator wx:if="{{ordercon._status._type==2 && ordercon.delivery_type == 'express'}}" hover-class="none" url='/pages/logistics/logistics?orderId={{ordercon.order_id}}'><view class='delete-btn' >查看物流</view></navigator>
|
<navigator wx:if="{{ordercon._status._type==2 && ordercon.delivery_type == 'express'}}" hover-class="none" url='/pages/logistics/logistics?orderId={{ordercon.order_id}}'><view class='delete-btn' >查看物流</view></navigator>
|
||||||
@ -119,3 +119,4 @@
|
|||||||
<view wx:if="{{ordercon._status._type==4 || ordercon._status._type==0}}" class='delete-btn' bindtap='delOrder' data-uni='{{ordercon.order_id}}'>删除订单</view>
|
<view wx:if="{{ordercon._status._type==4 || ordercon._status._type==0}}" class='delete-btn' bindtap='delOrder' data-uni='{{ordercon.order_id}}'>删除订单</view>
|
||||||
<navigator wx:if="{{!ordercon.seckill_id && !ordercon.bargain_id && !ordercon.combination_id && (ordercon._status._type==3||ordercon._status._type==4)}}" hover-class="none" bindtap='goIndex'><view class='pay-btn'>再次购买</view></navigator>
|
<navigator wx:if="{{!ordercon.seckill_id && !ordercon.bargain_id && !ordercon.combination_id && (ordercon._status._type==3||ordercon._status._type==4)}}" hover-class="none" bindtap='goIndex'><view class='pay-btn'>再次购买</view></navigator>
|
||||||
</view>
|
</view>
|
||||||
|
<include src="/pages/home/home.wxml"/>
|
||||||
@ -42,5 +42,6 @@
|
|||||||
.foot view{width: 160rpx; height: 58rpx; line-height: 56rpx; text-align: center; box-sizing: border-box; border: 1px solid #999; color: #aaa; border-radius: 30px; font-size: 24rpx;}
|
.foot view{width: 160rpx; height: 58rpx; line-height: 56rpx; text-align: center; box-sizing: border-box; border: 1px solid #999; color: #aaa; border-radius: 30px; font-size: 24rpx;}
|
||||||
.foot view.pay-btn{background-color: #ff3d3d;border: 0; color: #fff;}
|
.foot view.pay-btn{background-color: #ff3d3d;border: 0; color: #fff;}
|
||||||
.delete-btn{margin-right: 20rpx;display:block;}
|
.delete-btn{margin-right: 20rpx;display:block;}
|
||||||
|
@import "/pages/home/home.wxss";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ Page({
|
|||||||
duration: 1000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
that.setData({
|
that.setData({
|
||||||
now_money: parseInt(that.data.now_money) + parseInt(e.detail.value.number)
|
now_money: parseFloat(that.data.now_money) + parseFloat(e.detail.value.number)
|
||||||
});
|
});
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<view class='refunding-ul'>
|
<view class='refunding-ul'>
|
||||||
<view class='refunding-li flex'>
|
<view class='refunding-li flex'>
|
||||||
<view>退款总金额</view>
|
<view>退款总金额</view>
|
||||||
<view class='li-money'>¥<text>{{ordercon.refund_price}}</text></view>
|
<view class='li-money'>¥<text>{{ordercon.pay_price}}</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class='refunding-li flex'>
|
<view class='refunding-li flex'>
|
||||||
<view>退回微信账户</view>
|
<view>退回微信账户</view>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user