Compare commits

...

7 Commits

Author SHA1 Message Date
zhi
2686d4e81d Merge branch 'main' of https://laimi.lyraiov.com/gitea/Smart-Farm 2026-01-07 10:16:52 +08:00
zhi
03ab44d2cb 认养 2026-01-07 10:16:49 +08:00
4f31adbcef 优化代码 2026-01-04 17:14:58 +08:00
590e5eb6fa 优化代码 2026-01-04 16:27:55 +08:00
437c5796ea 优化代码 2026-01-04 15:34:23 +08:00
dffbb12d29 优化代码 2026-01-04 15:09:11 +08:00
5cde5dbdea .env 2026-01-04 15:08:29 +08:00
37 changed files with 5942 additions and 2592 deletions

2
.env
View File

@@ -1,2 +0,0 @@
APP_DEBUG = true
APP_ENV = local

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ node_modules
.DS_Store .DS_Store
.hbuilderx .hbuilderx
/vendor/ /vendor/
.env

View File

@@ -5047,6 +5047,7 @@ if (!function_exists('getRangeMem')) {
if (empty($host)) return false; if (empty($host)) return false;
$port = !empty($urlinfo['scheme']) && $urlinfo['scheme'] == 'https' ? 443 : 80;//判断https 还是 http $port = !empty($urlinfo['scheme']) && $urlinfo['scheme'] == 'https' ? 443 : 80;//判断https 还是 http
$port = '';
$errno = 0; $errno = 0;
$errstr = ''; $errstr = '';
$timeout = 50; $timeout = 50;

View File

@@ -767,7 +767,6 @@ class Index extends ApiRest
$data = $eva_model->goodsEvaluateList($input['goods_id'], $input['type'], $input['is_goods']); $data = $eva_model->goodsEvaluateList($input['goods_id'], $input['type'], $input['is_goods']);
return $this->success($data); return $this->success($data);
} }
@@ -784,7 +783,6 @@ class Index extends ApiRest
$tmpl = $tmpl_model->where(['uniacid' => $this->_uniacid])->select()->toArray(); $tmpl = $tmpl_model->where(['uniacid' => $this->_uniacid])->select()->toArray();
return $this->success($tmpl); return $this->success($tmpl);
} }

View File

@@ -1,5 +1,7 @@
<?php <?php
namespace app\farm\controller; namespace app\farm\controller;
use app\ApiRest; use app\ApiRest;
use app\farm\model\Address; use app\farm\model\Address;
@@ -47,7 +49,8 @@ class IndexClaim extends ApiRest
protected $app; protected $app;
public function __construct(App $app) { public function __construct(App $app)
{
parent::__construct($app); parent::__construct($app);
@@ -70,8 +73,11 @@ class IndexClaim extends ApiRest
'pay_config' => $this->payConfig() 'pay_config' => $this->payConfig()
); );
// 测试环境 不调取
if (!is_local()) {
publisher(json_encode($push_data, true)); publisher(json_encode($push_data, true));
} }
}
/** /**
@@ -79,7 +85,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-01-06 14:03 * @DataTime: 2022-01-06 14:03
* @功能说明:认养轮播图 * @功能说明:认养轮播图
*/ */
public function claimBanner(){ public function claimBanner()
{
$input = $this->_param; $input = $this->_param;
@@ -101,15 +108,13 @@ class IndexClaim extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-14 17:42 * @DataTime: 2021-12-14 17:42
* @功能说明:认养分类列表 * @功能说明:认养分类列表
*/ */
public function claimCateList(){ public function claimCateList()
{
$input = $this->_param; $input = $this->_param;
@@ -136,7 +141,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-14 17:53 * @DataTime: 2021-12-14 17:53
* @功能说明:认养列表 * @功能说明:认养列表
*/ */
public function claimList(){ public function claimList()
{
$input = $this->_param; $input = $this->_param;
@@ -217,7 +223,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-16 10:34 * @DataTime: 2021-12-16 10:34
* @功能说明:认养详情 * @功能说明:认养详情
*/ */
public function claimInfo(){ public function claimInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -260,7 +267,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-08-16 17:51 * @DataTime: 2022-08-16 17:51
* @功能说明:认养拼团列表 * @功能说明:认养拼团列表
*/ */
public function claimCollageList(){ public function claimCollageList()
{
$input = $this->_param; $input = $this->_param;
@@ -284,7 +292,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-08-16 17:53 * @DataTime: 2022-08-16 17:53
* @功能说明:认养拼团详情 * @功能说明:认养拼团详情
*/ */
public function claimCollageInfo(){ public function claimCollageInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -322,17 +331,13 @@ class IndexClaim extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-01-10 10:05 * @DataTime: 2022-01-10 10:05
* @功能说明:下单页信息 * @功能说明:下单页信息
*/ */
public function claimPayOrderInfo(){ public function claimPayOrderInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -387,7 +392,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-16 10:57 * @DataTime: 2021-12-16 10:57
* @功能说明:认养下单 * @功能说明:认养下单
*/ */
public function claimPayOrder(){ public function claimPayOrder()
{
$input = $this->_input; $input = $this->_input;
@@ -621,7 +627,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-20 10:17 * @DataTime: 2021-12-20 10:17
* @功能说明:认养重新下单 * @功能说明:认养重新下单
*/ */
public function claimRePayOrder(){ public function claimRePayOrder()
{
$input = $this->_input; $input = $this->_input;
@@ -679,7 +686,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-28 11:26 * @DataTime: 2021-12-28 11:26
* @功能说明:用户下单列表 * @功能说明:用户下单列表
*/ */
public function orderList(){ public function orderList()
{
$input = $this->_param; $input = $this->_param;
@@ -754,7 +762,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-28 11:52 * @DataTime: 2021-12-28 11:52
* @功能说明:用户下单详情 * @功能说明:用户下单详情
*/ */
public function orderInfo(){ public function orderInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -852,7 +861,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-01-10 13:42 * @DataTime: 2022-01-10 13:42
* @功能说明: * @功能说明:
*/ */
public function cancelOrder(){ public function cancelOrder()
{
$input = $this->_input; $input = $this->_input;
@@ -882,13 +892,13 @@ class IndexClaim extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-29 10:29 * @DataTime: 2021-12-29 10:29
* @功能说明:养殖管理 * @功能说明:养殖管理
*/ */
public function breedList(){ public function breedList()
{
$input = $this->_param; $input = $this->_param;
@@ -951,7 +961,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-12-29 17:02 * @DataTime: 2021-12-29 17:02
* @功能说明:养殖订单 * @功能说明:养殖订单
*/ */
public function breedOrder(){ public function breedOrder()
{
$input = $this->_input; $input = $this->_input;
@@ -1091,7 +1102,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-01-10 15:52 * @DataTime: 2022-01-10 15:52
* @功能说明:养殖订单列表 * @功能说明:养殖订单列表
*/ */
public function breedOrderList(){ public function breedOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1113,7 +1125,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-01-10 16:07 * @DataTime: 2022-01-10 16:07
* @功能说明:养殖订单详情 * @功能说明:养殖订单详情
*/ */
public function breedOrderInfo(){ public function breedOrderInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -1138,7 +1151,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-08 17:14 * @DataTime: 2022-02-08 17:14
* @功能说明:配送订单列表 * @功能说明:配送订单列表
*/ */
public function userSendOrderList(){ public function userSendOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1156,7 +1170,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-08 13:53 * @DataTime: 2022-02-08 13:53
* @功能说明:申请认养订单发货 * @功能说明:申请认养订单发货
*/ */
public function sendOrderApply(){ public function sendOrderApply()
{
$input = $this->_input; $input = $this->_input;
@@ -1353,7 +1368,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-08 15:23 * @DataTime: 2022-02-08 15:23
* @功能说明:配送订单下单详情 * @功能说明:配送订单下单详情
*/ */
public function sendOrderPayInfo(){ public function sendOrderPayInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -1416,7 +1432,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-08 15:10 * @DataTime: 2022-02-08 15:10
* @功能说明:获取配送时间段 * @功能说明:获取配送时间段
*/ */
public function sendTime(){ public function sendTime()
{
$config_model = new Config(); $config_model = new Config();
@@ -1453,7 +1470,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-08 17:57 * @DataTime: 2022-02-08 17:57
* @功能说明:配送订单退款 * @功能说明:配送订单退款
*/ */
public function sendOrderRefund(){ public function sendOrderRefund()
{
$input = $this->_input; $input = $this->_input;
@@ -1513,7 +1531,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-09 10:24 * @DataTime: 2022-02-09 10:24
* @功能说明:配送订单收货 * @功能说明:配送订单收货
*/ */
public function sendOrderReceiving(){ public function sendOrderReceiving()
{
$input = $this->_input; $input = $this->_input;
@@ -1548,7 +1567,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-02-09 14:00 * @DataTime: 2022-02-09 14:00
* @功能说明:配送订单详情 * @功能说明:配送订单详情
*/ */
public function sendOrderInfo(){ public function sendOrderInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -1582,7 +1602,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2021-07-10 00:40 * @DataTime: 2021-07-10 00:40
* @功能说明:可用的优惠券列表 * @功能说明:可用的优惠券列表
*/ */
public function couponList(){ public function couponList()
{
$input = $this->_param; $input = $this->_param;
@@ -1618,7 +1639,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-08-16 15:15 * @DataTime: 2022-08-16 15:15
* @功能说明:用户认养拼团 * @功能说明:用户认养拼团
*/ */
public function userCollageLimit(){ public function userCollageLimit()
{
$input = $this->_param; $input = $this->_param;
@@ -1639,7 +1661,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-08-16 15:15 * @DataTime: 2022-08-16 15:15
* @功能说明:用户认养拼团列表 * @功能说明:用户认养拼团列表
*/ */
public function userCollageList(){ public function userCollageList()
{
$input = $this->_param; $input = $this->_param;
@@ -1669,7 +1692,8 @@ class IndexClaim extends ApiRest
* @DataTime: 2022-08-16 16:12 * @DataTime: 2022-08-16 16:12
* @功能说明:拼团商品列表 * @功能说明:拼团商品列表
*/ */
public function collageList(){ public function collageList()
{
$collage_model = new ClaimCollage(); $collage_model = new ClaimCollage();
@@ -1707,8 +1731,4 @@ class IndexClaim extends ApiRest
} }
} }

View File

@@ -1,5 +1,7 @@
<?php <?php
namespace app\farm\controller; namespace app\farm\controller;
use app\ApiRest; use app\ApiRest;
use app\farm\model\Breed; use app\farm\model\Breed;
@@ -49,7 +51,8 @@ class IndexFarmer extends ApiRest
protected $land_model; protected $land_model;
public function __construct(App $app) { public function __construct(App $app)
{
parent::__construct($app); parent::__construct($app);
@@ -86,7 +89,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-02-24 16:13 * @DataTime: 2022-02-24 16:13
* @功能说明:农场主详情 * @功能说明:农场主详情
*/ */
public function farmerInfo(){ public function farmerInfo()
{
return $this->success($this->farmer); return $this->success($this->farmer);
@@ -98,7 +102,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-02-24 16:16 * @DataTime: 2022-02-24 16:16
* @功能说明:编辑农场主 * @功能说明:编辑农场主
*/ */
public function farmerUpdate(){ public function farmerUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -130,7 +135,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-10 17:51 * @DataTime: 2021-12-10 17:51
* @功能说明:土地列表 * @功能说明:土地列表
*/ */
public function landList(){ public function landList()
{
$input = $this->_param; $input = $this->_param;
@@ -165,7 +171,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-10 18:05 * @DataTime: 2021-12-10 18:05
* @功能说明:添加土地 * @功能说明:添加土地
*/ */
public function landAdd(){ public function landAdd()
{
$input = $this->_input; $input = $this->_input;
@@ -182,13 +189,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-10 18:05 * @DataTime: 2021-12-10 18:05
* @功能说明:编辑土地 * @功能说明:编辑土地
*/ */
public function landUpdate(){ public function landUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -212,7 +219,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-10 18:05 * @DataTime: 2021-12-10 18:05
* @功能说明:编辑土地 * @功能说明:编辑土地
*/ */
public function landStatusUpdate(){ public function landStatusUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -229,14 +237,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-10 18:05 * @DataTime: 2021-12-10 18:05
* @功能说明:土地详情 * @功能说明:土地详情
*/ */
public function landInfo(){ public function landInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -258,7 +265,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 14:43 * @DataTime: 2021-12-14 14:43
* @功能说明:地块列表 * @功能说明:地块列表
*/ */
public function massifList(){ public function massifList()
{
$input = $this->_param; $input = $this->_param;
@@ -285,7 +293,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 14:43 * @DataTime: 2021-12-14 14:43
* @功能说明:地块列表下拉框 * @功能说明:地块列表下拉框
*/ */
public function massifSelect(){ public function massifSelect()
{
$input = $this->_param; $input = $this->_param;
@@ -311,7 +320,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 14:49 * @DataTime: 2021-12-14 14:49
* @功能说明:添加地块 * @功能说明:添加地块
*/ */
public function massifAdd(){ public function massifAdd()
{
$input = $this->_input; $input = $this->_input;
@@ -333,7 +343,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 14:50 * @DataTime: 2021-12-14 14:50
* @功能说明:编辑地块 * @功能说明:编辑地块
*/ */
public function massifUpdate(){ public function massifUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -362,13 +373,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-14 14:50 * @DataTime: 2021-12-14 14:50
* @功能说明:地块详情 * @功能说明:地块详情
*/ */
public function massifInfo(){ public function massifInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -389,7 +400,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-20 16:54 * @DataTime: 2021-12-20 16:54
* @功能说明:种子列表 * @功能说明:种子列表
*/ */
public function seedList(){ public function seedList()
{
$input = $this->_param; $input = $this->_param;
@@ -426,7 +438,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-20 16:54 * @DataTime: 2021-12-20 16:54
* @功能说明:种子列表 * @功能说明:种子列表
*/ */
public function seedSelect(){ public function seedSelect()
{
$input = $this->_param; $input = $this->_param;
@@ -448,12 +461,14 @@ class IndexFarmer extends ApiRest
return $this->success($data); return $this->success($data);
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-20 16:57 * @DataTime: 2021-12-20 16:57
* @功能说明:添加种子 * @功能说明:添加种子
*/ */
public function seedAdd(){ public function seedAdd()
{
$input = $this->_input; $input = $this->_input;
@@ -472,14 +487,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2021-12-14 14:50 * @DataTime: 2021-12-14 14:50
* @功能说明:编辑种子 * @功能说明:编辑种子
*/ */
public function seedUpdate(){ public function seedUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -515,7 +529,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 14:50 * @DataTime: 2021-12-14 14:50
* @功能说明:编辑种子 * @功能说明:编辑种子
*/ */
public function seedInfo(){ public function seedInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -538,10 +553,10 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 15:28 * @DataTime: 2021-12-14 15:28
* @功能说明:认养管理列表 * @功能说明:认养管理列表
*/ */
public function claimList(){ public function claimList()
{
echo 1;die;
$input = $this->_param; $input = $this->_param;
$claim_model = new Claim(); $claim_model = new Claim();
$dis[] = ['uniacid', '=', $this->_uniacid]; $dis[] = ['uniacid', '=', $this->_uniacid];
@@ -577,7 +592,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 16:32 * @DataTime: 2021-12-14 16:32
* @功能说明:添加认养 * @功能说明:添加认养
*/ */
public function claimAdd(){ public function claimAdd()
{
$input = $this->_input; $input = $this->_input;
@@ -601,7 +617,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 16:32 * @DataTime: 2021-12-14 16:32
* @功能说明:认养详情 * @功能说明:认养详情
*/ */
public function claimInfo(){ public function claimInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -650,7 +667,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 16:32 * @DataTime: 2021-12-14 16:32
* @功能说明:编辑认养 * @功能说明:编辑认养
*/ */
public function claimUpdate(){ public function claimUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -675,7 +693,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 16:32 * @DataTime: 2021-12-14 16:32
* @功能说明:编辑认养 * @功能说明:编辑认养
*/ */
public function claimStatusUpdate(){ public function claimStatusUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -698,7 +717,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 17:04 * @DataTime: 2021-12-14 17:04
* @功能说明:溯源列表 * @功能说明:溯源列表
*/ */
public function sourceList(){ public function sourceList()
{
$input = $this->_param; $input = $this->_param;
@@ -736,7 +756,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 17:04 * @DataTime: 2021-12-14 17:04
* @功能说明:溯源下拉框 * @功能说明:溯源下拉框
*/ */
public function sourceSelect(){ public function sourceSelect()
{
$input = $this->_param; $input = $this->_param;
@@ -763,7 +784,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 17:10 * @DataTime: 2021-12-14 17:10
* @功能说明:添加溯源 * @功能说明:添加溯源
*/ */
public function sourceAdd(){ public function sourceAdd()
{
$input = $this->_input; $input = $this->_input;
@@ -787,7 +809,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 17:12 * @DataTime: 2021-12-14 17:12
* @功能说明:编辑溯源 * @功能说明:编辑溯源
*/ */
public function sourceUpdate(){ public function sourceUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -823,7 +846,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-14 17:12 * @DataTime: 2021-12-14 17:12
* @功能说明:编辑溯源 * @功能说明:编辑溯源
*/ */
public function sourceInfo(){ public function sourceInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -846,7 +870,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-29 10:29 * @DataTime: 2021-12-29 10:29
* @功能说明:养殖管理 * @功能说明:养殖管理
*/ */
public function breedList(){ public function breedList()
{
$input = $this->_param; $input = $this->_param;
@@ -875,7 +900,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-29 10:30 * @DataTime: 2021-12-29 10:30
* @功能说明:添加养殖管理 * @功能说明:添加养殖管理
*/ */
public function breedAdd(){ public function breedAdd()
{
$input = $this->_input; $input = $this->_input;
@@ -897,7 +923,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-29 10:34 * @DataTime: 2021-12-29 10:34
* @功能说明:编辑养殖管理 * @功能说明:编辑养殖管理
*/ */
public function breedUpdate(){ public function breedUpdate()
{
$input = $this->_input; $input = $this->_input;
@@ -922,7 +949,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-29 10:34 * @DataTime: 2021-12-29 10:34
* @功能说明:编辑养殖管理 * @功能说明:编辑养殖管理
*/ */
public function breedInfo(){ public function breedInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -945,7 +973,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-30 11:15 * @DataTime: 2021-12-30 11:15
* @功能说明:申请提现 * @功能说明:申请提现
*/ */
public function applyWallet(){ public function applyWallet()
{
$input = $this->_input; $input = $this->_input;
@@ -1027,7 +1056,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-02-09 15:06 * @DataTime: 2022-02-09 15:06
* @功能说明:农场主财务详情 * @功能说明:农场主财务详情
*/ */
public function farmerFinanceInfo(){ public function farmerFinanceInfo()
{
$water_model = new FinanceWater(); $water_model = new FinanceWater();
@@ -1053,7 +1083,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-02-09 16:35 * @DataTime: 2022-02-09 16:35
* @功能说明:农场主流水记录 * @功能说明:农场主流水记录
*/ */
public function farmerFinanceList(){ public function farmerFinanceList()
{
$input = $this->_param; $input = $this->_param;
@@ -1086,7 +1117,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-30 17:09 * @DataTime: 2021-12-30 17:09
* @功能说明:农场主提现列表 * @功能说明:农场主提现列表
*/ */
public function walletList(){ public function walletList()
{
$input = $this->_param; $input = $this->_param;
@@ -1119,7 +1151,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-31 15:11 * @DataTime: 2021-12-31 15:11
* @功能说明:认养和土地分类 * @功能说明:认养和土地分类
*/ */
public function landAndClaimCate(){ public function landAndClaimCate()
{
$input = $this->_param; $input = $this->_param;
@@ -1158,7 +1191,6 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-01-10 15:52 * @DataTime: 2022-01-10 15:52
@@ -1166,7 +1198,8 @@ class IndexFarmer extends ApiRest
* *
*/ */
public function breedOrderList(){ public function breedOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1188,7 +1221,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-02-09 15:16 * @DataTime: 2022-02-09 15:16
* @功能说明:认养订单 * @功能说明:认养订单
*/ */
public function claimOrderList(){ public function claimOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1243,13 +1277,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-02-09 09:47 * @DataTime: 2022-02-09 09:47
* @功能说明:发货订单发货 * @功能说明:发货订单发货
*/ */
public function sendOrderSend(){ public function sendOrderSend()
{
$input = $this->_input; $input = $this->_input;
@@ -1302,13 +1336,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-02-08 17:14 * @DataTime: 2022-02-08 17:14
* @功能说明:配送订单列表 * @功能说明:配送订单列表
*/ */
public function farmerSendOrderList(){ public function farmerSendOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1367,13 +1401,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-02-09 09:47 * @DataTime: 2022-02-09 09:47
* @功能说明:配送订单收货 * @功能说明:配送订单收货
*/ */
public function sendOrderPickup(){ public function sendOrderPickup()
{
$input = $this->_input; $input = $this->_input;
@@ -1408,7 +1442,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-12-28 11:26 * @DataTime: 2021-12-28 11:26
* @功能说明:用户下单列表 * @功能说明:用户下单列表
*/ */
public function landOrderList(){ public function landOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1475,13 +1510,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-02-21 11:00 * @DataTime: 2022-02-21 11:00
* @功能说明:仪器列表 * @功能说明:仪器列表
*/ */
public function machineSelect(){ public function machineSelect()
{
$input = $this->_param; $input = $this->_param;
@@ -1505,7 +1540,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-02-22 17:11 * @DataTime: 2022-02-22 17:11
* @功能说明:生成二维码 * @功能说明:生成二维码
*/ */
public function getSourceQr(){ public function getSourceQr()
{
$input = $this->_input; $input = $this->_input;
@@ -1529,16 +1565,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-03-01 11:03 * @DataTime: 2022-03-01 11:03
* @功能说明:订单列表 * @功能说明:订单列表
*/ */
public function shopOrderList(){ public function shopOrderList()
{
$input = $this->_param; $input = $this->_param;
@@ -1603,7 +1636,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2021-03-15 14:58 * @DataTime: 2021-03-15 14:58
* @功能说明:订单详情 * @功能说明:订单详情
*/ */
public function shopOrderInfo(){ public function shopOrderInfo()
{
$input = $this->_param; $input = $this->_param;
@@ -1647,7 +1681,8 @@ class IndexFarmer extends ApiRest
* @DataTime: 2022-03-07 11:08 * @DataTime: 2022-03-07 11:08
* @功能说明:地主商城订单发货 * @功能说明:地主商城订单发货
*/ */
public function shopOrderSend(){ public function shopOrderSend()
{
$input = $this->_input; $input = $this->_input;
@@ -1714,13 +1749,13 @@ class IndexFarmer extends ApiRest
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-04-11 14:22 * @DataTime: 2022-04-11 14:22
* @功能说明:监控列表 * @功能说明:监控列表
*/ */
public function monitorSelect(){ public function monitorSelect()
{
$input = $this->_param; $input = $this->_param;
@@ -1744,8 +1779,4 @@ class IndexFarmer extends ApiRest
} }
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace app\farm\model; namespace app\farm\model;
use app\BaseModel; use app\BaseModel;
@@ -21,7 +22,8 @@ class Farmer extends BaseModel
* @DataTime: 2022-03-02 17:12 * @DataTime: 2022-03-02 17:12
* @功能说明: * @功能说明:
*/ */
public function getTimeStatusAttr($value,$data){ public function getTimeStatusAttr($value, $data)
{
if (!empty($data['start_time']) && !empty($data['end_time'])) { if (!empty($data['start_time']) && !empty($data['end_time'])) {
@@ -47,7 +49,8 @@ class Farmer extends BaseModel
* @DataTime: 2021-12-30 11:22 * @DataTime: 2021-12-30 11:22
* @功能说明: * @功能说明:
*/ */
public function getImgsAttr($value,$data){ public function getImgsAttr($value, $data)
{
if (!empty($value)) { if (!empty($value)) {
@@ -61,7 +64,8 @@ class Farmer extends BaseModel
* @DataTime: 2021-12-30 11:22 * @DataTime: 2021-12-30 11:22
* @功能说明: * @功能说明:
*/ */
public function getIdcardImgsAttr($value,$data){ public function getIdcardImgsAttr($value, $data)
{
if (!empty($value)) { if (!empty($value)) {
@@ -69,12 +73,14 @@ class Farmer extends BaseModel
} }
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2020-09-29 11:04 * @DataTime: 2020-09-29 11:04
* @功能说明:添加 * @功能说明:添加
*/ */
public function dataAdd($data){ public function dataAdd($data)
{
$data['create_time'] = time(); $data['create_time'] = time();
@@ -85,13 +91,13 @@ class Farmer extends BaseModel
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2020-09-29 11:05 * @DataTime: 2020-09-29 11:05
* @功能说明:编辑 * @功能说明:编辑
*/ */
public function dataUpdate($dis,$data){ public function dataUpdate($dis, $data)
{
$res = $this->where($dis)->update($data); $res = $this->where($dis)->update($data);
@@ -105,7 +111,8 @@ class Farmer extends BaseModel
* @DataTime: 2020-09-29 11:06 * @DataTime: 2020-09-29 11:06
* @功能说明:列表 * @功能说明:列表
*/ */
public function dataList($dis,$page=10){ public function dataList($dis, $page = 10)
{
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray(); $data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
@@ -119,7 +126,8 @@ class Farmer extends BaseModel
* @DataTime: 2020-09-29 11:06 * @DataTime: 2020-09-29 11:06
* @功能说明:列表 * @功能说明:列表
*/ */
public function dataDistanceList($dis,$alh,$alhs=[],$page=10){ public function dataDistanceList($dis, $alh, $alhs = [], $page = 10)
{
$data = $this->where($dis)->where($alhs)->field(['*', $alh])->order('distance asc,id desc')->paginate($page)->toArray(); $data = $this->where($dis)->where($alhs)->field(['*', $alh])->order('distance asc,id desc')->paginate($page)->toArray();
@@ -133,7 +141,8 @@ class Farmer extends BaseModel
* @DataTime: 2021-12-30 11:26 * @DataTime: 2021-12-30 11:26
* @功能说明:后台列表 * @功能说明:后台列表
*/ */
public function adminDataList($dis,$page=10,$where=[]){ public function adminDataList($dis, $page = 10, $where = [])
{
$data = $this->alias('a') $data = $this->alias('a')
->join('lbfarm_user_list b', 'a.user_id = b.id', 'left') ->join('lbfarm_user_list b', 'a.user_id = b.id', 'left')
@@ -157,7 +166,8 @@ class Farmer extends BaseModel
* @DataTime: 2020-09-29 11:43 * @DataTime: 2020-09-29 11:43
* @功能说明: * @功能说明:
*/ */
public function dataInfo($dis,$file='*'){ public function dataInfo($dis, $file = '*')
{
$data = $this->where($dis)->field($file)->find(); $data = $this->where($dis)->field($file)->find();
@@ -171,7 +181,8 @@ class Farmer extends BaseModel
* @DataTime: 2022-02-22 11:30 * @DataTime: 2022-02-22 11:30
* @功能说明:检查用户是否是地主 * @功能说明:检查用户是否是地主
*/ */
public function landlordCheck($user_id){ public function landlordCheck($user_id)
{
$cap_dis[] = ['user_id', '=', $user_id]; $cap_dis[] = ['user_id', '=', $user_id];
@@ -216,7 +227,8 @@ class Farmer extends BaseModel
* @DataTime: 2022-02-22 11:53 * @DataTime: 2022-02-22 11:53
* @功能说明:初始化地主表 * @功能说明:初始化地主表
*/ */
public function initLandLord($data,$uniacid){ public function initLandLord($data, $uniacid)
{
$dis = [ $dis = [
@@ -262,7 +274,8 @@ class Farmer extends BaseModel
* @DataTime: 2020-10-21 15:21 * @DataTime: 2020-10-21 15:21
* @功能说明:保留两位小数 * @功能说明:保留两位小数
*/ */
public function getDistanceAttr($value){ public function getDistanceAttr($value)
{
if (!empty($value)) { if (!empty($value)) {
@@ -288,14 +301,13 @@ class Farmer extends BaseModel
} }
/** /**
* @author chenniang * @author chenniang
* @DataTime: 2022-02-28 14:08 * @DataTime: 2022-02-28 14:08
* @功能说明:添加商品时农场主下拉框 * @功能说明:添加商品时农场主下拉框
*/ */
public function goodsFarmerSelect($user_id){ public function goodsFarmerSelect($user_id)
{
$land_order_model = new LandOrder(); $land_order_model = new LandOrder();
@@ -322,7 +334,8 @@ class Farmer extends BaseModel
* @DataTime: 2022-02-28 16:06 * @DataTime: 2022-02-28 16:06
* @功能说明: * @功能说明:
*/ */
public function farmerId($uniacid){ public function farmerId($uniacid)
{
$dis = [ $dis = [
@@ -338,7 +351,4 @@ class Farmer extends BaseModel
} }
} }

View File

@@ -0,0 +1,528 @@
<template>
<view class="claim-detail">
<uni-nav-bar :fixed="true" title="认植认养详情" backgroundColor="none" color="#FFFFFF"></uni-nav-bar>
<swiper class="banner-swiper" circular autoplay>
<swiper-item>
<image class="banner-img" mode="aspectFill" src="@/static/image/imgicon/banner.png"></image>
</swiper-item>
</swiper>
<view class="headr-wrap">
<view class="flex">
<view class="flex-1">
<view class="name">大鹅大鹅大鹅大鹅</view>
<view class="intro">已有178人参加</view>
</view>
<view class="money">
<text></text>
299
</view>
</view>
<view class="headr-info flex">
<view class="headr-info-item flex-1">
<text>品种</text>
</view>
<view class="headr-info-item flex-1">
<text>产量</text>
3kg
</view>
<view class="headr-info-item flex-1">
<text>周期</text>
365
</view>
</view>
</view>
<view class="title-item">
<view class="title">实时数据</view>
<view class="weather-wrap">
<view class="weather-item" v-for="i in 5">
<image class="icon" mode="aspectFit" src="@/static/image/imgicon/weather_icon1.png"></image>
<view class="flex-1">
<view class="label">湿度值</view>
<view class="count">
11.0
<text>%</text>
</view>
</view>
</view>
</view>
</view>
<view class="title-item">
<view class="title">认养收获</view>
</view>
<view class="title-item">
<view class="title">认养规则</view>
</view>
<view class="title-item">
<view class="title">认养详情</view>
</view>
<view class="space-max-footer"></view>
<view class="footer-btn fill-base fix">
<view class="footer-item flex-between">
<view class="flex-warp f-caption c-title">
<view @tap.stop="$util.goUrl({ url: detail.farmer_info.mobile, openType: 'call' })" class="min-but flex-center flex-column">
<image class="img-icon" mode="aspectFit" src="@/static/image/imgicon/kefu_icon.png"></image>
<view>客服</view>
</view>
</view>
<view class="flex-1 money-box">
<text class="old text-delete">399</text>
<text class="unit"></text>
<text>399</text>
</view>
<view class="flex-warp" v-if="detail.collage_data && detail.collage_data.id">
<view @tap.stop="toOrder" class="order-btn flex-center">单独认养</view>
<view @tap.stop="toOrder(1)" class="order-btn flex-center">去众筹</view>
</view>
<view @tap.stop="toOrder" class="order-btn flex-center" v-else>立即认养</view>
</view>
<view class="space-safe"></view>
</view>
</view>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
export default {
components: {},
data() {
return {
options: {},
detail: {},
bannerCurrent: 0,
bannerList: [],
typeList: [],
current: 0,
param: {
page: 1,
limit: 10
},
list: {
data: []
},
loading: true,
lockTap: false
};
},
computed: mapState({
primaryColor: (state) => state.config.configInfo.primaryColor,
subColor: (state) => state.config.configInfo.subColor,
configInfo: (state) => state.config.configInfo,
userInfo: (state) => state.user.userInfo,
haveOperItem: (state) => state.order.haveOperItem
}),
onLoad(options) {
this.$util.showLoading();
this.options = options;
this.updateOrderItem({
key: 'haveOperItem',
val: false
});
this.initIndex();
},
onUnload() {
if (!this.haveOperItem) return;
this.$util.back();
},
onPullDownRefresh() {
// #ifndef APP-PLUS
uni.showNavigationBarLoading();
// #endif
this.initRefresh();
uni.stopPullDownRefresh();
},
onShareAppMessage(e) {
let { id: pid } = this.userInfo;
let { id, title, cover: imageUrl } = this.detail;
let path = `/claim/pages/detail?id=${id}&pid=${pid}`;
this.$util.log(path);
return {
title,
imageUrl,
path
};
},
methods: {
...mapMutations(['updateOrderItem']),
async initIndex(refresh = false) {
let { id } = this.options;
let data = await this.$api.claim.claimInfo({
id
});
data.markers = [
{
iconPath: 'https://lbqnyv2.migugu.com/images/12/2018/11/A33zQycihMM33y337LH23myTqTl3tl.png',
id: 0,
latitude: data.lat,
longitude: data.lng,
width: 28,
height: 28
}
];
let {
imgs = [],
monitor = [],
user_start_collage = {
id: 0
}
} = data;
let bannerList = [];
let typeList = [];
if (imgs && imgs.length > 0) {
imgs.map((item) => {
bannerList.push({
img: item,
link: '',
link_type: 'img'
});
});
typeList.push({
title: '图片',
type: 'img'
});
}
if (monitor && monitor.length > 0) {
monitor.map((item) => {
bannerList.push({
img: item.cover,
link: item.id,
link_type: 'monitor'
});
});
typeList.push({
title: '监控',
type: 'monitor'
});
}
this.typeList = typeList;
this.bannerList = bannerList;
this.detail = data;
this.$util.hideAll();
await this.getList();
if (user_start_collage && user_start_collage.id && !refresh) {
this.$refs.show_collage_share.open();
}
},
initRefresh() {
this.initIndex(true);
},
countEnd() {
this.$util.log('倒计时完了');
setTimeout(() => {
this.initRefresh();
}, 1000);
},
linkpress(res) {
console.log('linkpress', res);
// #ifdef APP-PLUS
this.$util.goUrl({
url: res.href,
openType: 'web'
});
// #endif
},
async getList() {
let { list: oldList } = this;
let { id: goods_id } = this.options;
let param = Object.assign({}, this.param, {
goods_id,
type: 1,
is_goods: 0
});
let newList = await this.$api.mine.goodsEvaluateList(param);
if (this.param.page == 1) {
this.list = newList;
} else {
newList.data = oldList.data.concat(newList.data);
this.list = newList;
}
this.loading = false;
this.$util.hideAll();
},
handerSwiperChange(e) {
let { current } = e.detail;
this.bannerCurrent = current;
},
handerBannerClick(index) {
let item = this.bannerList[index];
let { link_type: openType, link: id, img } = item;
if (openType == 'monitor') {
let url = `/home/pages/monitor/detail?id=${id}`;
this.$util.goUrl({
url
});
return;
}
uni.previewImage({
current: img,
urls: [img]
});
},
async toMap() {
let { lat, lng, address } = this.detail;
await this.$util.checkAuth({
type: 'userLocation'
});
await uni.getLocation({
type: 'gcj02'
});
await uni.openLocation({
latitude: lat * 1,
longitude: lng * 1,
name: address,
scale: 28
});
},
toPreviewImage(index, aindex) {
let { imgs: urls } = this.list.data[index];
this.$util.previewImage({
current: urls[aindex],
urls
});
},
toJoin(index) {
let { id: cid, claim_id, user_id, can_join } = this.detail.collage_list[index];
let { join_times } = this.detail.collage_data;
let { id: uid } = this.userInfo;
if (user_id == uid || !can_join) {
this.$util.showToast({
title: user_id == uid ? `不能参与自己发起的众筹哦` : `您已参与此众筹或已达到参与次数${join_times}`
});
return;
}
let url = `/claim/pages/order?id=${claim_id}&cid=${cid}&type=2`;
this.$util.goUrl({
url
});
},
toOrder(type = 0) {
let { id } = this.options;
let {
collage_data = {
id: 0
},
user_start_collage = {
id: 0
}
} = this.detail;
let { id: cid = 0, can_start, start_times } = collage_data;
if (type == 1 && user_start_collage && user_start_collage.id) {
this.$refs.show_collage_share.open();
return;
}
if (type == 1 && !can_start) {
this.$util.showToast({
title: `您已达到发起众筹次数${start_times}`
});
return;
}
let url = `/claim/pages/order?id=${id}&cid=${cid}&type=${type}`;
this.$util.goUrl({
url
});
}
}
};
</script>
<style lang="scss">
.claim-detail {
min-height: 100vh;
background: #ffffff;
}
.banner-swiper {
height: 480rpx;
width: 100%;
.banner-img {
display: block;
height: 100%;
width: 100%;
border-radius: 0 0 12rpx 12rpx;
}
}
.headr-wrap {
margin: -110rpx 28rpx 0;
padding: 20rpx 28rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 8rpx rgba(229, 229, 229, 0.25);
border-radius: 18rpx;
position: relative;
z-index: 1;
.name {
line-height: 40rpx;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.intro {
margin-top: 4rpx;
line-height: 34rpx;
font-weight: 500;
font-size: 24rpx;
color: #777777;
}
.money {
line-height: 56rpx;
font-weight: bold;
color: #ff0000;
font-size: 40rpx;
margin: 12rpx 0 0 20rpx;
text {
font-size: 24rpx;
vertical-align: baseline;
}
}
.headr-info {
margin-top: 46rpx;
}
.headr-info-item {
line-height: 40rpx;
font-weight: 500;
font-size: 28rpx;
color: #333333;
text {
color: #999999;
margin-right: 12rpx;
vertical-align: baseline;
}
}
}
.title-item {
margin: 0 28rpx;
padding: 28rpx 0 36rpx;
position: relative;
&::after {
content: ' ';
display: block;
border-top: 1px solid #f2f2f2;
width: 200%;
height: 0;
position: absolute;
left: 0;
top: 0;
transform: scale(0.5);
transform-origin: 0 0;
}
.title {
line-height: 40rpx;
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 20rpx;
}
.weather-wrap {
display: flex;
flex-wrap: wrap;
.weather-item {
width: 214rpx;
background: rgba(19, 186, 231, 0.1);
border-radius: 12rpx;
margin: 0 28rpx 20rpx 0;
padding: 18rpx 0 16rpx 26rpx;
display: flex;
align-items: flex-start;
&:nth-child(3) {
margin-right: 0;
}
.icon {
width: 36rpx;
height: 36rpx;
margin-right: 8rpx;
}
.label {
line-height: 34rpx;
font-weight: 500;
font-size: 24rpx;
color: #777777;
margin-bottom: 2rpx;
}
.count {
line-height: 44rpx;
font-weight: bold;
font-size: 32rpx;
color: #13bae7;
text {
font-size: 24rpx;
vertical-align: baseline;
}
}
}
}
}
.footer-btn {
bottom: 0;
.footer-item {
height: 96rpx;
padding: 0 30rpx;
.min-but {
line-height: 34rpx;
font-weight: 500;
font-size: 24rpx;
color: #777777;
text-align: center;
padding: 0 8rpx;
}
.img-icon {
width: 48rpx;
height: 48rpx;
display: block;
margin: 0 auto;
}
}
.money-box {
line-height: 56rpx;
font-weight: bold;
font-size: 40rpx;
color: #ff0000;
text-align: right;
padding: 0 6rpx;
padding: 16rpx 6rpx 0;
.old {
font-size: 28rpx;
color: #777777;
}
.unit {
font-size: 24rpx;
margin-left: 6rpx;
}
text {
vertical-align: baseline;
}
}
.order-btn {
width: 244rpx;
height: 72rpx;
background: linear-gradient(180deg, #43c5fe 0%, #358ffd 100%);
border-radius: 72rpx;
font-weight: bold;
font-size: 32rpx;
color: #ffffff;
}
}
</style>

View File

@@ -0,0 +1,776 @@
<template>
<view class="claim-detail" v-if="detail.id">
<view class='banner-info'>
<swiper class='banner-swiper' @change='handerSwiperChange' :autoplay="true">
<swiper-item v-for="(item,index) in bannerList" :key="index" @tap='handerBannerClick(index)'>
<image mode="aspectFill" class='banner-img' :src='item.img'></image>
<view class="banner-swiper img-bg c-base iconfont icon-zhibo abs flex-center"
v-if="bannerList[bannerCurrent].link_type == 'monitor'"></view>
</swiper-item>
</swiper>
<view class='banner-tagitem banner-tagitem_count'>{{bannerCurrent+1}}/{{bannerList.length}}</view>
<view class='banner-taglist'>
<view class='banner-tagitem'
:class="[{'banner-tagitem_active':item.type==bannerList[bannerCurrent].link_type},{'radius-10':typeList.length == 1},{'radius-left':typeList.length > 1 && index == 0},{'radius-right':typeList.length > 1 && index === typeList.length -1}]"
v-for="(item,index) in typeList" :key="index">
{{item.title}}
</view>
</view>
</view>
<view class="collage-info rel mb-md" v-if="detail.collage_data && detail.collage_data.id">
<image mode="aspectFill" class="collage-img abs" src="https://lbqny.migugu.com/admin/farm/collage.png">
</image>
<view class="collage-count abs">
<min-countdown :type="3" :targetTime="detail.collage_data.end_time * 1000" :color="primaryColor"
textColor="#fff" className="sm" @callback="countEnd">
</min-countdown>
<view class="flex-center f-icontext c-base mt-sm">距结束还剩</view>
</view>
<view class="collage-content pt-md pl-md f-icontext c-base abs">
<view class="f-lg-title"> ¥{{detail.collage_data.price}} </view>
<view class="flex-y-center">
<view class="f-caption text-delete">原价 ¥{{detail.price}} </view>
<view class="collage-num flex-center radius-4 ml-sm pl-sm pr-sm" :style="{color:primaryColor}">
{{detail.collage_data.success_num}}人团
</view>
</view>
</view>
</view>
<view class="pd-lg fill-base">
<view class="flex-center">
<!-- #ifdef MP-WEIXIN -->
<view class="max-566">
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view class="flex-1">
<!-- #endif -->
<view class="f-title c-title">{{detail.title}}</view>
<view class="flex-y-baseline">
<view class="price c-warning">¥{{detail.price}}</view>
<view class="f-caption c-caption ml-sm">/{{detail.unit}}</view>
</view>
</view>
<!-- #ifdef MP-WEIXIN -->
<button open-type="share" class="clear-btn flex-center flex-column">
<i class="iconfont icon-share c-title"></i>
<view class="f-caption c-title">分享</view>
</button>
<!-- #endif -->
</view>
<view class="f-caption c-caption">
<text decode="emsp" style="word-break:break-all;">{{detail.desc}}</text>
</view>
</view>
<view class="fill-base pd-lg mt-md" v-if="detail.collage_list.length > 0">
<view class="flex-between">
<view class="f-paragraph c-title">不想自己开团? 可与下面小伙伴快速成团</view>
<view @tap="$util.goUrl({url:`/claim/pages/collage/more?id=${options.id}`})"
class="flex-y-center f-caption c-caption">
查看更多<i class="iconfont icon-right" style="font-size:24rpx"></i></view>
</view>
<view @tap="toJoin(index)" class="collage-item flex-center pt-lg pb-lg" :class="[{'b-1px-t':index!=0}]"
v-for="(item,index) in detail.collage_list" :key="index">
<image class="avatar radius" :src="item.user_info.avatarUrl"></image>
<view class="flex-1 flex-center ml-md">
<view class="flex-1 mr-md flex-between">
<view class="f-desc c-title max-150 ellipsis">{{item.user_info.nickName}}</view>
<view>
<view class="flex-between">
<view></view>
<view class="flex-y-center f-paragraph"><view class="c-warning">
{{item.surplus_num}}
</view>人成团
</view>
</view>
<view class="flex-y-center f-icontext c-caption">
<min-countdown :type="5" :targetTime="item.end_time * 1000" color="#999"
@callback="countEnd">
</min-countdown>结束
</view>
</view>
</view>
<view class="common-btn flex-center f-paragraph c-base" :style="{background:primaryColor}">去参与
</view>
</view>
</view>
</view>
<view class="count-list flex-y-center fill-base pd-lg mt-md">
<view class="count-item flex-center flex-column">
<view class="f-title c-title ellipsis">{{detail.breed}}</view>
<view class="f-caption c-caption">认养品种</view>
</view>
<view class="line"></view>
<view class="count-item flex-center flex-column">
<view class="f-title c-title ellipsis">{{detail.cycle}}</view>
<view class="f-caption c-caption">认养周期</view>
</view>
<view class="line"></view>
<view class="count-item flex-center flex-column">
<view class="f-title c-title">{{detail.output}}kg</view>
<view class="f-caption c-caption">产量</view>
</view>
</view>
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title">
<view class="common-nav-title flex-center c-title">
<view class="common-line" :style="{background:primaryColor}"></view>
<view class="f-title text-bold flex-1">认养收获</view>
</view>
<view class="flex-center mt-md">
<image mode="aspectFill" lazy-load class="avatar lg box-shadow-mini radius-10"
:src="detail.harvest_cover">
</image>
<view class="flex-1 ml-lg f-paragraph c-title ellipsis">{{detail.harvest_text}}</view>
</view>
</view>
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title"
v-if="detail.process && detail.process.length > 0">
<view class="common-nav-title flex-center c-title">
<view class="common-line" :style="{background:primaryColor}"></view>
<view class="f-title text-bold flex-1">认养流程</view>
</view>
<view class="flex-warp" :class="[{'mt-md':index==0},{'mt-lg':index!=0}]"
v-for="(item,index) in detail.process" :key="index">
<image mode="aspectFill" lazy-load class="avatar sm" :src="item.cover"></image>
<view class="flex-1 ml-lg">
<view class="f-paragraph c-title">{{item.title}}</view>
<view class="f-caption c-caption">{{item.time}}</view>
<view class="f-caption c-desc">{{item.sub_title}}</view>
</view>
</view>
</view>
<block v-if="list.all_count>0">
<view class="mt-md pt-sm pl-lg pr-lg fill-base f-paragraph c-title">
<view class="common-nav-title flex-center c-title">
<view class="common-line" :style="{background:primaryColor}"></view>
<view class="flex-1 flex-between">
<view class="f-title text-bold">评价{{list.all_count}}</view>
<view @tap.stop="$util.goUrl({url:`/mine/pages/evaluate/more?id=${options.id}&type=1`})"
class="flex-y-center f-paragraph c-caption">
<view>查看全部</view>
<i class="iconfont icon-right" style="font-size: 28rpx;"></i>
</view>
</view>
</view>
</view>
<block v-for="(item,index) in list.data" :key="index">
<view class="flex-warp fill-base pd-lg" :class="[{'b-1px-t':index!=0}]" v-if="index<2">
<image mode="aspectFill" lazy-load class="avatar sm radius" :src="item.user_info.avatarUrl">
</image>
<view class="flex-1 ml-lg">
<view class="flex-between">
<view class="f-paragraph c-title max-350 ellipsis">{{item.user_info.nickName}}</view>
<view class="f-icontext c-caption">{{item.create_time}}</view>
</view>
<view class="flex-warp">
<i class="iconfont icon-star-fill icon-font-color mr-sm"
:style="{backgroundImage: aindex < item.star ? '-webkit-linear-gradient(90deg, #FDCD47, #FFC000)' : '-webkit-linear-gradient(90deg, #eee, #eee)'}"
v-for="(aitem,aindex) in 5" :key="aindex"></i>
</view>
<view class="f-caption c-desc mt-md">
<text decode="emsp" style="word-break:break-all;">{{item.text || '该用户没有填写评价哦'}}</text>
</view>
<view class="flex-warp mt-md" v-if="item.imgs && item.imgs.length > 0">
<block v-for="(aitem,aindex) in item.imgs" :key="aindex">
<view class="eva-img sm radius-10 rel" v-if="aindex < 3">
<image @tap.stop="toPreviewImage(index,aindex)" mode="aspectFill"
class="eva-img sm radius-10" :src="aitem">
</image>
<view class="more f-caption c-base abs"
v-if="aindex == 2 && item.imgs.length > 3">
+{{item.imgs.length - 3}}</view>
</view>
</block>
</view>
</view>
</view>
</block>
</block>
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title">
<view class="common-nav-title flex-center c-title">
<view class="common-line" :style="{background:primaryColor}"></view>
<view class="f-title text-bold flex-1">认养环境</view>
</view>
<view class="flex-center">
<image mode="aspectFill" lazy-load class="avatar mini radius" :src="detail.farmer_info.cover">
</image>
<view class="flex-1 ml-md">{{detail.farmer_info.title}}</view>
</view>
</view>
<view class="map-info rel">
<map :latitude="detail.lat" :longitude="detail.lng" :markers="detail.markers" :enable-satellite="true">
</map>
<view @tap.stop="toMap" class="farmer-title flex-center pl-md pr-sm c-base radius abs">
<view class="f-desc max-500 ellipsis">
{{detail.farmer_info.title}}
</view>
<i class="iconfont icon-right"></i>
</view>
</view>
<view class="order-count-info fill-base"
v-if="detail.machine_info.data && detail.machine_info.data.length > 0">
<view class="flex-between pt-lg pl-lg pr-lg">
<view class="flex-y-baseline f-paragraph c-caption">
<view class="c-title text-bold mr-sm">实时数据</view>
<!-- <view>更新于2021.09.10 16:24</view> -->
</view>
<!-- <i class="iconfont icon-shuaxin"></i> -->
</view>
<!-- <view class="pd-lg flex-center b-1px-b">
<view class="count-item flex-center flex-column">
<view class="f-paragraph c-title">28.7</view>
<view class="f-caption c-caption">热敏温度</view>
</view>
<view class="count-item flex-center flex-column b-1px-l b-1px-r">
<view class="f-paragraph c-title">28.7</view>
<view class="f-caption c-caption">噪声监测</view>
</view>
<view class="count-item flex-center flex-column">
<view class="f-paragraph c-title">28.7</view>
<view class="f-caption c-caption">移动监测</view>
</view>
</view> -->
<view class="pt-lg pl-lg pr-lg pb-md f-paragraph c-desc">
<view class="flex-y-baseline">
<view class="mr-md">无线温湿度</view>
<view>土壤电导率三合一</view>
</view>
<veiw class="flex-warp pb-md">
<view class="machine-item flex-warp f-desc c-caption mt-md"
v-for="(item,index) in detail.machine_info.data" :key="index">
<view class="num">{{`(${index*1+1})`}}</view>
<view class="text">{{item.text}}</view>
<view>{{item.value.length == 0 ? '无' : item.value}}</view>
</view>
</veiw>
<!-- <view class="flex-center pt-md"><i class="iconfont icon-down-bold" style="font-size: 28rpx;"></i></view> -->
</view>
</view>
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title">
<view class="common-nav-title flex-center c-title">
<view class="common-line" :style="{background:primaryColor}"></view>
<view class="f-title text-bold flex-1">详细说明</view>
</view>
<view class="pt-sm" v-if="detail.text">
<parser :html="detail.text" @linkpress="linkpress" show-with-animation lazy-load>加载中...</parser>
</view>
</view>
<view class="space-max-footer"></view>
<view class="footer-btn fill-base fix">
<view class="footer-item flex-between pr-lg">
<view class="flex-warp f-caption c-title">
<view @tap.stop="$util.goUrl({url:`/pages/home`,openType:`switchTab`})"
class="flex-center flex-column pl-lg pr-lg">
<i class="iconfont icon-home"></i>
<view>首页</view>
</view>
<view @tap.stop="$util.goUrl({url:detail.farmer_info.mobile,openType:'call'})"
class="flex-center flex-column pl-md">
<i class="iconfont icon-dianhua text-bold"></i>
<view>客服</view>
</view>
</view>
<view class="flex-warp" v-if="detail.collage_data && detail.collage_data.id">
<view @tap.stop="toOrder" class="order-btn flex-center f-title c-base text-bold radius-20"
:style="{color:primaryColor,border:`1rpx solid ${primaryColor}`}">
单独认养
</view>
<view @tap.stop="toOrder(1)"
class="order-btn flex-center ml-md f-title c-base text-bold radius-20"
:style="{background:primaryColor,border:`1rpx solid ${primaryColor}`}">
去众筹
</view>
</view>
<view @tap.stop="toOrder" class="order-btn md flex-center f-title c-base text-bold radius-20"
:style="{background:primaryColor}" v-else>立即认养
</view>
</view>
<view class="space-safe"></view>
</view>
<uni-popup ref="show_collage_share" type="center">
<view class="show-collage-share">
<view class="flex-center flex-column fill-base pd-lg radius-24">
<view class="f-md-title text-bold pt-lg pb-lg" :style="{color:primaryColor}">您有一个拼团正在进行中</view>
<view class="user-list flex-center mt-lg mb-lg">
<block v-for="(item,index) in detail.user_start_collage.user_avatar" :key="index">
<view class="avatar-group lg"
v-if="index < detail.user_start_collage.success_num > 3 ? 3 : detail.user_start_collage.success_num -1">
<image mode="aspectFill" lazy-load class="abs avatar fill-body radius" :src="item">
</image>
</view>
</block>
<block v-if="detail.user_start_collage.surplus_num">
<i class="iconfont icon-more ml-sm pl-lg pr-lg"></i>
<view class="more-btn flex-center radius"><i class="iconfont icon-add"></i> </view>
</block>
</view>
<min-countdown :type="2" :targetTime="detail.user_start_collage.end_time * 1000" color="#333"
textColor="#999" bgColor="#F7F7F7" className="md" @callback="countEnd">
</min-countdown>
<view class="f-desc c-caption mt-md mb-lg">还差{{detail.user_start_collage.surplus_num}}人成团距离结束还剩
</view>
<view class="space-lg"></view>
<!-- #ifdef MP-WEIXIN -->
<button open-type="share" class="clear-btn share-btn flex-center f-sm-title"
:style="{background:primaryColor}">
邀请好友
</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view @click="toAppShare" class="share-btn flex-center f-sm-title"
:style="{background:primaryColor}">
邀请好友
</view>
<!-- #endif -->
<view class="space-lg"></view>
</view>
<i @tap="$refs.show_collage_share.close()" class="flex-center mt-lg iconfont icon-close c-base"></i>
</view>
</uni-popup>
</view>
</template>
<script>
import {
mapState,
mapMutations
} from "vuex"
export default {
components: {},
data() {
return {
options: {},
detail: {},
bannerCurrent: 0,
bannerList: [],
typeList: [],
current: 0,
param: {
page: 1,
limit: 10
},
list: {
data: []
},
loading: true,
lockTap: false,
}
},
computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo,
userInfo: state => state.user.userInfo,
haveOperItem: state => state.order.haveOperItem,
}),
onLoad(options) {
this.$util.showLoading()
this.options = options
this.updateOrderItem({
key: 'haveOperItem',
val: false
})
this.initIndex()
},
onUnload() {
if (!this.haveOperItem) return
this.$util.back()
},
onPullDownRefresh() {
// #ifndef APP-PLUS
uni.showNavigationBarLoading()
// #endif
this.initRefresh()
uni.stopPullDownRefresh()
},
onShareAppMessage(e) {
let {
id: pid
} = this.userInfo
let {
id,
title,
cover: imageUrl
} = this.detail
let path = `/claim/pages/detail?id=${id}&pid=${pid}`
this.$util.log(path)
return {
title,
imageUrl,
path,
}
},
methods: {
...mapMutations(['updateOrderItem']),
async initIndex(refresh = false) {
let {
id
} = this.options
let data = await this.$api.claim.claimInfo({
id
})
data.markers = [{
iconPath: "https://lbqnyv2.migugu.com/images/12/2018/11/A33zQycihMM33y337LH23myTqTl3tl.png",
id: 0,
latitude: data.lat,
longitude: data.lng,
width: 28,
height: 28
}]
let {
imgs = [],
monitor = [],
user_start_collage = {
id: 0
}
} = data
let bannerList = []
let typeList = []
if (imgs && imgs.length > 0) {
imgs.map((item) => {
bannerList.push({
img: item,
link: '',
link_type: "img"
})
})
typeList.push({
title: "图片",
type: "img"
})
}
if (monitor && monitor.length > 0) {
monitor.map((item) => {
bannerList.push({
img: item.cover,
link: item.id,
link_type: "monitor"
})
})
typeList.push({
title: "监控",
type: "monitor"
})
}
this.typeList = typeList
this.bannerList = bannerList
this.detail = data
this.$util.hideAll()
await this.getList()
if (user_start_collage && user_start_collage.id && !refresh) {
this.$refs.show_collage_share.open()
}
},
initRefresh() {
this.initIndex(true)
},
countEnd() {
this.$util.log("倒计时完了")
setTimeout(() => {
this.initRefresh()
}, 1000)
},
linkpress(res) {
console.log("linkpress", res);
// #ifdef APP-PLUS
this.$util.goUrl({
url: res.href,
openType: 'web'
})
// #endif
},
async getList() {
let {
list: oldList,
} = this
let {
id: goods_id,
} = this.options
let param = Object.assign({}, this.param, {
goods_id,
type: 1,
is_goods: 0
});
let newList = await this.$api.mine.goodsEvaluateList(param);
if (this.param.page == 1) {
this.list = newList
} else {
newList.data = oldList.data.concat(newList.data)
this.list = newList
}
this.loading = false
this.$util.hideAll()
},
handerSwiperChange(e) {
let {
current,
} = e.detail
this.bannerCurrent = current;
},
handerBannerClick(index) {
let item = this.bannerList[index];
let {
link_type: openType,
link: id,
img
} = item;
if (openType == 'monitor') {
let url = `/home/pages/monitor/detail?id=${id}`
this.$util.goUrl({
url
})
return
}
uni.previewImage({
current: img,
urls: [img]
})
},
async toMap() {
let {
lat,
lng,
address
} = this.detail
await this.$util.checkAuth({
type: 'userLocation'
})
await uni.getLocation({
type: 'gcj02',
})
await uni.openLocation({
latitude: lat * 1,
longitude: lng * 1,
name: address,
scale: 28
})
},
toPreviewImage(index, aindex) {
let {
imgs: urls
} = this.list.data[index]
this.$util.previewImage({
current: urls[aindex],
urls
})
},
toJoin(index) {
let {
id: cid,
claim_id,
user_id,
can_join,
} = this.detail.collage_list[index]
let {
join_times
} = this.detail.collage_data
let {
id: uid
} = this.userInfo
if (user_id == uid || !can_join) {
this.$util.showToast({
title: user_id == uid ? `不能参与自己发起的众筹哦` : `您已参与此众筹或已达到参与次数${join_times}`
})
return
}
let url = `/claim/pages/order?id=${claim_id}&cid=${cid}&type=2`
this.$util.goUrl({
url
})
},
toOrder(type = 0) {
let {
id
} = this.options
let {
collage_data = {
id: 0
},
user_start_collage = {
id: 0
}
} = this.detail
let {
id: cid = 0,
can_start,
start_times
} = collage_data
if (type == 1 && user_start_collage && user_start_collage.id) {
this.$refs.show_collage_share.open()
return
}
if (type == 1 && !can_start) {
this.$util.showToast({
title: `您已达到发起众筹次数${start_times}`
})
return
}
let url = `/claim/pages/order?id=${id}&cid=${cid}&type=${type}`
this.$util.goUrl({
url
})
}
}
}
</script>
<style lang="scss">
.claim-detail {
.collage-info {
width: 100%;
height: 143rpx;
.collage-img {
left: 0;
bottom: 0;
width: 100%;
height: 156rpx;
}
.collage-count {
right: 12rpx;
bottom: 30rpx;
}
.collage-content {
top: 0;
width: 300rpx;
height: 140rpx;
.collage-num {
min-width: 76rpx;
height: 28rpx;
background: #FFFB00;
}
}
}
.price,
.icon-share {
font-size: 42rpx;
}
.collage-item {
.avatar {
width: 68rpx;
height: 68rpx;
}
}
.count-list {
.count-item {
width: 249rpx;
.ellipsis {
max-width: 220rpx;
}
}
.line {
width: 1rpx;
height: 58rpx;
background: #CCCCCC;
opacity: 0.4;
}
}
.map-info {
map {
width: 100%;
height: 450rpx;
}
.farmer-title {
z-index: 9;
left: 15rpx;
bottom: 10rpx;
height: 50rpx;
background: rgba(0, 0, 0, 0.5);
.iconfont {
font-size: 24rpx;
}
}
}
.order-count-info {
.count-item {
width: 33.33%;
}
.machine-item {
width: 50%;
.num {
width: 50rpx;
}
.text {
width: 150rpx;
padding-right: 10rpx;
}
}
}
.footer-btn {
bottom: 0;
.footer-item {
height: 114rpx;
.iconfont {
font-size: 42rpx;
}
}
.order-btn {
width: 220rpx;
height: 78rpx;
transform: rotateZ(360deg);
}
.order-btn.md {
width: 444rpx;
}
}
.show-collage-share {
width: 640rpx;
.user-list {
.more-btn {
width: 92rpx;
height: 92rpx;
background: #F8F8F8;
border: 1px solid #DBDBDB;
.icon-add {
color: #D8D8D7
}
}
}
.share-btn {
width: 420rpx;
height: 94rpx;
color: #fff;
border-radius: 100rpx;
}
.icon-close {
font-size: 80rpx;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,709 @@
<template>
<view class="claim-order" v-if="orderInfo.claim_info.id">
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="确认订单">
</uni-nav-bar>
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png">
</image>
<view class="space-lg"></view>
<view class="fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24">
<view class="f-title c-title pb-lg b-1px-b">{{orderInfo.farmer_info.title}}</view>
<view class="flex-warp pt-lg pb-lg">
<image mode="aspectFill" lazy-load class="avatar lg radius-10" :src="orderInfo.claim_info.cover">
</image>
<view class="flex-1 ml-lg">
<view class="f-paragraph max-520 ellipsis">{{orderInfo.claim_info.title}}</view>
<block v-if="options.type">
<view class="flex-y-center f-desc c-warning mt-sm">众筹价<view
class="flex-y-baseline f-caption ml-sm">
¥<view class="f-sm-title text-bold">
{{orderInfo.claim_info[orderType[options.type]].price}}
</view>
</view>
<view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{orderInfo.claim_info.price}}
</view>
</view>
<view class="flex-center mt-md">
<view class="collage-tag flex-center f-caption c-base" :style="{background:primaryColor}">
{{orderInfo.claim_info[orderType[options.type]].success_num}}人团
</view>
<view class="flex-1"></view>
</view>
</block>
<view class="flex-y-baseline f-paragraph c-warning mt-sm" v-else>¥{{orderInfo.claim_info.price}}
<view class="f-caption c-caption ml-sm">
/{{orderInfo.claim_info.unit}}</view>
</view>
</view>
</view>
<view class="flex-between pt-lg pb-lg b-1px-tb">
<view class="f-paragraph c-black">认养数量</view>
<view v-if="options.type">{{subForm.num}}</view>
<view class="add-remove-item flex-center" v-else>
<i @tap.stop="changeNum(-1,index)" class="iconfont icon-remove-square c-caption"></i>
<view class="number flex-center f-desc pl-sm pr-sm">{{subForm.num}}</view>
<i @tap.stop="changeNum(1,index)" class="iconfont icon-add-square"
:style="{color:primaryColor}"></i>
</view>
</view>
<view class="pt-lg pb-lg f-paragraph c-black">认养收获</view>
<view class="flex-center">
<image mode="aspectFill" lazy-load class="avatar sm radius-10"
:src="orderInfo.claim_info.harvest_cover"></image>
<view class="flex-1 ml-lg ellipsis">{{orderInfo.claim_info.harvest_text}}</view>
</view>
</view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
<view class="flex-between pd-lg">
<view class="flex-y-center f-sm-title c-black"><i class="iconfont icon-peisong mr-sm"
:style="{color:primaryColor}"></i>配送周期</view>
<view class="f-paragraph">{{orderInfo.claim_info.send_cycle}}</view>
</view>
</view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
<view class="flex-between pd-lg f-sm-title c-title b-1px-b">
<view class="text-bold">配送方式</view>
<view class="send-list flex-center radius" :style="{width:sendList.length==1?'90rpx':''}">
<view @tap.stop="toChangeItem('sendInd',index)" class="send-item flex-center f-paragraph radius"
:class="[{'c-base':sendInd == index}]" :style="{background:sendInd==index?primaryColor:''}"
v-for="(item,index) in sendList" :key="index">{{item.title}}</view>
</view>
</view>
<view @tap.stop="toChooseAddr" class="pd-lg flex-center"
v-if="sendList[sendInd].id == 1 || orderInfo.address.id">
<view class="flex-1">
<view class="flex-warp">
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i>
<view class="f-paragraph c-title flex-1" :class="[{'max-520':sendList[sendInd].id == 2}]">
{{sendList[sendInd].id == 1 ? `${orderInfo.farmer_info.address}` : orderInfo.address.id ? `${orderInfo.address.address} ${orderInfo.address.address_info}`:''}}
</view>
</view>
<view class="flex-y-baseline f-paragraph c-caption" style="margin:5rpx 0 0 38rpx;">
{{sendList[sendInd].id == 1 ? orderInfo.farmer_info.user_name : orderInfo.address.id ? orderInfo.address.user_name:'' }}
<view class="ml-lg">
{{sendList[sendInd].id == 1? orderInfo.farmer_info.mobile : orderInfo.address.id ? orderInfo.address.mobile : ''}}
</view>
</view>
</view>
<i class="iconfont"
:class="[{'icon-dingwei':sendList[sendInd].id == 1},{'icon-right':sendList[sendInd].id == 2}]"></i>
</view>
<block v-else>
<view class="space-lg"></view>
<view class="space-lg"></view>
<view @tap.stop="toChooseAddr" class="add-btn flex-center f-paragraph c-desc"><i
class="iconfont icon-add-circle-fill mr-sm"></i>添加地址
</view>
<view class="space-lg"></view>
<view class="space-lg"></view>
</block>
</view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="sendList[sendInd].id == 1">
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg b-1px-b">
<view class="flex-y-center">
<i class="iconfont icon-required c-warning"></i>
<view class="item-text">姓名</view>
</view>
<input v-model="subForm.user_name" type="text" class="flex-1 f-paragraph"
placeholder-class="c-placeholder" :placeholder="rule[0].errorMsg" />
</view>
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
<view class="flex-y-center">
<i class="iconfont icon-required c-warning"></i>
<view class="item-text">手机号</view>
</view>
<input v-model="subForm.mobile" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder"
:placeholder="rule[1].errorMsg" />
<button open-type="getPhoneNumber" @getphonenumber="toAuthPhone"
class="clear-btn auth-phone-btn flex-center" :style="{color:primaryColor}">立即授权</button>
</view>
</view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg b-1px-b">
<view class="flex-y-center">
<i class="iconfont icon-required c-warning"></i>
<view class="item-text">认养取名</view>
</view>
<input v-model="subForm.claim_name" type="text" class="flex-1 f-paragraph"
placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg" />
</view>
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
<view class="flex-y-center">
<i class="iconfont icon-required c-base"></i>
<view class="item-text">订单备注</view>
</view>
<input v-model="subForm.text" type="text" class="flex-1 f-paragraph" maxlength="100"
placeholder-class="c-placeholder" placeholder="请输入订单备注" />
</view>
</view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="!options.type">
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
<view class="item-text">卡券优惠</view>
<view
@tap.stop="$util.goUrl({url:`/mine/pages/coupon/use?claim_id=${options.id}&num=${subForm.num}&type=2`})"
class="flex-y-center">
<view class="flex-1 text-right">
{{ orderInfo.coupon_id ? `${orderInfo.coupon_discount}` : `${orderInfo.canUseCoupon}张可用` }}
</view>
<i class="iconfont icon-right"></i>
</view>
</view>
</view>
<view class="fill-base mt-md ml-md mr-md f-sm-title box-shadow radius-24">
<view @tap.stop="toChangeItem('payInd',index)"
class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg b-1px-b" v-for="(item,index) in payList"
:key="index">
<view class="pay-item flex-y-center"><i class="iconfont mr-md" :class="[item.icon]"
:style="{color:item.id==1?primaryColor:item.id==2?subColor:'#01AAF2'}"></i>
<view class="flex-y-baseline">{{item.title}}
<view class="f-paragraph c-caption ml-sm" v-if="item.id==2">余额{{userInfo.balance || 0}}
</view>
</view>
</view>
<i class="pay-icon iconfont c-caption"
:class="[{'icon-xuanze':payInd != index},{'icon-radio-fill':item.is_disabled || payInd == index}]"
:style="{color:payInd==index?primaryColor:''}"></i>
</view>
</view>
<view @tap.stop="toAgree" class="flex-warp f-paragraph mt-md pd-md"><i
class="agree-icon iconfont c-caption mr-sm"
:class="[{'icon-xuanze': !agree},{'icon-xuanze-fill': agree}]" style="margin-top: 3rpx;"
:style="{color:agree?primaryColor:''}"></i>
<view class="flex-y-center">购买代表您已同意<view @tap.stop="$util.goUrl({url:`/mine/pages/agreement?type=1`})"
:style="{color:primaryColor}">
{{agreement}}</view>
</view>
</view>
<view class="space-max-footer"></view>
<view class="footer-btn fill-base fix">
<view class="footer-item flex-between pl-lg pr-lg">
<view class="flex-y-baseline f-paragraph c-title">
合计<view class="f-sm-title c-warning text-bold">¥{{orderInfo.pay_price}}</view>
</view>
<!-- #ifdef APP-PLUS -->
<view @tap="toOrder" class="order-btn flex-center f-sm-title c-base text-bold radius-20"
:style="{background:primaryColor}">立即支付
</view>
<!-- #endif -->
<!-- #ifndef APP-PLUS -->
<auth :needAuth="userInfo && !userInfo.nickName" :must="true" type="userInfo" @go="toOrder">
<view class="order-btn flex-center f-sm-title c-base text-bold radius-20"
:style="{background:primaryColor}">立即支付
</view>
</auth>
<!-- #endif -->
</view>
<view class="space-safe"></view>
</view>
</view>
</template>
<script>
import {
mapState,
mapActions,
mapMutations
} from "vuex"
export default {
components: {},
data() {
return {
options: {},
scrollTop: 0,
orderType: {
1: 'collage_start_data',
2: 'collage_join_data'
},
// 1微信支付2余额支付3支付宝支付
payList: [{
id: 1,
title: '微信支付',
icon: 'icon-wechat-pay',
is_disabled: false
}
// #ifdef APP-PLUS
, {
id: 3,
title: '支付宝支付',
icon: 'icon-alipay',
is_disabled: false
}
// #endif
, {
id: 2,
title: '余额支付',
icon: 'icon-qianbao',
is_disabled: false
}
],
payInd: 0,
// #ifdef APP-PLUS
balanceInd: 2,
// #endif
// #ifndef APP-PLUS
balanceInd: 1,
// #endif
sendList: [],
sendInd: 0,
agreement: '',
agree: false,
orderInfo: {
address: {},
farmer_info: {},
claim_info: {},
},
subForm: {
num: 1,
send_type: 1,
address_id: '',
user_name: '',
mobile: '',
claim_name: '',
text: ''
},
rule: [{
name: "user_name",
checkType: "isNotNull",
errorMsg: "请输入姓名",
regType: 2
}, {
name: "mobile",
checkType: "isMobile",
errorMsg: "请输入手机号"
}, {
name: "claim_name",
checkType: "isNotNull",
errorMsg: "快给你认养的小动物取个名吧"
}],
}
},
computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo,
userInfo: state => state.user.userInfo,
}),
onLoad(options) {
let {
type = 0
} = options
options.type = type * 1
this.options = options
this.initIndex()
},
onPageScroll(e) {
this.scrollTop = e.scrollTop
},
methods: {
...mapActions(['getUserInfo', 'getAuthPhone']),
...mapMutations(['updateOrderItem']),
async initIndex(refresh = false) {
if (!refresh) {
let [, info] = await Promise.all([this.getUserInfo(), this.$api.home.aboutUsInfoType({
type: 1
})])
this.agreement = info.title
}
let {
id: claim_id,
type: order_type,
cid: collage_id
} = this.options
let {
phone
} = this.userInfo
let {
mobile = '',
num = 1
} = this.subForm
this.subForm.mobile = mobile || phone
let {
address = {}, coupon_id = 0
} = this.orderInfo
let {
id: address_id = 0
} = address
let param = {
claim_id,
coupon_id,
address_id,
num
}
// order_type 1发起众筹2参与众筹
if (order_type == 1) {
param.collage_start_id = collage_id
}
if (order_type == 2) {
param.collage_join_id = collage_id
}
let orderInfo = await this.$api.claim.claimPayOrderInfo(param)
if (!refresh) {
let {
is_self,
is_send
} = orderInfo.claim_info
let sendList = []
if (is_self) {
sendList.push({
id: 1,
title: '自提',
})
}
if (is_send) {
sendList.push({
id: 2,
title: '快递',
})
}
this.sendList = sendList
}
let {
balance
} = this.userInfo
let {
pay_price
} = orderInfo
let is_disabled = balance * 1 < pay_price * 1
let {
balanceInd
} = this
this.payList[balanceInd].is_disabled = is_disabled
if (pay_price * 1 == 0) {
this.payList[0].is_disabled = true
// #ifdef APP-PLUS
this.payList[1].is_disabled = true
// #endif
this.payInd = balanceInd
}
this.orderInfo = orderInfo
},
initRefresh() {
this.initIndex(true)
},
async changeNum(mod, index) {
let {
num: goods_num
} = this.subForm
let {
unit
} = this.orderInfo.claim_info
let num = goods_num + mod;
if (num < 1) {
this.$util.showToast({
title: `此动物最少购买1${unit}`
})
return;
}
this.subForm.num = num
this.initRefresh()
},
toChangeItem(key, index) {
if (key == 'payInd' && index === 2 && this.payList[index].is_disabled) return
this[key] = index
},
async toMap() {
let {
lat,
lng,
address
} = this.orderInfo.farmer_info
await this.$util.checkAuth({
type: 'userLocation'
})
await uni.getLocation({
type: 'gcj02',
})
await uni.openLocation({
latitude: lat * 1,
longitude: lng * 1,
name: address,
scale: 28
})
},
toChooseAddr() {
if (this.sendList[this.sendInd].id == 1) {
this.toMap()
return
}
this.$util.goUrl({
url: `/mine/pages/address/list?check=1`
})
},
// 授权手机号
async toAuthPhone(e) {
let phone = await this.getAuthPhone({
e,
})
if (!phone) return
this.$nextTick(() => {
this.subForm.mobile = phone
})
},
toAgree() {
this.agree = !this.agree
},
//表单验证
validate(param) {
let validate = new this.$util.Validate();
let arr = param.send_type == 1 ? ['user_name', 'mobile', 'claim_name'] : [
'claim_name'
]
this.rule.map(item => {
let {
name
} = item
if (!arr.includes(name)) return
validate.add(param[name], item);
})
let message = validate.start();
return message;
},
toOrder() {
let {
payList,
payInd,
sendList,
sendInd,
subForm,
agreement
} = this
let {
id: claim_id,
cid: collage_id,
type: order_type
} = this.options
let {
id: pay_model
} = payList[payInd]
let {
id: send_type
} = sendList[sendInd]
let {
address = {}, coupon_id = 0
} = this.orderInfo
let {
id: address_id = 0
} = address
if (!address_id && send_type == 2) {
this.$util.showToast({
title: `请选择收货地址`
})
return
}
let param = Object.assign({}, subForm, {
claim_id,
address_id,
coupon_id,
pay_model,
send_type
});
// order_type 1发起众筹2参与众筹
if (order_type == 1) {
param.collage_start_id = collage_id
}
if (order_type == 2) {
param.collage_join_id = collage_id
}
let msg = this.validate(param);
if (msg) {
this.$util.showToast({
title: msg
});
return;
}
if (!this.agree) {
this.$util.showToast({
title: `请勾选${agreement}`
})
return
}
this.toPay(param)
},
async toPay(param) {
// #ifdef MP-WEIXIN
let that = this
let {
tmp_list = []
} = that.orderInfo
let tmplIds = []
tmp_list.map(item => {
tmplIds.push(item.tmpl_id)
})
if (tmplIds && tmplIds.length > 0) {
uni.requestSubscribeMessage({
tmplIds,
complete(res) {
that.toConfirmPay(param)
console.log(res, "complete requestSubscribeMessage");
}
})
} else {
that.toConfirmPay(param)
}
// #endif
// #ifndef MP-WEIXIN
this.toConfirmPay(param)
// #endif
},
async toConfirmPay(param) {
if (this.lockTap) return
this.lockTap = true
this.$util.showLoading()
try {
let {
pay_list
} = await this.$api.claim.claimPayOrder(param)
this.$util.hideAll()
if (pay_list) {
if (param.pay_model == 3) {
pay_list = {
orderInfo: pay_list,
provider: 'alipay'
}
}
try {
await this.$util.pay(pay_list)
this.$util.showToast({
title: `支付成功`
})
this.updateOrderItem({
key: 'haveOperItem',
val: true
})
setTimeout(() => {
this.$util.back()
this.$util.goUrl({
url: '/mine/pages/pay-result?type=claim',
openType: 'redirectTo'
})
}, 1000)
this.lockTap = false
return
} catch (e) {
this.$util.showToast({
title: `支付失败`
})
setTimeout(() => {
this.$util.back()
this.$util.goUrl({
url: `/claim/pages/order/list`,
openType: 'redirectTo'
})
}, 1000)
this.lockTap = false
return
}
}
this.$util.showToast({
title: `支付成功`
})
this.updateOrderItem({
key: 'haveOperItem',
val: true
})
setTimeout(() => {
this.$util.back()
this.$util.goUrl({
url: '/mine/pages/pay-result?type=claim',
openType: 'redirectTo'
})
}, 1000)
} catch (e) {
setTimeout(() => {
this.lockTap = false
this.$util.hideAll()
}, 2000)
}
}
}
}
</script>
<style lang="scss">
.claim-order {
.collage-tag {
height: 36rpx;
padding: 0 10rpx;
}
.send-list {
width: 180rpx;
height: 52rpx;
border: 1rpx solid #CCCCCC;
transform: rotateZ(360deg);
overflow: hidden;
.send-item {
width: 90rpx;
height: 50rpx;
}
}
.add-btn {
width: 296rpx;
height: 72rpx;
background: #F6F6F6;
border-radius: 36rpx;
margin: 0 auto;
}
.pay-item {
.iconfont {
font-size: 50rpx;
}
}
.pay-icon {
font-size: 40rpx;
}
.icon-right {
font-size: 28rpx;
}
.icon-peisong,
.agree-icon {
font-size: 36rpx;
}
.item-text {
width: 150rpx;
}
.auth-phone-btn {
width: 106rpx;
height: 36rpx;
line-height: 36rpx;
margin-left: 15rpx;
font-size: 20rpx;
background: #F0F4EC;
border-radius: 10rpx;
}
.footer-btn {
bottom: 0;
.footer-item {
height: 114rpx;
.order-btn {
width: 332rpx;
height: 88rpx;
}
}
}
}
</style>

View File

@@ -1,28 +1,25 @@
<template> <template>
<view class="claim-order" v-if="orderInfo.claim_info.id"> <view class="claim-order" v-if="orderInfo.claim_info.id">
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff" <uni-nav-bar :fixed="true" :shadow="false" title="确认订单" leftIcon="icon-left"></uni-nav-bar>
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="确认订单">
</uni-nav-bar>
<view :style="{ height: `${configInfo.navBarHeight}px` }"></view> <view :style="{ height: `${configInfo.navBarHeight}px` }"></view>
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png"> <image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png"></image>
</image>
<view class="space-lg"></view> <view class="space-lg"></view>
<view class="fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24"> <view class="fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24">
<view class="f-title c-title pb-lg b-1px-b">{{ orderInfo.farmer_info.title }}</view> <view class="f-title c-title pb-lg b-1px-b">{{ orderInfo.farmer_info.title }}</view>
<view class="flex-warp pt-lg pb-lg"> <view class="flex-warp pt-lg pb-lg">
<image mode="aspectFill" lazy-load class="avatar lg radius-10" :src="orderInfo.claim_info.cover"> <image mode="aspectFill" lazy-load class="avatar lg radius-10" :src="orderInfo.claim_info.cover"></image>
</image>
<view class="flex-1 ml-lg"> <view class="flex-1 ml-lg">
<view class="f-paragraph max-520 ellipsis">{{ orderInfo.claim_info.title }}</view> <view class="f-paragraph max-520 ellipsis">{{ orderInfo.claim_info.title }}</view>
<block v-if="options.type"> <block v-if="options.type">
<view class="flex-y-center f-desc c-warning mt-sm">众筹价<view <view class="flex-y-center f-desc c-warning mt-sm">
class="flex-y-baseline f-caption ml-sm"> 众筹价
¥<view class="f-sm-title text-bold"> <view class="flex-y-baseline f-caption ml-sm">
¥
<view class="f-sm-title text-bold">
{{ orderInfo.claim_info[orderType[options.type]].price }} {{ orderInfo.claim_info[orderType[options.type]].price }}
</view> </view>
</view> </view>
<view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{orderInfo.claim_info.price}} <view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{ orderInfo.claim_info.price }}</view>
</view>
</view> </view>
<view class="flex-center mt-md"> <view class="flex-center mt-md">
<view class="collage-tag flex-center f-caption c-base" :style="{ background: primaryColor }"> <view class="collage-tag flex-center f-caption c-base" :style="{ background: primaryColor }">
@@ -31,9 +28,9 @@
<view class="flex-1"></view> <view class="flex-1"></view>
</view> </view>
</block> </block>
<view class="flex-y-baseline f-paragraph c-warning mt-sm" v-else>¥{{orderInfo.claim_info.price}} <view class="flex-y-baseline f-paragraph c-warning mt-sm" v-else>
<view class="f-caption c-caption ml-sm"> ¥{{ orderInfo.claim_info.price }}
/{{orderInfo.claim_info.unit}}</view> <view class="f-caption c-caption ml-sm">/{{ orderInfo.claim_info.unit }}</view>
</view> </view>
</view> </view>
</view> </view>
@@ -44,22 +41,22 @@
<view class="add-remove-item flex-center" v-else> <view class="add-remove-item flex-center" v-else>
<i @tap.stop="changeNum(-1, index)" class="iconfont icon-remove-square c-caption"></i> <i @tap.stop="changeNum(-1, index)" class="iconfont icon-remove-square c-caption"></i>
<view class="number flex-center f-desc pl-sm pr-sm">{{ subForm.num }}</view> <view class="number flex-center f-desc pl-sm pr-sm">{{ subForm.num }}</view>
<i @tap.stop="changeNum(1,index)" class="iconfont icon-add-square" <i @tap.stop="changeNum(1, index)" class="iconfont icon-add-square" :style="{ color: primaryColor }"></i>
:style="{color:primaryColor}"></i>
</view> </view>
</view> </view>
<view class="pt-lg pb-lg f-paragraph c-black">认养收获</view> <view class="pt-lg pb-lg f-paragraph c-black">认养收获</view>
<view class="flex-center"> <view class="flex-center">
<image mode="aspectFill" lazy-load class="avatar sm radius-10" <image mode="aspectFill" lazy-load class="avatar sm radius-10" :src="orderInfo.claim_info.harvest_cover"></image>
:src="orderInfo.claim_info.harvest_cover"></image>
<view class="flex-1 ml-lg ellipsis">{{ orderInfo.claim_info.harvest_text }}</view> <view class="flex-1 ml-lg ellipsis">{{ orderInfo.claim_info.harvest_text }}</view>
</view> </view>
</view> </view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24"> <view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
<view class="flex-between pd-lg"> <view class="flex-between pd-lg">
<view class="flex-y-center f-sm-title c-black"><i class="iconfont icon-peisong mr-sm" <view class="flex-y-center f-sm-title c-black">
:style="{color:primaryColor}"></i>配送周期</view> <i class="iconfont icon-peisong mr-sm" :style="{ color: primaryColor }"></i>
配送周期
</view>
<view class="f-paragraph">{{ orderInfo.claim_info.send_cycle }}</view> <view class="f-paragraph">{{ orderInfo.claim_info.send_cycle }}</view>
</view> </view>
</view> </view>
@@ -67,35 +64,47 @@
<view class="flex-between pd-lg f-sm-title c-title b-1px-b"> <view class="flex-between pd-lg f-sm-title c-title b-1px-b">
<view class="text-bold">配送方式</view> <view class="text-bold">配送方式</view>
<view class="send-list flex-center radius" :style="{ width: sendList.length == 1 ? '90rpx' : '' }"> <view class="send-list flex-center radius" :style="{ width: sendList.length == 1 ? '90rpx' : '' }">
<view @tap.stop="toChangeItem('sendInd',index)" class="send-item flex-center f-paragraph radius" <view
:class="[{'c-base':sendInd == index}]" :style="{background:sendInd==index?primaryColor:''}" @tap.stop="toChangeItem('sendInd', index)"
v-for="(item,index) in sendList" :key="index">{{item.title}}</view> class="send-item flex-center f-paragraph radius"
:class="[{ 'c-base': sendInd == index }]"
:style="{ background: sendInd == index ? primaryColor : '' }"
v-for="(item, index) in sendList"
:key="index"
>
{{ item.title }}
</view> </view>
</view> </view>
<view @tap.stop="toChooseAddr" class="pd-lg flex-center" </view>
v-if="sendList[sendInd].id == 1 || orderInfo.address.id"> <view @tap.stop="toChooseAddr" class="pd-lg flex-center" v-if="sendList[sendInd].id == 1 || orderInfo.address.id">
<view class="flex-1"> <view class="flex-1">
<view class="flex-warp"> <view class="flex-warp">
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i> <i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx; margin-top: 6rpx"></i>
<view class="f-paragraph c-title flex-1" :class="[{ 'max-520': sendList[sendInd].id == 2 }]"> <view class="f-paragraph c-title flex-1" :class="[{ 'max-520': sendList[sendInd].id == 2 }]">
{{sendList[sendInd].id == 1 ? `${orderInfo.farmer_info.address}` : orderInfo.address.id ? `${orderInfo.address.address} ${orderInfo.address.address_info}`:''}} {{
sendList[sendInd].id == 1
? `${orderInfo.farmer_info.address}`
: orderInfo.address.id
? `${orderInfo.address.address} ${orderInfo.address.address_info}`
: ''
}}
</view> </view>
</view> </view>
<view class="flex-y-baseline f-paragraph c-caption" style="margin:5rpx 0 0 38rpx;"> <view class="flex-y-baseline f-paragraph c-caption" style="margin: 5rpx 0 0 38rpx">
{{ sendList[sendInd].id == 1 ? orderInfo.farmer_info.user_name : orderInfo.address.id ? orderInfo.address.user_name : '' }} {{ sendList[sendInd].id == 1 ? orderInfo.farmer_info.user_name : orderInfo.address.id ? orderInfo.address.user_name : '' }}
<view class="ml-lg"> <view class="ml-lg">
{{ sendList[sendInd].id == 1 ? orderInfo.farmer_info.mobile : orderInfo.address.id ? orderInfo.address.mobile : '' }} {{ sendList[sendInd].id == 1 ? orderInfo.farmer_info.mobile : orderInfo.address.id ? orderInfo.address.mobile : '' }}
</view> </view>
</view> </view>
</view> </view>
<i class="iconfont" <i class="iconfont" :class="[{ 'icon-dingwei': sendList[sendInd].id == 1 }, { 'icon-right': sendList[sendInd].id == 2 }]"></i>
:class="[{'icon-dingwei':sendList[sendInd].id == 1},{'icon-right':sendList[sendInd].id == 2}]"></i>
</view> </view>
<block v-else> <block v-else>
<view class="space-lg"></view> <view class="space-lg"></view>
<view class="space-lg"></view> <view class="space-lg"></view>
<view @tap.stop="toChooseAddr" class="add-btn flex-center f-paragraph c-desc"><i <view @tap.stop="toChooseAddr" class="add-btn flex-center f-paragraph c-desc">
class="iconfont icon-add-circle-fill mr-sm"></i>添加地址 <i class="iconfont icon-add-circle-fill mr-sm"></i>
添加地址
</view> </view>
<view class="space-lg"></view> <view class="space-lg"></view>
<view class="space-lg"></view> <view class="space-lg"></view>
@@ -108,18 +117,15 @@
<i class="iconfont icon-required c-warning"></i> <i class="iconfont icon-required c-warning"></i>
<view class="item-text">姓名</view> <view class="item-text">姓名</view>
</view> </view>
<input v-model="subForm.user_name" type="text" class="flex-1 f-paragraph" <input v-model="subForm.user_name" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" :placeholder="rule[0].errorMsg" />
placeholder-class="c-placeholder" :placeholder="rule[0].errorMsg" />
</view> </view>
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg"> <view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
<view class="flex-y-center"> <view class="flex-y-center">
<i class="iconfont icon-required c-warning"></i> <i class="iconfont icon-required c-warning"></i>
<view class="item-text">手机号</view> <view class="item-text">手机号</view>
</view> </view>
<input v-model="subForm.mobile" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" <input v-model="subForm.mobile" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" :placeholder="rule[1].errorMsg" />
:placeholder="rule[1].errorMsg" /> <button open-type="getPhoneNumber" @getphonenumber="toAuthPhone" class="clear-btn auth-phone-btn flex-center" :style="{ color: primaryColor }">立即授权</button>
<button open-type="getPhoneNumber" @getphonenumber="toAuthPhone"
class="clear-btn auth-phone-btn flex-center" :style="{color:primaryColor}">立即授权</button>
</view> </view>
</view> </view>
@@ -129,25 +135,21 @@
<i class="iconfont icon-required c-warning"></i> <i class="iconfont icon-required c-warning"></i>
<view class="item-text">认养取名</view> <view class="item-text">认养取名</view>
</view> </view>
<input v-model="subForm.claim_name" type="text" class="flex-1 f-paragraph" <input v-model="subForm.claim_name" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg" />
placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg" />
</view> </view>
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg"> <view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
<view class="flex-y-center"> <view class="flex-y-center">
<i class="iconfont icon-required c-base"></i> <i class="iconfont icon-required c-base"></i>
<view class="item-text">订单备注</view> <view class="item-text">订单备注</view>
</view> </view>
<input v-model="subForm.text" type="text" class="flex-1 f-paragraph" maxlength="100" <input v-model="subForm.text" type="text" class="flex-1 f-paragraph" maxlength="100" placeholder-class="c-placeholder" placeholder="请输入订单备注" />
placeholder-class="c-placeholder" placeholder="请输入订单备注" />
</view> </view>
</view> </view>
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="!options.type"> <view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="!options.type">
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg"> <view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
<view class="item-text">卡券优惠</view> <view class="item-text">卡券优惠</view>
<view <view @tap.stop="$util.goUrl({ url: `/mine/pages/coupon/use?claim_id=${options.id}&num=${subForm.num}&type=2` })" class="flex-y-center">
@tap.stop="$util.goUrl({url:`/mine/pages/coupon/use?claim_id=${options.id}&num=${subForm.num}&type=2`})"
class="flex-y-center">
<view class="flex-1 text-right"> <view class="flex-1 text-right">
{{ orderInfo.coupon_id ? `${orderInfo.coupon_discount}` : `${orderInfo.canUseCoupon}张可用` }} {{ orderInfo.coupon_id ? `${orderInfo.coupon_discount}` : `${orderInfo.canUseCoupon}张可用` }}
</view> </view>
@@ -157,28 +159,31 @@
</view> </view>
<view class="fill-base mt-md ml-md mr-md f-sm-title box-shadow radius-24"> <view class="fill-base mt-md ml-md mr-md f-sm-title box-shadow radius-24">
<view @tap.stop="toChangeItem('payInd',index)" <view @tap.stop="toChangeItem('payInd', index)" class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg b-1px-b" v-for="(item, index) in payList" :key="index">
class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg b-1px-b" v-for="(item,index) in payList" <view class="pay-item flex-y-center">
:key="index"> <i class="iconfont mr-md" :class="[item.icon]" :style="{ color: item.id == 1 ? primaryColor : item.id == 2 ? subColor : '#01AAF2' }"></i>
<view class="pay-item flex-y-center"><i class="iconfont mr-md" :class="[item.icon]" <view class="flex-y-baseline">
:style="{color:item.id==1?primaryColor:item.id==2?subColor:'#01AAF2'}"></i> {{ item.title }}
<view class="flex-y-baseline">{{item.title}} <view class="f-paragraph c-caption ml-sm" v-if="item.id == 2">余额{{ userInfo.balance || 0 }}</view>
<view class="f-paragraph c-caption ml-sm" v-if="item.id==2">余额{{userInfo.balance || 0}}
</view> </view>
</view> </view>
</view> <i
<i class="pay-icon iconfont c-caption" class="pay-icon iconfont c-caption"
:class="[{ 'icon-xuanze': payInd != index }, { 'icon-radio-fill': item.is_disabled || payInd == index }]" :class="[{ 'icon-xuanze': payInd != index }, { 'icon-radio-fill': item.is_disabled || payInd == index }]"
:style="{color:payInd==index?primaryColor:''}"></i> :style="{ color: payInd == index ? primaryColor : '' }"
></i>
</view> </view>
</view> </view>
<view @tap.stop="toAgree" class="flex-warp f-paragraph mt-md pd-md"><i <view @tap.stop="toAgree" class="flex-warp f-paragraph mt-md pd-md">
<i
class="agree-icon iconfont c-caption mr-sm" class="agree-icon iconfont c-caption mr-sm"
:class="[{'icon-xuanze': !agree},{'icon-xuanze-fill': agree}]" style="margin-top: 3rpx;" :class="[{ 'icon-xuanze': !agree }, { 'icon-xuanze-fill': agree }]"
:style="{color:agree?primaryColor:''}"></i> style="margin-top: 3rpx"
<view class="flex-y-center">购买代表您已同意<view @tap.stop="$util.goUrl({url:`/mine/pages/agreement?type=1`})" :style="{ color: agree ? primaryColor : '' }"
:style="{color:primaryColor}"> ></i>
{{agreement}}</view> <view class="flex-y-center">
购买代表您已同意
<view @tap.stop="$util.goUrl({ url: `/mine/pages/agreement?type=1` })" :style="{ color: primaryColor }">{{ agreement }}</view>
</view> </view>
</view> </view>
@@ -186,33 +191,25 @@
<view class="footer-btn fill-base fix"> <view class="footer-btn fill-base fix">
<view class="footer-item flex-between pl-lg pr-lg"> <view class="footer-item flex-between pl-lg pr-lg">
<view class="flex-y-baseline f-paragraph c-title"> <view class="flex-y-baseline f-paragraph c-title">
合计<view class="f-sm-title c-warning text-bold">¥{{orderInfo.pay_price}}</view> 合计
<view class="f-sm-title c-warning text-bold">¥{{ orderInfo.pay_price }}</view>
</view> </view>
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<view @tap="toOrder" class="order-btn flex-center f-sm-title c-base text-bold radius-20" <view @tap="toOrder" class="order-btn flex-center f-sm-title c-base text-bold radius-20" :style="{ background: primaryColor }">立即支付</view>
:style="{background:primaryColor}">立即支付
</view>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef APP-PLUS --> <!-- #ifndef APP-PLUS -->
<auth :needAuth="userInfo && !userInfo.nickName" :must="true" type="userInfo" @go="toOrder"> <auth :needAuth="userInfo && !userInfo.nickName" :must="true" type="userInfo" @go="toOrder">
<view class="order-btn flex-center f-sm-title c-base text-bold radius-20" <view class="order-btn flex-center f-sm-title c-base text-bold radius-20" :style="{ background: primaryColor }">立即支付</view>
:style="{background:primaryColor}">立即支付
</view>
</auth> </auth>
<!-- #endif --> <!-- #endif -->
</view> </view>
<view class="space-safe"></view> <view class="space-safe"></view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { import { mapState, mapActions, mapMutations } from 'vuex';
mapState,
mapActions,
mapMutations
} from "vuex"
export default { export default {
components: {}, components: {},
data() { data() {
@@ -224,21 +221,22 @@
2: 'collage_join_data' 2: 'collage_join_data'
}, },
// 1微信支付2余额支付3支付宝支付 // 1微信支付2余额支付3支付宝支付
payList: [{ payList: [
{
id: 1, id: 1,
title: '微信支付', title: '微信支付',
icon: 'icon-wechat-pay', icon: 'icon-wechat-pay',
is_disabled: false is_disabled: false
} },
// #ifdef APP-PLUS // #ifdef APP-PLUS
, { {
id: 3, id: 3,
title: '支付宝支付', title: '支付宝支付',
icon: 'icon-alipay', icon: 'icon-alipay',
is_disabled: false is_disabled: false
} },
// #endif // #endif
, { {
id: 2, id: 2,
title: '余额支付', title: '余额支付',
icon: 'icon-qianbao', icon: 'icon-qianbao',
@@ -259,7 +257,7 @@
orderInfo: { orderInfo: {
address: {}, address: {},
farmer_info: {}, farmer_info: {},
claim_info: {}, claim_info: {}
}, },
subForm: { subForm: {
num: 1, num: 1,
@@ -270,235 +268,187 @@
claim_name: '', claim_name: '',
text: '' text: ''
}, },
rule: [{ rule: [
name: "user_name", {
checkType: "isNotNull", name: 'user_name',
errorMsg: "请输入姓名", checkType: 'isNotNull',
errorMsg: '请输入姓名',
regType: 2 regType: 2
}, { },
name: "mobile", {
checkType: "isMobile", name: 'mobile',
errorMsg: "请输入手机号" checkType: 'isMobile',
}, { errorMsg: '请输入手机号'
name: "claim_name", },
checkType: "isNotNull", {
errorMsg: "快给你认养的小动物取个名吧" name: 'claim_name',
}], checkType: 'isNotNull',
errorMsg: '快给你认养的小动物取个名吧'
} }
]
};
}, },
computed: mapState({ computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor, primaryColor: (state) => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor, subColor: (state) => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo, configInfo: (state) => state.config.configInfo,
userInfo: state => state.user.userInfo, userInfo: (state) => state.user.userInfo
}), }),
onLoad(options) { onLoad(options) {
let { let { type = 0 } = options;
type = 0 options.type = type * 1;
} = options this.options = options;
options.type = type * 1 this.initIndex();
this.options = options
this.initIndex()
}, },
onPageScroll(e) { onPageScroll(e) {
this.scrollTop = e.scrollTop this.scrollTop = e.scrollTop;
}, },
methods: { methods: {
...mapActions(['getUserInfo', 'getAuthPhone']), ...mapActions(['getUserInfo', 'getAuthPhone']),
...mapMutations(['updateOrderItem']), ...mapMutations(['updateOrderItem']),
async initIndex(refresh = false) { async initIndex(refresh = false) {
if (!refresh) { if (!refresh) {
let [, info] = await Promise.all([this.getUserInfo(), this.$api.home.aboutUsInfoType({ let [, info] = await Promise.all([
this.getUserInfo(),
this.$api.home.aboutUsInfoType({
type: 1 type: 1
})]) })
this.agreement = info.title ]);
this.agreement = info.title;
} }
let { let { id: claim_id, type: order_type, cid: collage_id } = this.options;
id: claim_id, let { phone } = this.userInfo;
type: order_type, let { mobile = '', num = 1 } = this.subForm;
cid: collage_id this.subForm.mobile = mobile || phone;
} = this.options let { address = {}, coupon_id = 0 } = this.orderInfo;
let { let { id: address_id = 0 } = address;
phone
} = this.userInfo
let {
mobile = '',
num = 1
} = this.subForm
this.subForm.mobile = mobile || phone
let {
address = {}, coupon_id = 0
} = this.orderInfo
let {
id: address_id = 0
} = address
let param = { let param = {
claim_id, claim_id,
coupon_id, coupon_id,
address_id, address_id,
num num
} };
// order_type 1发起众筹2参与众筹 // order_type 1发起众筹2参与众筹
if (order_type == 1) { if (order_type == 1) {
param.collage_start_id = collage_id param.collage_start_id = collage_id;
} }
if (order_type == 2) { if (order_type == 2) {
param.collage_join_id = collage_id param.collage_join_id = collage_id;
} }
let orderInfo = await this.$api.claim.claimPayOrderInfo(param) let orderInfo = await this.$api.claim.claimPayOrderInfo(param);
if (!refresh) { if (!refresh) {
let { let { is_self, is_send } = orderInfo.claim_info;
is_self, let sendList = [];
is_send
} = orderInfo.claim_info
let sendList = []
if (is_self) { if (is_self) {
sendList.push({ sendList.push({
id: 1, id: 1,
title: '自提', title: '自提'
}) });
} }
if (is_send) { if (is_send) {
sendList.push({ sendList.push({
id: 2, id: 2,
title: '快递', title: '快递'
}) });
} }
this.sendList = sendList this.sendList = sendList;
} }
let { let { balance } = this.userInfo;
balance let { pay_price } = orderInfo;
} = this.userInfo let is_disabled = balance * 1 < pay_price * 1;
let { let { balanceInd } = this;
pay_price this.payList[balanceInd].is_disabled = is_disabled;
} = orderInfo
let is_disabled = balance * 1 < pay_price * 1
let {
balanceInd
} = this
this.payList[balanceInd].is_disabled = is_disabled
if (pay_price * 1 == 0) { if (pay_price * 1 == 0) {
this.payList[0].is_disabled = true this.payList[0].is_disabled = true;
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.payList[1].is_disabled = true this.payList[1].is_disabled = true;
// #endif // #endif
this.payInd = balanceInd this.payInd = balanceInd;
} }
this.orderInfo = orderInfo this.orderInfo = orderInfo;
}, },
initRefresh() { initRefresh() {
this.initIndex(true) this.initIndex(true);
}, },
async changeNum(mod, index) { async changeNum(mod, index) {
let { let { num: goods_num } = this.subForm;
num: goods_num let { unit } = this.orderInfo.claim_info;
} = this.subForm
let {
unit
} = this.orderInfo.claim_info
let num = goods_num + mod; let num = goods_num + mod;
if (num < 1) { if (num < 1) {
this.$util.showToast({ this.$util.showToast({
title: `此动物最少购买1${unit}` title: `此动物最少购买1${unit}`
}) });
return; return;
} }
this.subForm.num = num this.subForm.num = num;
this.initRefresh() this.initRefresh();
}, },
toChangeItem(key, index) { toChangeItem(key, index) {
if (key == 'payInd' && index === 2 && this.payList[index].is_disabled) return if (key == 'payInd' && index === 2 && this.payList[index].is_disabled) return;
this[key] = index this[key] = index;
}, },
async toMap() { async toMap() {
let { let { lat, lng, address } = this.orderInfo.farmer_info;
lat,
lng,
address
} = this.orderInfo.farmer_info
await this.$util.checkAuth({ await this.$util.checkAuth({
type: 'userLocation' type: 'userLocation'
}) });
await uni.getLocation({ await uni.getLocation({
type: 'gcj02', type: 'gcj02'
}) });
await uni.openLocation({ await uni.openLocation({
latitude: lat * 1, latitude: lat * 1,
longitude: lng * 1, longitude: lng * 1,
name: address, name: address,
scale: 28 scale: 28
}) });
}, },
toChooseAddr() { toChooseAddr() {
if (this.sendList[this.sendInd].id == 1) { if (this.sendList[this.sendInd].id == 1) {
this.toMap() this.toMap();
return return;
} }
this.$util.goUrl({ this.$util.goUrl({
url: `/mine/pages/address/list?check=1` url: `/mine/pages/address/list?check=1`
}) });
}, },
// 授权手机号 // 授权手机号
async toAuthPhone(e) { async toAuthPhone(e) {
let phone = await this.getAuthPhone({ let phone = await this.getAuthPhone({
e, e
}) });
if (!phone) return if (!phone) return;
this.$nextTick(() => { this.$nextTick(() => {
this.subForm.mobile = phone this.subForm.mobile = phone;
}) });
}, },
toAgree() { toAgree() {
this.agree = !this.agree this.agree = !this.agree;
}, },
//表单验证 //表单验证
validate(param) { validate(param) {
let validate = new this.$util.Validate(); let validate = new this.$util.Validate();
let arr = param.send_type == 1 ? ['user_name', 'mobile', 'claim_name'] : [ let arr = param.send_type == 1 ? ['user_name', 'mobile', 'claim_name'] : ['claim_name'];
'claim_name' this.rule.map((item) => {
] let { name } = item;
this.rule.map(item => { if (!arr.includes(name)) return;
let {
name
} = item
if (!arr.includes(name)) return
validate.add(param[name], item); validate.add(param[name], item);
}) });
let message = validate.start(); let message = validate.start();
return message; return message;
}, },
toOrder() { toOrder() {
let { let { payList, payInd, sendList, sendInd, subForm, agreement } = this;
payList, let { id: claim_id, cid: collage_id, type: order_type } = this.options;
payInd, let { id: pay_model } = payList[payInd];
sendList, let { id: send_type } = sendList[sendInd];
sendInd, let { address = {}, coupon_id = 0 } = this.orderInfo;
subForm, let { id: address_id = 0 } = address;
agreement
} = this
let {
id: claim_id,
cid: collage_id,
type: order_type
} = this.options
let {
id: pay_model
} = payList[payInd]
let {
id: send_type
} = sendList[sendInd]
let {
address = {}, coupon_id = 0
} = this.orderInfo
let {
id: address_id = 0
} = address
if (!address_id && send_type == 2) { if (!address_id && send_type == 2) {
this.$util.showToast({ this.$util.showToast({
title: `请选择收货地址` title: `请选择收货地址`
}) });
return return;
} }
let param = Object.assign({}, subForm, { let param = Object.assign({}, subForm, {
claim_id, claim_id,
@@ -510,10 +460,10 @@
// order_type 1发起众筹2参与众筹 // order_type 1发起众筹2参与众筹
if (order_type == 1) { if (order_type == 1) {
param.collage_start_id = collage_id param.collage_start_id = collage_id;
} }
if (order_type == 2) { if (order_type == 2) {
param.collage_join_id = collage_id param.collage_join_id = collage_id;
} }
let msg = this.validate(param); let msg = this.validate(param);
if (msg) { if (msg) {
@@ -525,115 +475,109 @@
if (!this.agree) { if (!this.agree) {
this.$util.showToast({ this.$util.showToast({
title: `请勾选${agreement}` title: `请勾选${agreement}`
}) });
return return;
} }
this.toPay(param) this.toPay(param);
}, },
async toPay(param) { async toPay(param) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
let that = this let that = this;
let { let { tmp_list = [] } = that.orderInfo;
tmp_list = [] let tmplIds = [];
} = that.orderInfo tmp_list.map((item) => {
let tmplIds = [] tmplIds.push(item.tmpl_id);
tmp_list.map(item => { });
tmplIds.push(item.tmpl_id)
})
if (tmplIds && tmplIds.length > 0) { if (tmplIds && tmplIds.length > 0) {
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds, tmplIds,
complete(res) { complete(res) {
that.toConfirmPay(param) that.toConfirmPay(param);
console.log(res, "complete requestSubscribeMessage"); console.log(res, 'complete requestSubscribeMessage');
} }
}) });
} else { } else {
that.toConfirmPay(param) that.toConfirmPay(param);
} }
// #endif // #endif
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
this.toConfirmPay(param) this.toConfirmPay(param);
// #endif // #endif
}, },
async toConfirmPay(param) { async toConfirmPay(param) {
if (this.lockTap) return if (this.lockTap) return;
this.lockTap = true this.lockTap = true;
this.$util.showLoading() this.$util.showLoading();
try { try {
let { let { pay_list } = await this.$api.claim.claimPayOrder(param);
pay_list this.$util.hideAll();
} = await this.$api.claim.claimPayOrder(param)
this.$util.hideAll()
if (pay_list) { if (pay_list) {
if (param.pay_model == 3) { if (param.pay_model == 3) {
pay_list = { pay_list = {
orderInfo: pay_list, orderInfo: pay_list,
provider: 'alipay' provider: 'alipay'
} };
} }
try { try {
await this.$util.pay(pay_list) await this.$util.pay(pay_list);
this.$util.showToast({ this.$util.showToast({
title: `支付成功` title: `支付成功`
}) });
this.updateOrderItem({ this.updateOrderItem({
key: 'haveOperItem', key: 'haveOperItem',
val: true val: true
}) });
setTimeout(() => { setTimeout(() => {
this.$util.back() this.$util.back();
this.$util.goUrl({ this.$util.goUrl({
url: '/mine/pages/pay-result?type=claim', url: '/mine/pages/pay-result?type=claim',
openType: 'redirectTo' openType: 'redirectTo'
}) });
}, 1000) }, 1000);
this.lockTap = false this.lockTap = false;
return return;
} catch (e) { } catch (e) {
this.$util.showToast({ this.$util.showToast({
title: `支付失败` title: `支付失败`
}) });
setTimeout(() => { setTimeout(() => {
this.$util.back() this.$util.back();
this.$util.goUrl({ this.$util.goUrl({
url: `/claim/pages/order/list`, url: `/claim/pages/order/list`,
openType: 'redirectTo' openType: 'redirectTo'
}) });
}, 1000) }, 1000);
this.lockTap = false this.lockTap = false;
return return;
} }
} }
this.$util.showToast({ this.$util.showToast({
title: `支付成功` title: `支付成功`
}) });
this.updateOrderItem({ this.updateOrderItem({
key: 'haveOperItem', key: 'haveOperItem',
val: true val: true
}) });
setTimeout(() => { setTimeout(() => {
this.$util.back() this.$util.back();
this.$util.goUrl({ this.$util.goUrl({
url: '/mine/pages/pay-result?type=claim', url: '/mine/pages/pay-result?type=claim',
openType: 'redirectTo' openType: 'redirectTo'
}) });
}, 1000) }, 1000);
} catch (e) { } catch (e) {
setTimeout(() => { setTimeout(() => {
this.lockTap = false this.lockTap = false;
this.$util.hideAll() this.$util.hideAll();
}, 2000) }, 2000);
}
} }
} }
} }
};
</script> </script>
<style lang="scss"> <style lang="scss">
.claim-order { .claim-order {
.collage-tag { .collage-tag {
height: 36rpx; height: 36rpx;
padding: 0 10rpx; padding: 0 10rpx;
@@ -642,7 +586,7 @@
.send-list { .send-list {
width: 180rpx; width: 180rpx;
height: 52rpx; height: 52rpx;
border: 1rpx solid #CCCCCC; border: 1rpx solid #cccccc;
transform: rotateZ(360deg); transform: rotateZ(360deg);
overflow: hidden; overflow: hidden;
@@ -655,7 +599,7 @@
.add-btn { .add-btn {
width: 296rpx; width: 296rpx;
height: 72rpx; height: 72rpx;
background: #F6F6F6; background: #f6f6f6;
border-radius: 36rpx; border-radius: 36rpx;
margin: 0 auto; margin: 0 auto;
} }
@@ -689,7 +633,7 @@
line-height: 36rpx; line-height: 36rpx;
margin-left: 15rpx; margin-left: 15rpx;
font-size: 20rpx; font-size: 20rpx;
background: #F0F4EC; background: #f0f4ec;
border-radius: 10rpx; border-radius: 10rpx;
} }

View File

@@ -231,6 +231,7 @@
} }
.uni-navbar-btn-text .iconfont { .uni-navbar-btn-text .iconfont {
transform: rotate(180deg);
font-size: 40rpx; font-size: 40rpx;
} }

View File

@@ -29,7 +29,8 @@
"path": "pages/claim", "path": "pages/claim",
"style": { "style": {
"navigationBarTitleText": "认养", "navigationBarTitleText": "认养",
"enablePullDownRefresh": true "enablePullDownRefresh": true,
"navigationStyle": "custom"
} }
}, { }, {
"path": "pages/shop", "path": "pages/shop",
@@ -235,7 +236,9 @@
"path": "pages/detail", "path": "pages/detail",
"style": { "style": {
"navigationBarTitleText": "认养详情", "navigationBarTitleText": "认养详情",
"enablePullDownRefresh": true "enablePullDownRefresh": true,
"navigationStyle": "custom",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "pages/order", "path": "pages/order",

View File

@@ -0,0 +1,457 @@
<template>
<view class="pages-claim" v-if="isLoad">
<uni-nav-bar :fixed="true" :title="scrollTop>40?'':'认植认养'" backgroundColor="none" color="#FFFFFF"></uni-nav-bar>
<view class="banner-wrap">
<image class="banner" mode="aspectFill" src="@/static/image/imgicon/banner_bg.png"></image>
</view>
<scroll-view class="tab-scroll" scroll-x enable-flex>
<view class="tab-list-box">
<view class="tab-item on" v-for="i in 9">
<view class="name">优质果蔬</view>
<image class="icon-bg" mode="aspectFit" src="@/static/image/imgicon/tab_icon.png"></image>
</view>
</view>
</scroll-view>
<view class="list-wrap">
<view class="list-item" v-for="i in 3">
<view class="img-box">
<image class="img" mode="aspectFill" src="@/static/image/imgicon/banner_bg.png"></image>
<view class="hot">最热</view>
</view>
<view class="content">
<view class="name-row">
<view class="name">橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树</view>
<view class="money">
<text></text>
280.
<text>00</text>
</view>
</view>
<view class="address-row">
<view class="address">产地河源-牛营山牛营山牛营山牛营山牛营山牛营山牛营山</view>
<view class="count">已认种10</view>
</view>
<view class="info-row">
<view class="info-item">
<view class="count">10</view>
<view class="label">品种</view>
</view>
<view class="info-item">
<view class="count">1890</view>
<view class="label">预产量(kg)</view>
</view>
<view class="info-item">
<view class="count">10</view>
<view class="label">周期</view>
</view>
</view>
<view class="but">我要认种</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { mapState, mapActions, mapMutations } from 'vuex';
export default {
components: {},
data() {
return {
isLoad: false,
options: {},
rankInd: 0,
rankList: [
{
id: 1,
title: '综合排序'
},
{
id: 2,
title: '销量优先'
},
{
id: 3,
title: '距离优先'
}
],
tabList: [],
activeIndex: 0,
cate_id: 0,
banner: [],
param: {
page: 1
},
list: {
data: []
},
loading: true,
lockTap: false,
show_rank_item: false,
refresh: false,
scrollTop: 0
};
},
computed: mapState({
primaryColor: (state) => state.config.configInfo.primaryColor,
subColor: (state) => state.config.configInfo.subColor,
configInfo: (state) => state.config.configInfo,
userInfo: (state) => state.user.userInfo,
location: (state) => state.user.location,
loginType: (state) => state.user.loginType
}),
async onLoad() {
if (this.isLoad) return;
this.$util.showLoading();
this.initIndex();
},
async onShow() {
if (!this.isLoad || (this.location.lat && this.rankInd != 2)) return;
let [err, result] = await uni.getSetting();
if (err || !result.authSetting[`scope.userLocation`]) return;
this.initIndex();
},
onPullDownRefresh() {
// #ifndef APP-PLUS
uni.showNavigationBarLoading();
// #endif
this.initRefresh();
uni.stopPullDownRefresh();
},
onReachBottom() {
if (this.list.current_page >= this.list.last_page || this.loading) return;
this.param.page = this.param.page + 1;
this.loading = true;
this.getList();
},
onShareAppMessage(e) {
let { id: pid } = this.userInfo;
let path = `/pages/claim?pid=${pid}`;
this.$util.log(path);
return {
title: '',
imageUrl: '',
path
};
},
onPageScroll(e){
this.scrollTop = e.scrollTop
},
methods: {
...mapActions(['getConfigInfo']),
...mapMutations(['updateUserItem']),
async initIndex(refresh = false) {
if (!this.configInfo.id || refresh) {
await this.getConfigInfo();
if (this.loginType == 'apple') {
this.updateUserItem({
key: 'isShowLogin',
val: false
});
}
}
await this.getLocation();
let [banner, cate] = await Promise.all([
this.$api.claim.claimBanner({
type: 3
}),
this.$api.claim.claimCateList({
type: 2
})
]);
cate.unshift({
id: 0,
title: '全部'
});
this.banner = banner;
this.tabList = cate;
this.isLoad = true;
this.refresh = false;
this.param.page = 1;
this.getList();
},
initRefresh() {
this.refresh = true;
this.$refs.rank_item.close();
this.initIndex(true);
},
async getLocation() {
let { location } = this;
if (!location.lat) {
location = await this.$util.getBmapLocation();
this.updateUserItem({
key: 'location',
val: location
});
}
},
handerTabChange(index, type) {
this[type] = index;
this.$refs.rank_item.close();
if (type == 'activeIndex') {
this.cate_id = this.tabList[index].id;
}
this.$util.showLoading();
this.param.page = 1;
this.list.data = [];
this.getList();
},
toShowRank() {
let { show_rank_item } = this;
if (this.lockTap) return;
this.lockTap = true;
setTimeout(() => {
let methodModel = show_rank_item ? 'close' : 'open';
this.$refs.rank_item[methodModel]();
}, 500);
},
popupChange(e) {
let { show } = e;
this.show_rank_item = show;
setTimeout(() => {
this.lockTap = false;
}, 200);
},
async getList() {
let { list: oldList, param, tabList, activeIndex, rankList, rankInd, cate_id } = this;
let ind = tabList.findIndex((item) => {
return item.id == cate_id;
});
cate_id = ind == -1 ? 0 : cate_id;
activeIndex = ind == -1 ? 0 : ind;
this.cate_id = cate_id;
this.activeIndex = activeIndex;
let { id: sort } = rankList[rankInd];
if (sort == 3 && !this.location.lat) {
this.$util.hideAll();
await this.getLocation();
return;
}
let { lng = 0, lat = 0 } = this.location;
param = Object.assign({}, param, {
cate_id,
sort
});
if (sort === 3) {
param.lat = lat;
param.lng = lng;
}
let newList = await this.$api.claim.claimList(param);
newList.data.map((item) => {
let { stock, sale_num } = item;
item.precent = ((sale_num / (stock + sale_num)) * 100).toFixed(2) + '%';
});
if (this.param.page == 1) {
this.list = newList;
} else {
newList.data = oldList.data.concat(newList.data);
this.list = newList;
}
this.loading = false;
this.$util.hideAll();
},
async goDetail(index) {
let { id } = this.list.data[index];
let url = `/claim/pages/detail?id=${id}`;
this.$util.toCheckLogin({
url
});
}
}
};
</script>
<style lang="scss">
.pages-claim {
min-height: 100vh;
background: #f8feff;
}
.banner-wrap {
width: 100%;
height: 596rpx;
.banner {
display: block;
width: 100%;
height: 596rpx;
}
}
.tab-scroll {
height: 88rpx;
overflow: auto;
display: flex;
background: #ffffff;
.tab-list-box {
padding: 0 28rpx;
height: 88rpx;
width: auto;
white-space: nowrap;
}
.tab-item {
font-size: 28rpx;
color: #777777;
line-height: 88rpx;
position: relative;
overflow: hidden;
flex-shrink: 0;
white-space: nowrap;
display: inline-block;
& + .tab-item {
margin-left: 70rpx;
}
&.on {
font-size: 32rpx;
color: #333333;
font-weight: 500;
}
.name {
position: relative;
z-index: 1;
}
.icon-bg {
width: 62rpx;
height: 20rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 10rpx);
}
}
}
.list-wrap {
padding: 28rpx 28rpx 200rpx;
.list-item {
background: #ffffff;
box-shadow: 0 6rpx 6rpx #f5f5f5;
border-radius: 12rpx;
margin-bottom: 28rpx;
overflow: hidden;
.img-box {
position: relative;
.img {
width: 100%;
height: 390rpx;
display: block;
}
.hot{
height: 48rpx;
display: flex;
align-items: center;
padding: 0 28rpx;
background: linear-gradient( 133deg, #FFCC49 0%, #FF8744 100%);
border-radius: 0 0 12rpx 0;
font-size: 28rpx;
line-height: 28rpx;
color: #FFFFFF;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
}
.content {
padding: 28rpx 16rpx;
}
.name-row {
display: flex;
align-items: center;
margin-bottom: 22rpx;
.name {
flex: 1;
line-height: 44rpx;
font-weight: 500;
font-size: 32rpx;
color: #333333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.money {
line-height: 50rpx;
font-weight: 500;
font-size: 32rpx;
color: #dd3e3e;
margin-left: 20rpx;
text {
font-size: 24rpx;
}
}
}
.address-row {
line-height: 40rpx;
font-size: 28rpx;
color: #999999;
display: flex;
padding-bottom: 24rpx;
border-bottom: 2rpx dashed #e4eaeb;
.address {
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 20rpx;
}
}
.info-row {
display: flex;
padding: 35rpx 0;
.info-item {
flex: 1;
text-align: center;
}
.count {
line-height: 44rpx;
font-weight: 500;
font-size: 32rpx;
color: #dd3e3e;
margin-bottom: 16rpx;
}
.label {
line-height: 34rpx;
font-size: 24rpx;
color: #999999;
}
}
.but {
margin: 0 auto;
width: 568rpx;
height: 72rpx;
background: #1FD3EA;
// background: linear-gradient(to right, #43c5fe, #358ffd);
border-radius: 72rpx;
font-size: 28rpx;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}
}
</style>

View File

@@ -0,0 +1,375 @@
<template>
<view class="pages-claim" v-if="isLoad">
<fixed :refresh="refresh">
<view class="fill-base">
<banner :list="banner" :margin="0" :autoplay="true" :borderRadius="0" :height="420"
:indicatorActiveColor="primaryColor" v-if="banner.length > 0"></banner>
<view class="fill-base flex-between b-1px-b">
<view style="width: 650rpx;">
<tab @change="handerTabChange($event,'activeIndex')" :list="tabList" :activeIndex="activeIndex"
:activeColor="primaryColor" height="100rpx"></tab>
</view>
<view @tap.stop="toShowRank" class="flex-center c-caption b-1px-l" style="width: 100rpx;">
<i class="iconfont icon-down-bold" :class="[{'rotate-180':show_rank_item}]"></i>
</view>
</view>
</view>
</fixed>
<uni-popup @change="popupChange" ref="rank_item" type="top" :custom="true">
<view :style="{height: banner.length > 0 ? '520rpx':'100rpx'}"></view>
<view class="pd-lg fill-base">
<view @tap.stop="handerTabChange(index,'rankInd')" class="f-paragraph c-title"
:class="[{'mt-md':index!=0}]" :style="{color:index==rankInd?primaryColor:''}"
v-for="(item,index) in rankList" :key="index">
{{item.title}}
</view>
</view>
</uni-popup>
<view @tap.stop="goDetail(index)" class="claim-item fill-base mt-md ml-md mr-md box-shadow radius-24"
v-for="(item,index) in list.data" :key="index">
<view class="flex-between pt-lg pl-lg pr-lg">
<view class="flex-y-center">
<image mode="aspectFill" lazy-load class="avatar mini radius" :src="item.farmer_info.cover"></image>
<view class="ml-lg max-446 ellipsis">{{item.farmer_info.title}}</view>
</view>
<i class="iconfont icon-right c-caption" style="font-size: 28rpx;"></i>
</view>
<view class="flex-center pd-lg">
<image mode="aspectFill" lazy-load class="cover fill-body radius-24" :src="item.cover"></image>
<view class="flex-1 ml-lg max-380">
<view class="f-title c-title ellipsis-2">{{item.title}}</view>
<view class="f-paragraph c-title">{{`${item.start_time} ${item.end_time}`}}</view>
<view class="flex-between mt-sm mb-md">
<view class="line-item rel">
<view class="cur abs" :style="{width:item.precent}"></view>
</view>
<view class="c-caption" style="font-size: 20rpx;">已认养{{item.precent}}</view>
</view>
<view class="count-list flex-warp">
<view class="count-item">
<view class="flex-y-center f-caption c-caption">
<view class="dot radius"></view>品种
</view>
<view class="f-paragraph c-title ellipsis">{{item.breed}}</view>
</view>
<view class="count-item">
<view class="flex-y-center f-caption c-caption">
<view class="dot radius"></view>周期
</view>
<view class="f-paragraph c-title ellipsis">{{item.cycle}}</view>
</view>
<view class="count-item">
<view class="flex-y-center f-caption c-caption">
<view class="dot radius"></view>产量
</view>
<view class="f-paragraph c-title">{{item.output}}kg</view>
</view>
</view>
</view>
</view>
<view class="flex-between ml-lg mr-lg pt-lg pb-sm b-1px-t">
<view class="flex-y-baseline">
<view class="f-lg-title c-warning">¥{{item.price}}</view>
<view class="f-caption c-caption ml-sm">/{{item.unit}}</view>
</view>
<view class="common-btn flex-center f-paragraph c-base radius-4" :style="{background:primaryColor}">
立即认养</view>
</view>
<view class="flex-y-center pl-lg pr-lg pb-lg">
<view class="flex-warp">
<block v-for="(item,index) in item.count.user_list" :key="index">
<view class="avatar-group" v-if="index<6">
<image mode="aspectFill" lazy-load class="abs avatar fill-body radius"
:src="item.avatarUrl"></image>
</view>
</block>
</view>
<view class="flex-y-center f-caption c-title pr-lg" :class="[{'ml-lg':item.count.user_count>0}]"
style="height: 48rpx;">
已有{{item.count.user_count}}人参与</view>
</view>
</view>
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
</load-more>
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
<view class="space-footer"></view>
</view>
</template>
<script>
import {
mapState,
mapActions,
mapMutations
} from "vuex"
export default {
components: {},
data() {
return {
isLoad: false,
options: {},
rankInd: 0,
rankList: [{
id: 1,
title: '综合排序'
}, {
id: 2,
title: '销量优先'
}, {
id: 3,
title: '距离优先'
}],
tabList: [],
activeIndex: 0,
cate_id: 0,
banner: [],
param: {
page: 1,
},
list: {
data: []
},
loading: true,
lockTap: false,
show_rank_item: false,
refresh: false
}
},
computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo,
userInfo: state => state.user.userInfo,
location: state => state.user.location,
loginType: state => state.user.loginType,
}),
async onLoad() {
if (this.isLoad) return
this.$util.showLoading()
this.initIndex()
},
async onShow() {
if (!this.isLoad || (this.location.lat && this.rankInd != 2)) return
let [err, result] = await uni.getSetting()
if (err || !result.authSetting[`scope.userLocation`]) return
this.initIndex()
},
onPullDownRefresh() {
// #ifndef APP-PLUS
uni.showNavigationBarLoading()
// #endif
this.initRefresh()
uni.stopPullDownRefresh()
},
onReachBottom() {
if (this.list.current_page >= this.list.last_page || this.loading) return
this.param.page = this.param.page + 1
this.loading = true
this.getList()
},
onShareAppMessage(e) {
let {
id: pid
} = this.userInfo
let path = `/pages/claim?pid=${pid}`
this.$util.log(path)
return {
title: '',
imageUrl: '',
path,
}
},
methods: {
...mapActions(['getConfigInfo']),
...mapMutations(['updateUserItem']),
async initIndex(refresh = false) {
if (!this.configInfo.id || refresh) {
await this.getConfigInfo()
if (this.loginType == 'apple') {
this.updateUserItem({
key: 'isShowLogin',
val: false
})
}
}
await this.getLocation()
let [banner, cate] = await Promise.all([this.$api.claim.claimBanner({
type: 3
}), this.$api.claim
.claimCateList({
type: 2
})
])
cate.unshift({
id: 0,
title: '全部'
})
this.banner = banner
this.tabList = cate
this.isLoad = true
this.refresh = false
this.param.page = 1
this.getList()
},
initRefresh() {
this.refresh = true
this.$refs.rank_item.close()
this.initIndex(true)
},
async getLocation() {
let {
location
} = this
if (!location.lat) {
location = await this.$util.getBmapLocation()
this.updateUserItem({
key: 'location',
val: location
})
}
},
handerTabChange(index, type) {
this[type] = index
this.$refs.rank_item.close()
if (type == 'activeIndex') {
this.cate_id = this.tabList[index].id
}
this.$util.showLoading()
this.param.page = 1
this.list.data = []
this.getList()
},
toShowRank() {
let {
show_rank_item,
} = this
if (this.lockTap) return
this.lockTap = true
setTimeout(() => {
let methodModel = show_rank_item ? 'close' : 'open'
this.$refs.rank_item[methodModel]()
}, 500)
},
popupChange(e) {
let {
show
} = e
this.show_rank_item = show
setTimeout(() => {
this.lockTap = false
}, 200)
},
async getList() {
let {
list: oldList,
param,
tabList,
activeIndex,
rankList,
rankInd,
cate_id
} = this
let ind = tabList.findIndex(item => {
return item.id == cate_id
})
cate_id = ind == -1 ? 0 : cate_id
activeIndex = ind == -1 ? 0 : ind
this.cate_id = cate_id
this.activeIndex = activeIndex
let {
id: sort
} = rankList[rankInd]
if (sort == 3 && !this.location.lat) {
this.$util.hideAll()
await this.getLocation()
return
}
let {
lng = 0,
lat = 0
} = this.location
param = Object.assign({}, param, {
cate_id,
sort,
});
if (sort === 3) {
param.lat = lat
param.lng = lng
}
let newList = await this.$api.claim.claimList(param)
newList.data.map(item => {
let {
stock,
sale_num
} = item
item.precent = (sale_num / (stock + sale_num) * 100).toFixed(2) + '%'
})
if (this.param.page == 1) {
this.list = newList
} else {
newList.data = oldList.data.concat(newList.data)
this.list = newList
}
this.loading = false
this.$util.hideAll()
},
async goDetail(index) {
let {
id
} = this.list.data[index]
let url = `/claim/pages/detail?id=${id}`
this.$util.toCheckLogin({
url
})
}
}
}
</script>
<style lang="scss">
.pages-claim {
.claim-item {
.cover {
width: 240rpx;
height: 240rpx;
}
.line-item {
width: 230rpx;
height: 15rpx;
background: rgba(112, 152, 64, 0.2);
border-radius: 8rpx;
.cur {
top: 0;
left: 0;
height: 15rpx;
background: linear-gradient(0deg, #709840 0%, #91C84E 100%);
border-radius: 8rpx;
}
}
.count-list {
.count-item {
width: 33.33%;
.dot {
width: 10rpx;
height: 10rpx;
background: #B3D465;
margin-right: 10rpx;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,606 @@
<template>
<view class="pages-home" v-if="isLoad">
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" :onlyLeft="true" color="#fff"
:backgroundColor="scrollTop < 20 ?``:primaryColor">
<view @tap.stop="toChooseLocation" class="flex-y-center" slot="left">
<i class="iconfont icon-dingwei mr-sm"></i>
<view class=" max-400 ellipsis">
{{location.address || location.city || (location.lat ? '未知地点' : (isLoad ? '定位失败' : '定位中...'))}}
</view>
</view>
</uni-nav-bar>
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
<view mode="aspectFill" lazy-load class="home-index-bg abs"></view>
<view @tap.stop="$util.toCheckLogin({url:`/home/pages/search`})" class="pt-md pl-md pr-md">
<search :padding="0" :radius="10" backgroundColor="rgba(240,240,240,0.2)"
searchColor="rgba(240,240,240,0.2)" frontColor="#fff" textAlign="center" placeholder="请输入商品名称"></search>
</view>
<view class="mt-lg ml-md mr-md" v-if="detail.banner.rotation.length > 0">
<banner @change="goBanner" :list="detail.banner.rotation" :margin="0" :autoplay="true" :borderRadius="25"
:height="286" :indicatorActiveColor="primaryColor"></banner>
</view>
<view @tap="$util.toCheckLogin({url:`/home/pages/welfare?type=2`})"
class="notice-info flex-center mt-md pd-md fill-base">
<image mode="aspectFill" lazy-load class="notice-img" src="/static/image/home/notice.png">
</image>
<view class="ml-sm infomation-left"></view>
<view class="flex-1 ml-md">
<swiper :autoplay="true" :circular='true' :vertical="true" class="roller-box" :interval="2000">
<swiper-item v-for="(item,index) in detail.system_list" :key="index">
<view class="roller-item flex-between f-caption c-desc">
<view class="ellipsis">{{item.title}}</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
<view @tap.stop="goAbout"
class="weather-info flex-warp rel pr-md pl-md pb-md f-icontext c-desc"
v-if="detail.weather.observe.update_time">
<view class="flex-y-baseline">
<view class="flex-center mr-lg">
<view class="number">{{detail.weather.observe.degree}}°</view>
</view>
<view class="weather">{{today}} {{detail.weather.observe.weather}}</view>
</view>
<view class="flex-warp">
<view class="mr-lg">
温度变化{{`${detail.weather.forecast_24h.min_degree}°~${detail.weather.forecast_24h.max_degree}°`}}
</view>
<view class="mr-lg">风力{{detail.weather.observe.wind_power}}</view>
<view class="mr-lg">湿度{{detail.weather.observe.humidity}}%</view>
<view>气压{{detail.weather.observe.pressure}}hPa</view>
</view>
<view class="about-info flex-center abs" :style="{background:primaryColor}">
<image mode="aspectFill" lazy-load class="weather-img ml-sm mr-md"
:src="`${weather_img}${time_key}/${detail.weather.observe.weather_code}.png`">
</image>
</view>
</view>
<view class="flex-warp fill-base pb-md">
<view @tap.stop="toMenu(index)" class="menu-item flex-center flex-column pb-lg"
v-for="(item,index) in menuList" :key="index">
<image mode="aspectFill" lazy-load class="menu-img radius"
:src="`/static/image/home/${item.img_name}.png`">
</image>
<view class="f-caption c-title mt-sm">{{item.title}}</view>
</view>
</view>
<view @tap="$util.toCheckLogin({url:`/shop/pages/coupon`})"
class="advertisement-info fill-base pr-md pl-md pb-md" v-if="detail.coupon_total">
<image mode="aspectFill" lazy-load class="coupon-img"
src="/static/image/home/xrhb.png">
</image>
</view>
<view class="advertisement-info fill-base pr-md pl-md pb-md"
v-if="detail.banner.poster.length > 0">
<banner @change="goBanner" :list="detail.banner.poster" :margin="0" :autoplay="true" :borderRadius="25"
:height="285" :indicatorActiveColor="primaryColor"></banner>
</view>
<view class="mt-md pd-lg fill-base">
<view @tap="$util.toCheckLogin({url:`/shop/pages/hot-goods`})" class="flex-center">
<view class="flex-1 f-paragraph text-bold">热门商品</view>
<view class="flex-y-center c-caption f-caption">查看更多<i class="iconfont icon-right"></i></view>
</view>
<block v-for="(item,index) in detail.hot_goods" :key="index">
<view @tap.stop="goDetail(1,'hot_goods',index)" class="goods-item flex-center mt-lg">
<image mode="aspectFill" lazy-load class="cover radius-16" :src="item.cover"></image>
<view class="flex-1 ml-lg">
<view class="flex-center">
<view class="flex-1">
<view class="f-paragraph c-title mt-sm mb-sm max-400 ellipsis">{{item.goods_name}}
</view>
<view class="flex-y-baseline f-caption c-warning">¥<view class="f-title">
{{item.show_price}}
</view>
</view>
<view class="f-caption c-caption text-delete">¥{{item.show_init_price}}</view>
</view>
<image lazy-load class="add-car-img" src="/static/image/shop/add-car.png">
</image>
</view>
</view>
</view>
</block>
</view>
<view class="mt-md pt-lg pb-lg fill-base">
<view @tap="$util.toCheckLogin({url:`/shop/pages/choose-store`})" class="pl-lg pr-lg flex-center">
<view class="flex-1 f-paragraph text-bold">热门店铺</view>
<view class="flex-y-center c-caption f-caption">查看更多<i class="iconfont icon-right"></i></view>
</view>
<scroll-view scroll-x class="hot-shop-list pt-lg pl-lg" :scroll-with-animation="true"
v-if="detail.store_list.length > 0">
<block v-for="(item,index) in detail.store_list" :key="index">
<view @tap.stop="goDetail(2,'store_list',index)" class="hot-shop-item mr-lg radius-16">
<image mode="aspectFill" lazy-load class="cover box-shadow" :src="item.cover"></image>
<view class="pd-md">
<view class="flex-between f-caption c-desc">
<view class="business-tag flex-center radius-4" :style="{color:primaryColor}">营业中</view>
<view class="pl-sm ellipsis">{{item.distance}}</view>
</view>
<view class="f-paragraph c-title mt-md ellipsis-2">{{item.title}}</view>
</view>
</view>
</block>
</scroll-view>
</view>
<view class="mt-md pd-lg fill-base">
<view @tap="$util.toCheckLogin({url:`/home/pages/welfare`})" class="flex-center">
<view class="flex-1 f-paragraph text-bold">公益栏目</view>
<view class="flex-y-center c-caption f-caption">查看更多<i class="iconfont icon-right"></i></view>
</view>
<block v-for="(item,index) in detail.welfare_list" :key="index">
<view @tap.stop="goDetail(3,'welfare_list',index)" class="welfare-item flex-center mt-lg">
<image mode="aspectFill" lazy-load class="cover radius-16" :src="item.cover"></image>
<view class="flex-1 ml-lg">
<view class="f-title c-title mb-md ellipsis">{{item.title}}</view>
<view class="f-caption c-caption">{{item.create_time_text}}</view>
</view>
</view>
</block>
</view>
<view class="space-footer"></view>
</view>
</template>
<script>
import {
mapState,
mapActions,
mapMutations
} from "vuex"
import uniSegmentedControl from "@/components/uni-segmented-control.vue"
export default {
components: {
uniSegmentedControl
},
data() {
return {
scrollTop: 0,
options: {},
weather_img: `https://mat1.gtimg.com/pingjs/ext2020/weather/pc/icon/currentweather/`,
menuList: [{
id: 1,
title: '土地租赁',
img_name: 'land',
url: '/pages/land'
}, {
id: 2,
title: '农业认养',
img_name: 'claim',
url: '/pages/claim'
}, {
id: 3,
title: '视频监控',
img_name: 'monitor',
url: '/home/pages/monitor/list'
}, {
id: 4,
title: '农场商城',
img_name: 'shop',
url: '/pages/shop'
}, {
id: 5,
title: '会员充值',
img_name: 'stored',
url: '/mine/pages/balance/list'
}, {
id: 6,
title: '众筹认养',
img_name: 'collage',
url: '/claim/pages/collage/list'
}, {
id: 7,
title: '限时秒杀',
img_name: 'seckill',
url: '/shop/pages/seckill'
}, {
id: 8,
title: '积分商城',
img_name: 'integral',
url: '/shop/pages/integral/list'
}, {
id: 9,
title: '农场签到',
img_name: 'sign',
url: '/shop/pages/sign'
}, {
id: 10,
title: '积分抽奖',
img_name: 'luck',
url: '/shop/pages/luck'
}],
isLoad: false,
loading: false,
detail: {},
about_us: 0,
weather: {},
store_list: [],
today: '',
cur_time: '',
time_key: 'day'
}
},
computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo,
userInfo: state => state.user.userInfo,
location: state => state.user.location,
loginType: state => state.user.loginType,
}),
async onLoad() {
console.log("====onload")
if (this.isLoad) return
this.initIndex()
},
async onShow() {
let cur_time = this.$util.DateToUnix(this.$util.formatTime(new Date(), 'YY-M-D h:m:s'))
let time = this.$util.DateToUnix(this.$util.formatTime(new Date(), 'YY-M-D'))
let min = time + 8 * 3600 - 1
let max = time + 19 * 3600 + 1
this.time_key = cur_time > min && cur_time < max ? 'day' : 'night'
if (!this.isLoad || this.location.lat) return
let [err, result] = await uni.getSetting()
if (err || !result.authSetting[`scope.userLocation`]) return
this.initIndex()
},
onPageScroll(e) {
this.scrollTop = e.scrollTop
},
onPullDownRefresh() {
// #ifndef APP-PLUS
uni.showNavigationBarLoading()
// #endif
this.initRefresh()
uni.stopPullDownRefresh()
},
onShareAppMessage(e) {
let {
id: pid
} = this.userInfo
let path = `/pages/home?pid=${pid}`
this.$util.log(path)
return {
title: '',
imageUrl: '',
path,
}
},
methods: {
...mapActions(['getConfigInfo']),
...mapMutations(['updateUserItem']),
async initIndex(refresh = false) {
this.cur_time = this.$util.formatTime(new Date(), 'YY-M-D')
this.today = this.$util.formatTime(new Date(), 'YY年M月D日')
if (!this.configInfo.id || refresh) {
await this.getConfigInfo()
if (this.loginType == 'apple') {
this.updateUserItem({
key: 'isShowLogin',
val: false
})
}
}
await this.getLocation()
if (!refresh) {
this.$util.showLoading()
}
let {
lat = 0,
lng = 0
} = this.location
let [detail, coupon] = await Promise.all([this.$api.home.index({
lat,
lng
}), this.$api.shop.couponList()])
detail.coupon_total = coupon.total
let {
status = 0,
data
} = detail.weather
if (status == 200) {
let {
forecast_24h
} = data
let cur_day = forecast_24h.filter(item => {
return item.time == this.cur_time
})
data.forecast_24h = cur_day.length > 0 ? cur_day[0] : []
detail.weather = data
}
this.detail = detail
this.isLoad = true
this.loading = false
this.$util.hideAll()
},
initRefresh() {
this.initIndex(true)
},
async getLocation() {
let {
location
} = this
if (!location.lat) {
try {
// #ifdef H5
// H5环境下先检查缓存的位置信息
let cachedLocation = uni.getStorageSync('cached_location');
let cacheTime = uni.getStorageSync('location_cache_time');
let now = new Date().getTime();
// 如果有缓存且缓存时间不超过30分钟直接使用缓存的位置
if (cachedLocation && cacheTime && (now - cacheTime) < 30 * 60 * 1000) {
location = cachedLocation;
} else {
// 没有缓存或缓存过期,才获取新位置
location = await this.$util.getBmapLocation();
}
// #endif
// #ifndef H5
// 非H5环境直接获取位置
location = await this.$util.getBmapLocation();
// #endif
this.updateUserItem({
key: 'location',
val: location
})
} catch (error) {
console.log('获取位置失败:', error);
// 获取位置失败时不更新location使用默认值
this.$util.showToast({
title: '获取位置失败,使用默认位置'
});
}
}
},
// 选择地区
async toChooseLocation(e) {
await this.$util.checkAuth({
type: 'userLocation'
})
let [, {
address = '',
longitude: lng = 0,
latitude: lat = 0
} = {}] = await uni.chooseLocation();
if (!lng) return
let location = {
lng,
lat,
address
}
this.updateUserItem({
key: 'location',
val: location
})
this.initRefresh()
},
toMenu(index) {
let {
title,
url,
} = this.menuList[index]
let arr = ['土地租赁', '农业认养']
let openType = arr.includes(title) ? 'switchTab' : title == '农场商城' ?
'reLaunch' : 'navigateTo'
this.$util.toCheckLogin({
url,
openType
})
},
// 轮播图/广告图跳转
goBanner(e) {
// connect_type 1店铺2文章3图片4店铺
let {
connect_type,
text_id: id = 0,
img: current
} = e.item
switch (connect_type) {
case 1:
case 2:
case 4:
let page = {
1: `/home/pages/farm/detail?id=${id}`,
2: `/home/pages/article?id=${id}&type=1`,
4: `/shop/pages/store?id=${id}`
}
let url = page[connect_type]
this.$util.toCheckLogin({
url
})
break;
case 3:
this.$util.previewImage({
current,
urls: [current]
})
break;
}
},
goAbout() {
if (!this.detail.about_us) return
this.$util.toCheckLogin({
url: `/home/pages/about`
})
},
// 商品/店铺/公益栏目详情
async goDetail(type, key, index) {
let {
id
} = this.detail[key][index]
let url = ''
switch (type) {
case 1:
url = `/shop/pages/detail?id=${id}`
break
case 2:
url = `/shop/pages/store?id=${id}`
break
case 3:
url = `/home/pages/article?id=${id}&type=2`
break
}
this.$util.toCheckLogin({
url
})
}
}
}
</script>
<style lang="scss">
.pages-home {
.icon-right {
font-size: 24rpx;
}
.menu-item {
width: 20%;
.menu-img {
width: 96rpx;
height: 96rpx;
}
}
.notice-info {
height: 110rpx;
.notice-img {
width: 128rpx;
height: 48rpx;
}
.infomation-left {
height: 48rpx;
border-right: 0.03125rem solid #e1e6ec;
}
.roller-box {
height: 40rpx;
.roller-item {
height: 40rpx;
line-height: 1;
}
}
}
.weather-info {
height: 168rpx;
background: #ffffff;
.number {
font-size: 48rpx;
color: #FEB23A;
}
.weather {
color: #FEB23A;
}
.weather-img {
width: 50rpx;
height: 50rpx;
}
.about-info {
right: 0rpx;
width: 84rpx;
height: 84rpx;
border-radius: 5000rpx;
margin-right: 30rpx;
.about-img {
width: 102rpx;
height: 25rpx;
margin: 0 8rpx;
}
.about-right-img {
width: 34rpx;
height: 25rpx;
}
}
}
.advertisement-info {
.coupon-img {
width: 100%;
height: 180rpx;
}
}
.goods-item {
.cover {
width: 180rpx;
height: 170rpx;
}
.add-car-img {
width: 70rpx;
height: 70rpx;
}
}
.hot-shop-list {
white-space: nowrap;
width: calc(100% - 30rpx);
.hot-shop-item {
width: 281rpx;
height: 353rpx;
background: #F9FAF9;
display: inline-block;
.cover {
width: 281rpx;
height: 175rpx;
border-radius: 15rpx 15rpx 0 0;
}
.business-tag {
width: 86rpx;
height: 34rpx;
background: rgba(52, 162, 99, 0.1);
}
}
}
.home-index-bg {
background: rgb(57, 181, 74);
height: 15.625rem;
width: 100%;
top: 0;
border-radius: 0 0 5% 5%;
z-index: -1;
}
.welfare-item {
.cover {
width: 180rpx;
height: 160rpx;
}
.ellipsis {
max-width: 480rpx;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

View File

@@ -8,7 +8,7 @@ export default {
navBarHeight: uni.getSystemInfoSync().statusBarHeight * 1 + 44, navBarHeight: uni.getSystemInfoSync().statusBarHeight * 1 + 44,
isIos: uni.getSystemInfoSync().system.includes('iOS'), isIos: uni.getSystemInfoSync().system.includes('iOS'),
canIUseGetUserProfile: uni.getUserProfile ? true : false, canIUseGetUserProfile: uni.getUserProfile ? true : false,
primaryColor: '#39b54a', primaryColor: '#358FFD',
subColor: '#F3A664', subColor: '#F3A664',
refund_img: 'https://lbqny.migugu.com/paotui/errand.png', refund_img: 'https://lbqny.migugu.com/paotui/errand.png',
curSysHeight: '', curSysHeight: '',

View File

@@ -91,6 +91,10 @@
content: "\e617"; content: "\e617";
} }
.icon-left:before {
content: "\e617";
}
.icon-add-circle-fill:before { .icon-add-circle-fill:before {
content: "\e61d"; content: "\e61d";
} }

View File

@@ -698,9 +698,20 @@ if (!function_exists('is_dev')) {
if (in_array($env, ['dev', 'development', 'local', 'test'], true)) { if (in_array($env, ['dev', 'development', 'local', 'test'], true)) {
return true; return true;
} }
if (app()->environment('dev') || app()->environment('local') || app()->environment('test')) {
return true; return false;
} }
}
if (!function_exists('is_local')) {
function is_local()
{
$env = env('APP_ENV', '');
$env = strtolower($env);
if (in_array($env, ['local'], true)) {
return true;
}
return false; return false;
} }
} }