ShopXO
8
alipay/.tea/entryFiles-development/config$.js
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
const g = typeof global !== 'undefined' ? global : self;
|
||||
g.appXRuntimeConfig = {};
|
||||
g.appXAppJson = {
|
||||
"app": {
|
||||
"$homepage": "pages/index/index"
|
||||
}
|
||||
};
|
19
alipay/.tea/entryFiles-development/index$.web.js
Normal file
@ -0,0 +1,19 @@
|
||||
require('@alipay/appx-compiler/lib/sjsEnvInit');
|
||||
require('./config$');
|
||||
require('../../pages/index/index');
|
||||
require('../../pages/user/user');
|
||||
require('../../pages/web-view/web-view');
|
||||
require('../../pages/login/login');
|
||||
require('../../pages/paytips/paytips');
|
||||
require('../../pages/goods-search/goods-search');
|
||||
require('../../pages/goods-detail/goods-detail');
|
||||
require('../../pages/goods-attribute/goods-attribute');
|
||||
require('../../pages/buy/buy');
|
||||
require('../../pages/user-address/user-address');
|
||||
require('../../pages/user-address-save/user-address-save');
|
||||
require('../../pages/user-order/user-order');
|
||||
require('../../pages/user-order-detail/user-order-detail');
|
||||
require('../../pages/user-faovr/user-faovr');
|
||||
require('../../pages/user-answer-list/user-answer-list');
|
||||
require('../../pages/answer-list/answer-list');
|
||||
require('../../pages/answer-form/answer-form');
|
23
alipay/.tea/entryFiles-development/index$.worker.js
Normal file
@ -0,0 +1,23 @@
|
||||
require('./config$');
|
||||
|
||||
function success() {
|
||||
require('../..//app');
|
||||
require('../../pages/index/index');
|
||||
require('../../pages/user/user');
|
||||
require('../../pages/web-view/web-view');
|
||||
require('../../pages/login/login');
|
||||
require('../../pages/paytips/paytips');
|
||||
require('../../pages/goods-search/goods-search');
|
||||
require('../../pages/goods-detail/goods-detail');
|
||||
require('../../pages/goods-attribute/goods-attribute');
|
||||
require('../../pages/buy/buy');
|
||||
require('../../pages/user-address/user-address');
|
||||
require('../../pages/user-address-save/user-address-save');
|
||||
require('../../pages/user-order/user-order');
|
||||
require('../../pages/user-order-detail/user-order-detail');
|
||||
require('../../pages/user-faovr/user-faovr');
|
||||
require('../../pages/user-answer-list/user-answer-list');
|
||||
require('../../pages/answer-list/answer-list');
|
||||
require('../../pages/answer-form/answer-form');
|
||||
}
|
||||
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
|
8
alipay/.tea/entryFiles-production/config$.js
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
const g = typeof global !== 'undefined' ? global : self;
|
||||
g.appXRuntimeConfig = {};
|
||||
g.appXAppJson = {
|
||||
"app": {
|
||||
"$homepage": "pages/index/index"
|
||||
}
|
||||
};
|
1
alipay/.tea/entryFiles-production/importScripts$.js
Normal file
@ -0,0 +1 @@
|
||||
importScripts(`https://appx/af-appx.worker.min.js`);
|
19
alipay/.tea/entryFiles-production/index$.web.js
Normal file
@ -0,0 +1,19 @@
|
||||
require('@alipay/appx-compiler/lib/sjsEnvInit');
|
||||
require('./config$');
|
||||
require('../../pages/index/index');
|
||||
require('../../pages/user/user');
|
||||
require('../../pages/web-view/web-view');
|
||||
require('../../pages/login/login');
|
||||
require('../../pages/paytips/paytips');
|
||||
require('../../pages/goods-search/goods-search');
|
||||
require('../../pages/goods-detail/goods-detail');
|
||||
require('../../pages/goods-attribute/goods-attribute');
|
||||
require('../../pages/buy/buy');
|
||||
require('../../pages/user-address/user-address');
|
||||
require('../../pages/user-address-save/user-address-save');
|
||||
require('../../pages/user-order/user-order');
|
||||
require('../../pages/user-order-detail/user-order-detail');
|
||||
require('../../pages/user-faovr/user-faovr');
|
||||
require('../../pages/user-answer-list/user-answer-list');
|
||||
require('../../pages/answer-list/answer-list');
|
||||
require('../../pages/answer-form/answer-form');
|
23
alipay/.tea/entryFiles-production/index$.worker.js
Normal file
@ -0,0 +1,23 @@
|
||||
require('./config$');
|
||||
require('./importScripts$');
|
||||
function success() {
|
||||
require('../..//app');
|
||||
require('../../pages/index/index');
|
||||
require('../../pages/user/user');
|
||||
require('../../pages/web-view/web-view');
|
||||
require('../../pages/login/login');
|
||||
require('../../pages/paytips/paytips');
|
||||
require('../../pages/goods-search/goods-search');
|
||||
require('../../pages/goods-detail/goods-detail');
|
||||
require('../../pages/goods-attribute/goods-attribute');
|
||||
require('../../pages/buy/buy');
|
||||
require('../../pages/user-address/user-address');
|
||||
require('../../pages/user-address-save/user-address-save');
|
||||
require('../../pages/user-order/user-order');
|
||||
require('../../pages/user-order-detail/user-order-detail');
|
||||
require('../../pages/user-faovr/user-faovr');
|
||||
require('../../pages/user-answer-list/user-answer-list');
|
||||
require('../../pages/answer-list/answer-list');
|
||||
require('../../pages/answer-form/answer-form');
|
||||
}
|
||||
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
|
37
alipay/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
# 嗖嗖快递驿站-客户端
|
||||
|
||||
#### 项目介绍
|
||||
嗖嗖快递驿站 - 客户端
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本项目
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 码云特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
|
||||
5. 码云官方提供的使用手册 [http://git.mydoc.io/](http://git.mydoc.io/)
|
||||
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
240
alipay/app.acss
Normal file
@ -0,0 +1,240 @@
|
||||
/* 框架样式覆盖 */
|
||||
.a-textarea-control textarea { font-size: 12px; }
|
||||
|
||||
/* 公共样式 */
|
||||
page {
|
||||
background: #f5f5f5;
|
||||
color: #4a4a4a;
|
||||
}
|
||||
page, textarea {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="number"],
|
||||
input[type="idcard"],
|
||||
input[type="digit"],
|
||||
textarea {
|
||||
-webkit-appearance: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* 导航分割 */
|
||||
.spacing-nav-title {
|
||||
position: relative;
|
||||
color: #ff6482;
|
||||
text-align: center;
|
||||
background-color: #ffffff;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
.spacing-nav-title .line {
|
||||
display: inline-block;
|
||||
width: 50%;
|
||||
height: 1px;
|
||||
background: #ff6482;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(-50%,-50%);
|
||||
-ms-transform: translate(-50%,-50%);
|
||||
transform: translate(-50%,-50%);
|
||||
}
|
||||
.spacing-nav-title .text-wrapper {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
background-color: #ffffff;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 模块分割间距 */
|
||||
.spacing { padding-top: 20rpx; }
|
||||
.spacing-10 { padding-top: 10rpx; }
|
||||
.spacing-mb { margin-bottom: 20rpx; }
|
||||
|
||||
/* 在线客服 */
|
||||
.customer-service {
|
||||
position: fixed;
|
||||
bottom: 100rpx;
|
||||
right: 0;
|
||||
}
|
||||
.customer-service image {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
.drift { position: fixed; left: -1000px; }
|
||||
|
||||
.nav-submit-fixed { background: #eee; height: 46px; position: fixed; bottom: 0; z-index: 10; }
|
||||
|
||||
.tips { background: #ffffeb url('/images/tips.png') no-repeat 5rpx 16rpx; background-size: 26rpx 26rpx; color: #f7b240; border: 1px solid #faebd2; line-height: 36rpx; padding: 5px 5px 5px 15px; font-size: 26rpx; border-radius: 2px; display: block; }
|
||||
|
||||
.data-loding image { width: 60px; height: 60px; background-size: 80% 80% !important; }
|
||||
|
||||
|
||||
/* 边框 */
|
||||
.br-b { border-bottom: solid 1rpx #efefef; }
|
||||
.br-t { border-top: solid 1rpx #efefef; }
|
||||
.br-l { border-left: solid 1rpx #efefef; }
|
||||
.br-r { border-right: solid 1rpx #efefef; }
|
||||
|
||||
/* 虚线边框 */
|
||||
.br-b-dashed { border-bottom: dashed 1rpx #efefef; }
|
||||
.br-t-dashed { border-top: dashed 1rpx #efefef; }
|
||||
.br-l-dashed { border-left: dashed 1rpx #efefef; }
|
||||
.br-r-dashed { border-right: dashed 1rpx #efefef; }
|
||||
|
||||
/* 箭头符号 */
|
||||
.arrow-right { background-image: url('data:image/svg+xml;charset=utf-8,<svg width="16" height="26" viewBox="0 0 16 26" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="UI-KIT_基础元件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="9.9基础元件" transform="translate(-5809.000000, -8482.000000)" fill="#C7C7CC"><polygon id="Disclosure-Indicator" points="5811 8482 5809 8484 5820.5 8495 5809 8506 5811 8508 5825 8495"></polygon></g></g></svg>'); background-size: 15px 10px; background-repeat: no-repeat; background-position: center right; }
|
||||
|
||||
|
||||
/* 常用样式 */
|
||||
.fl { float: left; }
|
||||
.fr { float: right; }
|
||||
.bg-white { background-color: #fff; }
|
||||
.wh-auto { width: 100%; }
|
||||
.tc { text-align: center; }
|
||||
.tl { text-align: left; }
|
||||
.tr { text-align: right; }
|
||||
.oh { overflow: hidden; }
|
||||
.dis-none { display: none; }
|
||||
.dis-block { display: block; }
|
||||
|
||||
.cr-main { color: #ff6482; }
|
||||
.cr-666 { color: #666; }
|
||||
.cr-888 { color: #888; }
|
||||
.cr-ccc { color: #ccc; }
|
||||
.cr-fff { color: #fff; }
|
||||
|
||||
.my-btn-default{
|
||||
font-size: 38rpx;
|
||||
color: #fff;
|
||||
border: none;
|
||||
background-color:#ff6482;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.my-btn-default.btn-disabled{
|
||||
background-color: #a6a6a6;
|
||||
color: #fff;
|
||||
}
|
||||
.my-btn-gray{
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
border: none;
|
||||
background-color:#a6a6a6;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* 文字超出部分使用省略号 */
|
||||
.single-text {
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
.multi-text {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
|
||||
/* 没有数据状态/处理错误/加载中 */
|
||||
.no-data-box {
|
||||
padding: 80rpx 0;
|
||||
}
|
||||
.no-data-box image {
|
||||
width: 360rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.no-data-box .no-data-tips {
|
||||
font-size: 28rpx;
|
||||
color: #a6a6a6;
|
||||
}
|
||||
.no-data-loding {
|
||||
padding-top: 15%;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 底线 */
|
||||
.data-bottom-line{
|
||||
padding: 40rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.data-bottom-line view {
|
||||
width: 33.3%;
|
||||
}
|
||||
.data-bottom-line .left, .data-bottom-line .right{
|
||||
margin-top: 5px;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
}
|
||||
.data-bottom-line .msg{
|
||||
color: #999;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/* 业务公共 */
|
||||
.sales-price {
|
||||
color: #f40;
|
||||
font-weight: bold;
|
||||
font-size: 38rpx;
|
||||
}
|
||||
.original-price {
|
||||
color: #ccc;
|
||||
font-size: 26rpx;
|
||||
text-decoration: line-through;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.submit-fixed {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: #ff6482;
|
||||
color: #fff;
|
||||
border: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bg-main {
|
||||
background: #ff6482;
|
||||
color: #fff;
|
||||
border: 0;
|
||||
}
|
||||
.bg-active-main {
|
||||
background: #ff6482 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.submit-bottom {
|
||||
height: 85rpx;
|
||||
line-height: 85rpx;
|
||||
font-size: 32rpx;
|
||||
border-radius: 0;
|
||||
}
|
||||
.bg-main.a-button-disabled {
|
||||
background: #fbe0e5;
|
||||
color: #f7b6c2;
|
||||
}
|
||||
|
||||
.nav-back {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 10%;
|
||||
}
|
||||
|
||||
/*
|
||||
滚动标签高度
|
||||
*/
|
||||
.scroll-box {
|
||||
height: 100vh;
|
||||
}
|
431
alipay/app.js
Normal file
@ -0,0 +1,431 @@
|
||||
App({
|
||||
data: {
|
||||
// 用户信息缓存key
|
||||
cache_user_info_key: "cache_shop_user_info_key",
|
||||
|
||||
// 用户站点信息缓存key
|
||||
cache_user_merchant_key: "cache_shop_user_merchant_key",
|
||||
|
||||
// 设备信息缓存key
|
||||
cache_system_info_key: "cache_shop_system_info_key",
|
||||
|
||||
// 用户地址选择缓存key
|
||||
cache_buy_user_address_select_key: "cache_buy_user_address_select_key",
|
||||
|
||||
// 用户传入信息缓存key
|
||||
cache_launch_info_key: "cache_shop_launch_info_key",
|
||||
|
||||
// 默认用户头像
|
||||
default_user_head_src: "/images/default-user.png",
|
||||
|
||||
// 成功圆形提示图片
|
||||
default_round_success_icon: "/images/default-round-success-icon.png",
|
||||
|
||||
// 错误圆形提示图片
|
||||
default_round_error_icon: "/images/default-round-error-icon.png",
|
||||
|
||||
|
||||
// 页面标题
|
||||
common_pages_title: {
|
||||
"goods_search": "网上选人",
|
||||
"goods_detail": "人员详情",
|
||||
"goods_attribute": "属性",
|
||||
"user_address": "我的地址",
|
||||
"user_address_save_add": "新增地址",
|
||||
"user_address_save_edit": "编辑地址",
|
||||
"buy": "订单确认",
|
||||
"user_order": "预约订单",
|
||||
"user_order_detail": "订单详情",
|
||||
"user_favor": "我的收藏",
|
||||
"answer_form": "留言",
|
||||
"answer_list": "问答",
|
||||
"user_answer_list": "我的问答",
|
||||
"user": "用户中心",
|
||||
},
|
||||
|
||||
// 请求地址
|
||||
request_url: "http://boyuan.mei.la/",
|
||||
//request_url: 'http://default.com/project/shop/service/',
|
||||
|
||||
// 基础信息
|
||||
application_title: "伯缘家政",
|
||||
application_describe: "服务于需要外籍保姆服务的家庭",
|
||||
},
|
||||
|
||||
/**
|
||||
* 小程序初始化
|
||||
*/
|
||||
onLaunch(options) {
|
||||
// 设置设备信息
|
||||
this.set_system_info();
|
||||
|
||||
// 参数缓存
|
||||
my.setStorage({
|
||||
key: this.data.cache_launch_info_key,
|
||||
data: options.query || null
|
||||
});
|
||||
// 启动query参数处理
|
||||
this.startup_query(options.query);
|
||||
},
|
||||
|
||||
/**
|
||||
* 启动query参数处理
|
||||
*/
|
||||
startup_query(params) {
|
||||
// 没有启动参数则返回
|
||||
if ((params || null) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 启动处理类型
|
||||
var type = params.type || null;
|
||||
switch (type) {
|
||||
// type=page
|
||||
case "page":
|
||||
// 页面
|
||||
var page = params.page || null;
|
||||
|
||||
// 参数名
|
||||
var params_field = params.params_field || null;
|
||||
|
||||
// 参数值
|
||||
var params_value = params.params_value || null;
|
||||
|
||||
// 页面跳转
|
||||
if(page != null)
|
||||
{
|
||||
my.navigateTo({
|
||||
url: "/pages/" + page + "/" + page + "?" + params_field + "=" + params_value
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
// type=view
|
||||
case "view" :
|
||||
var url = params.url || null;
|
||||
|
||||
// 页面跳转
|
||||
if(url != null)
|
||||
{
|
||||
my.navigateTo({
|
||||
url: '/pages/web-view/web-view?url='+url
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
// 默认
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取设备信息
|
||||
*/
|
||||
get_system_info() {
|
||||
let system_info = my.getStorageSync({
|
||||
key: this.data.cache_system_info_key
|
||||
});
|
||||
if ((system_info.data || null) == null) {
|
||||
return this.set_system_info();
|
||||
}
|
||||
return system_info.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置设备信息
|
||||
*/
|
||||
set_system_info() {
|
||||
var system_info = my.getSystemInfoSync();
|
||||
my.setStorage({
|
||||
key: this.data.cache_system_info_key,
|
||||
data: system_info
|
||||
});
|
||||
return system_info;
|
||||
},
|
||||
|
||||
/**
|
||||
* 请求地址生成
|
||||
*/
|
||||
get_request_url(a, c, m, params) {
|
||||
a = a || "Index";
|
||||
c = c || "Index";
|
||||
m = m || "Api";
|
||||
params = params || "";
|
||||
if (params != "" && params.substr(0, 1) != "&") {
|
||||
params = "&" + params;
|
||||
}
|
||||
var user = this.GetUserCacheInfo();
|
||||
var app_client_user_id = user == false ? "" : user.alipay_openid;
|
||||
var user_id = user == false ? 0 : user.id;
|
||||
var nickname = user == false ? "" : user.nickname;
|
||||
return (
|
||||
this.data.request_url +
|
||||
"api.php?m=" +
|
||||
m +
|
||||
"&c=" +
|
||||
c +
|
||||
"&a=" +
|
||||
a +
|
||||
"&application_client=default&&application=app&application_client_type=alipay&application_user_id=" +
|
||||
app_client_user_id +
|
||||
"&user_id=" +
|
||||
user_id +
|
||||
"&nickname=" +
|
||||
nickname +
|
||||
"&ajax=ajax" +
|
||||
params
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户信息,信息不存在则唤醒授权
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
* return 有用户数据直接返回, 则回调调用者
|
||||
*/
|
||||
GetUserInfo(object, method) {
|
||||
var user = this.GetUserCacheInfo();
|
||||
if (user == false) {
|
||||
// 唤醒用户授权
|
||||
this.UserAuthCode(object, method);
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return user;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 从缓存获取用户信息
|
||||
*/
|
||||
GetUserCacheInfo() {
|
||||
var user = my.getStorageSync({ key: this.data.cache_user_info_key });
|
||||
if ((user.data || null) == null) {
|
||||
return false;
|
||||
}
|
||||
return user.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户授权
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
*/
|
||||
UserAuthCode(object, method) {
|
||||
// 邀请人参数
|
||||
var params = my.getStorageSync({key: this.data.cache_launch_info_key});
|
||||
var referrer = (params.data == null) ? 0 : (params.data.referrer || 0);
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "授权中..." });
|
||||
|
||||
// 请求授权接口
|
||||
my.getAuthCode({
|
||||
scopes: "auth_user",
|
||||
success: res => {
|
||||
if (res.authCode) {
|
||||
my.httpRequest({
|
||||
url: this.get_request_url("GetAlipayUserInfo", "User"),
|
||||
method: "POST",
|
||||
data: {
|
||||
authcode: res.authCode,
|
||||
referrer: referrer
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
my.setStorage({
|
||||
key: this.data.cache_user_info_key,
|
||||
data: res.data.data
|
||||
});
|
||||
|
||||
if (typeof object === "object" && (method || null) != null) {
|
||||
object[method]();
|
||||
}
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg,
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: e => {
|
||||
my.hideLoading();
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "授权失败",
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取位置权限
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
*/
|
||||
use_location(object, method) {
|
||||
my.showLoading({ content: "定位中..." });
|
||||
|
||||
my.getLocation({
|
||||
success(res) {
|
||||
my.hideLoading();
|
||||
|
||||
// 回调
|
||||
if (typeof object === "object" && (method || null) != null) {
|
||||
object[method]({ lng: res.longitude, lat: res.latitude, status: 1000 });
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
my.hideLoading();
|
||||
switch (e.error) {
|
||||
case 11:
|
||||
case 2001:
|
||||
my.alert({
|
||||
title: "温馨提示",
|
||||
content: "点击右上角->关于->右上角->设置->打开地理位置权限",
|
||||
buttonText: "我知道了",
|
||||
success: () => {
|
||||
if (typeof object === "object" && (method || null) != null) {
|
||||
object[method]({ status: 400 });
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 12:
|
||||
my.showToast({ content: "网络异常,请重试[" + e.error + "]" });
|
||||
break;
|
||||
|
||||
case 13:
|
||||
my.showToast({ content: "定位失败,请重试[" + e.error + "]" });
|
||||
break;
|
||||
|
||||
default:
|
||||
my.showToast({ content: "定位超时,请重试[" + e.error + "]" });
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 字段数据校验
|
||||
* data 待校验的数据, 一维json对象
|
||||
* validation 待校验的字段, 格式 [{fields: 'mobile', msg: '请填写手机号码'}, ...]
|
||||
*/
|
||||
fields_check(data, validation) {
|
||||
for (var i in validation) {
|
||||
var temp_value = data[validation[i]["fields"]];
|
||||
var temp_is_can_zero = validation[i]["is_can_zero"] || null;
|
||||
|
||||
if ((temp_value == undefined || temp_value.length == 0 || temp_value == -1) || (temp_is_can_zero == null && temp_value == 0)
|
||||
) {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: validation[i]["msg"]
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取当前时间戳
|
||||
*/
|
||||
get_timestamp() {
|
||||
return parseInt(new Date().getTime() / 1000);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日期
|
||||
* format 日期格式(默认 yyyy-MM-dd h:m:s)
|
||||
* timestamp 时间戳(默认当前时间戳)
|
||||
*/
|
||||
get_date(format, timestamp) {
|
||||
var d = new Date((timestamp || this.get_timestamp()) * 1000);
|
||||
var date = {
|
||||
"M+": d.getMonth() + 1,
|
||||
"d+": d.getDate(),
|
||||
"h+": d.getHours(),
|
||||
"m+": d.getMinutes(),
|
||||
"s+": d.getSeconds(),
|
||||
"q+": Math.floor((d.getMonth() + 3) / 3),
|
||||
"S+": d.getMilliseconds()
|
||||
};
|
||||
if (/(y+)/i.test(format)) {
|
||||
format = format.replace(
|
||||
RegExp.$1,
|
||||
(d.getFullYear() + "").substr(4 - RegExp.$1.length)
|
||||
);
|
||||
}
|
||||
for (var k in date) {
|
||||
if (new RegExp("(" + k + ")").test(format)) {
|
||||
format = format.replace(
|
||||
RegExp.$1,
|
||||
RegExp.$1.length == 1
|
||||
? date[k]
|
||||
: ("00" + date[k]).substr(("" + date[k]).length)
|
||||
);
|
||||
}
|
||||
}
|
||||
return format;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取对象、数组的长度、元素个数
|
||||
* obj 要计算长度的元素(object、array、string)
|
||||
*/
|
||||
get_length(obj) {
|
||||
var obj_type = typeof obj;
|
||||
if (obj_type == "string") {
|
||||
return obj.length;
|
||||
} else if (obj_type == "object") {
|
||||
var obj_len = 0;
|
||||
for (var i in obj) {
|
||||
obj_len++;
|
||||
}
|
||||
return obj_len;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 价格保留两位小数
|
||||
* price 价格保留两位小数
|
||||
*/
|
||||
price_two_decimal(x) {
|
||||
var f_x = parseFloat(x);
|
||||
if (isNaN(f_x)) {
|
||||
return 0;
|
||||
}
|
||||
var f_x = Math.round(x * 100) / 100;
|
||||
var s_x = f_x.toString();
|
||||
var pos_decimal = s_x.indexOf(".");
|
||||
if (pos_decimal < 0) {
|
||||
pos_decimal = s_x.length;
|
||||
s_x += ".";
|
||||
}
|
||||
while (s_x.length <= pos_decimal + 2) {
|
||||
s_x += "0";
|
||||
}
|
||||
return s_x;
|
||||
}
|
||||
});
|
52
alipay/app.json
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/user/user",
|
||||
"pages/web-view/web-view",
|
||||
"pages/login/login",
|
||||
"pages/paytips/paytips",
|
||||
|
||||
"pages/goods-search/goods-search",
|
||||
"pages/goods-detail/goods-detail",
|
||||
"pages/goods-attribute/goods-attribute",
|
||||
"pages/buy/buy",
|
||||
|
||||
"pages/user-address/user-address",
|
||||
"pages/user-address-save/user-address-save",
|
||||
"pages/user-order/user-order",
|
||||
"pages/user-order-detail/user-order-detail",
|
||||
"pages/user-faovr/user-faovr",
|
||||
"pages/user-answer-list/user-answer-list",
|
||||
"pages/answer-list/answer-list",
|
||||
"pages/answer-form/answer-form"
|
||||
],
|
||||
"window": {
|
||||
"defaultTitle": "伯缘家政",
|
||||
"titleBarColor": "#ff6482"
|
||||
},
|
||||
"tabBar": {
|
||||
"textColor": "#8a8a8a",
|
||||
"selectedColor": "#ff6482",
|
||||
"backgroundColor": "#fff",
|
||||
"items": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"icon": "/images/nav-icon-home.png",
|
||||
"activeIcon": "/images/nav-icon-home-active.png",
|
||||
"name": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/answer-list/answer-list",
|
||||
"icon": "/images/nav-icon-answer.png",
|
||||
"activeIcon": "/images/nav-icon-answer-active.png",
|
||||
"name": "问答"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/user",
|
||||
"icon": "/images/nav-icon-user.png",
|
||||
"activeIcon": "/images/nav-icon-user-active.png",
|
||||
"name": "我的"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
BIN
alipay/images/address-select-active-icon.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
alipay/images/address-select-icon.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
alipay/images/buy-address-divider.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
alipay/images/choice.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
alipay/images/customer-service-icon.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
alipay/images/customer-service.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
alipay/images/default-round-error-icon.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
alipay/images/default-round-success-icon.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
alipay/images/default-user.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
alipay/images/empty.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
alipay/images/error.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
alipay/images/goods-detail-favor-icon-0.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
alipay/images/goods-detail-favor-icon-1.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
alipay/images/goods-detail-home-icon.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
alipay/images/goods-detail-share-icon.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
alipay/images/goods-detail-shop-icon.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
alipay/images/home-banner.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
alipay/images/home-consulting-image.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
alipay/images/nav-icon-answer-active.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
alipay/images/nav-icon-answer.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
alipay/images/nav-icon-home-active.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
alipay/images/nav-icon-home.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
alipay/images/nav-icon-user-active.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
alipay/images/nav-icon-user.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
alipay/images/tips.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
alipay/images/upload.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
alipay/images/user-address.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
alipay/images/user-nav-address-icon.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
alipay/images/user-nav-answer-icon.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
alipay/images/user-nav-booking-order-icon.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
alipay/images/user-nav-cache-icon.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
alipay/images/user-nav-customer-service-icon.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
alipay/images/user-nav-faovr-icon.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
21
alipay/pages/answer-form/answer-form.acss
Normal file
@ -0,0 +1,21 @@
|
||||
.content{
|
||||
padding: 10rpx;
|
||||
}
|
||||
.content-textarea {
|
||||
padding-top: 10rpx;
|
||||
min-height: 20vh;
|
||||
}
|
||||
.bottom-btn-box {
|
||||
margin-top: 160rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.form-input input, .form-input textarea {
|
||||
font-size: 30rpx;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
15
alipay/pages/answer-form/answer-form.axml
Normal file
@ -0,0 +1,15 @@
|
||||
<form onSubmit="formSubmit">
|
||||
<view class="form-input bg-white spacing-mb">
|
||||
<input type="text" class="wh-auto" name="name" placeholder="联系人" maxlength="30" />
|
||||
</view>
|
||||
<view class="form-input bg-white spacing-mb">
|
||||
<input type="number" class="wh-auto" name="tel" placeholder="联系电话" maxlength="15" />
|
||||
</view>
|
||||
<view class="form-input bg-white spacing-mb">
|
||||
<textarea name="content" class="content-textarea" maxlength="160" placeholder="请详细描述问题,我们将尽快为您解答!" />
|
||||
</view>
|
||||
|
||||
<view class="bottom-btn-box fixed">
|
||||
<button type="default" formType="submit" class="my-btn-default" hover-class="none" onTap="submit_event" loading="{{form_submit_loading}}" disabled="{{form_submit_loading}}">提交</button>
|
||||
</view>
|
||||
</form>
|
87
alipay/pages/answer-form/answer-form.js
Normal file
@ -0,0 +1,87 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
form_submit_loading: false,
|
||||
},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.answer_form});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.GetUserInfo(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
formSubmit(e)
|
||||
{
|
||||
// 数据验证
|
||||
var validation = [
|
||||
{fields: 'name', msg: '请填写联系人'},
|
||||
{fields: 'tel', msg: '请填写联系电话'},
|
||||
{fields: 'content', msg: '请填写内容'}
|
||||
];
|
||||
if(app.fields_check(e.detail.value, validation))
|
||||
{
|
||||
my.showLoading({content: '提交中...'});
|
||||
this.setData({form_submit_loading: true});
|
||||
|
||||
// 网络请求
|
||||
my.httpRequest({
|
||||
url: app.get_request_url('Add', 'Answer'),
|
||||
method: 'POST',
|
||||
data: e.detail.value,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
my.hideLoading();
|
||||
|
||||
if(res.data.code == 0)
|
||||
{
|
||||
my.showToast({
|
||||
type: 'success',
|
||||
content: res.data.msg
|
||||
});
|
||||
setTimeout(function()
|
||||
{
|
||||
my.redirectTo({
|
||||
url: "/pages/user-answer-list/user-answer-list"
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
this.setData({form_submit_loading: false});
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
this.setData({form_submit_loading: false});
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: '服务器请求出错'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/answer-form/answer-form.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": false
|
||||
}
|
22
alipay/pages/answer-list/answer-list.acss
Normal file
@ -0,0 +1,22 @@
|
||||
.item {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.item .base, .item .content, .item .answer {
|
||||
padding: 15rpx 0;
|
||||
}
|
||||
.item .base .desc {
|
||||
width: calc(100% - 130rpx);
|
||||
}
|
||||
.item .base .avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.item .answer .reply-icon {
|
||||
border-radius: 5px;
|
||||
padding: 0px 3px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.item .answer .reply-content, .item .base .desc {
|
||||
line-height: 42rpx;
|
||||
}
|
22
alipay/pages/answer-list/answer-list.axml
Normal file
@ -0,0 +1,22 @@
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" onScrollToLower="scroll_lower" lower-threshold="30">
|
||||
<view class="item bg-white spacing-mb" a:if="{{data_list.length > 0}}" a:for="{{data_list}}">
|
||||
<view class="base">
|
||||
<view class="oh">
|
||||
<image class="avatar fl" src="{{item.avatar}}" mode="widthFix" data-index="{{index}}" onError="user_avatar_error" />
|
||||
<view class="desc fr tl">{{item.content}}</view>
|
||||
</view>
|
||||
<view class="cr-888 tr">{{item.add_time}}</view>
|
||||
</view>
|
||||
<view a:if="{{(item.reply || null) != null}}" class="answer br-t">
|
||||
<text class="reply-icon bg-main cr-fff">答</text>
|
||||
<text class="reply-content cr-888">{{item.reply}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view a:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</scroll-view>
|
124
alipay/pages/answer-list/answer-list.js
Normal file
@ -0,0 +1,124 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.answer_list});
|
||||
},
|
||||
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Common", "Answer"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total)
|
||||
{
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({data_bottom_line_status: false});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({ data_page: 1 });
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 头像加载错误
|
||||
user_avatar_error(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_data_list = this.data_list;
|
||||
for(var i in temp_data_list)
|
||||
{
|
||||
if(i == index)
|
||||
{
|
||||
temp_data_list[i]['avatar'] = app.data.default_user_head_src
|
||||
}
|
||||
}
|
||||
this.setData({data_list: temp_data_list});
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/answer-list/answer-list.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
73
alipay/pages/buy/buy.acss
Normal file
@ -0,0 +1,73 @@
|
||||
.address {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.address-base, .address-detail {
|
||||
padding: 10rpx 35rpx 10rpx 10rpx;
|
||||
}
|
||||
.address-detail .icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-detail .text {
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.address-divider {
|
||||
height: 4px;
|
||||
background-image: url("/images/buy-address-divider.png");
|
||||
background-repeat-y: no-repeat;
|
||||
}
|
||||
.address-detail .text, .goods-title {
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.no-address {
|
||||
height: 85rpx;
|
||||
line-height: 85rpx;
|
||||
}
|
||||
|
||||
.goods .goods-item:not(:last-child) {
|
||||
border-bottom: 1px dashed #efefef;
|
||||
}
|
||||
.goods-item {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.goods-title, .goods-attribute {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.goods-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.goods-price {
|
||||
position: relative;
|
||||
}
|
||||
.buy-number {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.buy-nav {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.buy-nav, .nav-base, .nav-submit button {
|
||||
height: 100rpx;
|
||||
}
|
||||
.nav-base, .nav-submit button {
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.nav-base {
|
||||
width: calc(60% - 20rpx);
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.nav-submit {
|
||||
width: 40%;
|
||||
}
|
||||
.nav-submit button {
|
||||
border-radius: 0;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
52
alipay/pages/buy/buy.axml
Normal file
@ -0,0 +1,52 @@
|
||||
<view a:if="{{goods.length > 0}}" class="page">
|
||||
<view class="address bg-white arrow-right">
|
||||
<navigator url="/pages/user-address/user-address?is_back=1" hover-class="none">
|
||||
<view a:if="{{address != null}}">
|
||||
<view class="address-base oh">
|
||||
<text>{{address.name}}</text>
|
||||
<text class="fr">{{address.tel}}</text>
|
||||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name}}{{address.city_name}}{{address.county_name}}{{address.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view a:if="{{address == null}}" class="no-address cr-888">
|
||||
请选择地址
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="address-divider spacing-mb"></view>
|
||||
|
||||
<view class="goods bg-white spacing-mb">
|
||||
<view a:for="{{goods}}" class="goods-item oh">
|
||||
<image class="goods-image fl" src="{{item.images_url}}" mode="aspectFill" />
|
||||
<view class="goods-base">
|
||||
<view class="goods-title multi-text">{{item.title}}</view>
|
||||
<view class="goods-attribute cr-888">{{item.attribute}}</view>
|
||||
<view class="oh goods-price">
|
||||
<text class="sales-price">¥{{item.price}}</text>
|
||||
<text a:if="{{item.original_price > 0}}" class="original-price">¥{{item.original_price}}</text>
|
||||
<text class="buy-number">x{{item.buy_number}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<textarea onInput="bind_user_note_event" maxlength="60" auto-height placeholder="留言" />
|
||||
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">¥{{total_price}}</text>
|
||||
</view>
|
||||
<view class="fr nav-submit">
|
||||
<button class="bg-main wh-auto" type="default" onTap="buy_submit_event" disabled="{{buy_submit_disabled_status}}" hover-class="none">提交订单</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view a:if="{{goods.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
195
alipay/pages/buy/buy.js
Normal file
@ -0,0 +1,195 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
buy_submit_disabled_status: false,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
goods: [],
|
||||
address: null,
|
||||
is_first: 1,
|
||||
address_id: 0,
|
||||
total_price: 0,
|
||||
user_note_value: '',
|
||||
},
|
||||
onLoad(params) {
|
||||
if((params.data || null) == null || app.get_length(JSON.parse(params.data)) == 0)
|
||||
{
|
||||
my.alert({
|
||||
title: '温馨提示',
|
||||
content: '商品信息有误',
|
||||
buttonText: '确认',
|
||||
success: () => {
|
||||
my.navigateBack();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.setData({params: params.data});
|
||||
|
||||
// 删除地址缓存
|
||||
my.removeStorageSync({key: app.data.cache_buy_user_address_select_key});
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.buy});
|
||||
this.init();
|
||||
this.setData({is_first: 0});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
init() {
|
||||
// 本地缓存地址
|
||||
if(this.data.is_first == 0)
|
||||
{
|
||||
var cache_address = my.getStorageSync({
|
||||
key: app.data.cache_buy_user_address_select_key
|
||||
});
|
||||
if((cache_address.data || null) != null)
|
||||
{
|
||||
this.setData({
|
||||
address: cache_address.data,
|
||||
address_id: cache_address.data.id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var self = this;
|
||||
// 加载loding
|
||||
my.showLoading({content: '加载中...'});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "Buy"),
|
||||
method: "POST",
|
||||
data: {goods: this.data.params, address_id: this.data.address_id},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if(data.goods.length == 0)
|
||||
{
|
||||
self.setData({data_list_loding_status: 0});
|
||||
} else {
|
||||
self.setData({
|
||||
goods: data.goods,
|
||||
total_price: data.total_price,
|
||||
address: data.address,
|
||||
address_id: ((data.address || null) == null) ? 0 : data.address.id,
|
||||
data_list_loding_status: 3,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 用户留言事件
|
||||
bind_user_note_event(e) {
|
||||
this.setData({user_note_value: e.detail.value});
|
||||
},
|
||||
|
||||
// 提交订单
|
||||
buy_submit_event(e) {
|
||||
if((this.data.address_id || 0) == 0)
|
||||
{
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "请选择地址"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
var self = this;
|
||||
// 加载loding
|
||||
my.showLoading({content: '提交中...'});
|
||||
this.setData({
|
||||
buy_submit_disabled_status: true,
|
||||
});
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Submit", "Buy"),
|
||||
method: "POST",
|
||||
data: {
|
||||
goods: this.data.params,
|
||||
address_id: this.data.address_id,
|
||||
user_note: this.data.user_note_value,
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if(data.status == 1)
|
||||
{
|
||||
my.confirm({
|
||||
title: '',
|
||||
content: res.data.msg,
|
||||
confirmButtonText: '立即支付',
|
||||
cancelButtonText: '进入订单',
|
||||
success: (result) => {
|
||||
self.setData({buy_submit_disabled_status: false});
|
||||
var is_pay = (result.confirm) ? 1 : 0;
|
||||
my.redirectTo({
|
||||
url: '/pages/user-order/user-order?is_pay='+is_pay+'&order_id='+res.data.data.id
|
||||
});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "success",
|
||||
content: res.data.msg
|
||||
});
|
||||
setTimeout(function()
|
||||
{
|
||||
self.setData({buy_submit_disabled_status: false});
|
||||
my.redirectTo({
|
||||
url: '/pages/user-order/user-order'
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
self.setData({buy_submit_disabled_status: false});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
self.setData({buy_submit_disabled_status: false});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/buy/buy.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": false
|
||||
}
|
7
alipay/pages/common/bottom_line.axml
Normal file
@ -0,0 +1,7 @@
|
||||
<template name="bottom_line">
|
||||
<view a:if="{{(status || false)}}" class="data-bottom-line">
|
||||
<view class="left fl"></view>
|
||||
<view class="msg fl">我是有底线的</view>
|
||||
<view class="right fr"></view>
|
||||
</view>
|
||||
</template>
|
18
alipay/pages/common/nodata.axml
Normal file
@ -0,0 +1,18 @@
|
||||
<template name="nodata">
|
||||
<!-- 1 加载中 -->
|
||||
<view a:if="{{status == 1}}" class="no-data-loding tc">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 2 处理错误 -->
|
||||
<view a:elif="{{status == 2}}" class="no-data-box tc">
|
||||
<image src="/images/error.png" mode="widthFix" />
|
||||
<view class="no-data-tips">{{msg || '处理错误'}}</view>
|
||||
</view>
|
||||
|
||||
<!-- 0 默认没有数据 -->
|
||||
<view a:elif="{{status == 0}}" class="no-data-box tc">
|
||||
<image src="/images/empty.png" mode="widthFix" />
|
||||
<view class="no-data-tips">{{msg || '这里人迹罕至,什么都没有'}}</view>
|
||||
</view>
|
||||
</template>
|
16
alipay/pages/goods-attribute/goods-attribute.acss
Normal file
@ -0,0 +1,16 @@
|
||||
.goods-attribute {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.goods-attribute .item {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.goods-attribute .item .title {
|
||||
width: 25%;
|
||||
}
|
||||
.goods-attribute .item .content {
|
||||
width: calc(75% - 30rpx);
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.goods-attribute .item view {
|
||||
line-height: 46rpx;
|
||||
}
|
17
alipay/pages/goods-attribute/goods-attribute.axml
Normal file
@ -0,0 +1,17 @@
|
||||
<view a:if="{{goods_attribute.length > 0}}" class="goods-attribute bg-white">
|
||||
<view a:for="{{goods_attribute}}" class="item br-b oh">
|
||||
<view class="title fl br-r">{{item.name}}</view>
|
||||
<view class="content cr-888 fl">
|
||||
<text a:for="{{item.find}}" a:for-index="keys" a:for-item="items">
|
||||
<text>{{items.name}}</text>
|
||||
<text a:if="{{keys < item.find.length-1}}"> , </text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="nav-back tc wh-auto">
|
||||
<navigator open-type="navigateBack" hover-class="none">
|
||||
<button type="default" size="mini" class="cr-888" hover-class="none">返回</button>
|
||||
</navigator>
|
||||
</view>
|
25
alipay/pages/goods-attribute/goods-attribute.js
Normal file
@ -0,0 +1,25 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
goods_attribute: [],
|
||||
},
|
||||
onLoad(params) {
|
||||
if((params.data || null) == null)
|
||||
{
|
||||
my.alert({
|
||||
title: '温馨提示',
|
||||
content: '属性数据有误',
|
||||
buttonText: '返回',
|
||||
success: () => {
|
||||
my.navigateBack();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.setData({goods_attribute: JSON.parse(params.data)});
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.goods_attribute});
|
||||
},
|
||||
});
|
3
alipay/pages/goods-attribute/goods-attribute.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": false
|
||||
}
|
157
alipay/pages/goods-detail/goods-detail.acss
Normal file
@ -0,0 +1,157 @@
|
||||
.goods-photo .swiper-item {
|
||||
height: 65vh !important;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.goods-attr-show-title {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.goods-popup {
|
||||
background: rgba(0, 0, 0, 0.3803921568627451);
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
.goods-popup-choose {
|
||||
width: calc(100% - 20rpx);
|
||||
padding: 20rpx 10rpx;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.goods-popup .close {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.goods-popup-content {
|
||||
max-height: 50vh;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.goods-popup-content,
|
||||
.goods-popup-submit
|
||||
{
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.goods-attr-choose .item {
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
.goods-popup-content .title {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.goods-attr-choose .item .attribute button {
|
||||
margin-top: 20rpx;
|
||||
margin-right: 25rpx;
|
||||
}
|
||||
.goods-attr-choose .item .attribute button {
|
||||
padding: 0 30rpx;
|
||||
background: #eee;
|
||||
color: #666;
|
||||
line-height: 28px;
|
||||
height: 27px;
|
||||
}
|
||||
.goods-attr-choose .item .attribute button,
|
||||
.goods-popup-submit
|
||||
{
|
||||
border-radius: 50rpx;
|
||||
border: 0;
|
||||
}
|
||||
.goods-popup-submit {
|
||||
height: 85rpx;
|
||||
line-height: 85rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.goods-popup .goods-buy-number {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.goods-popup .goods-buy-number .title {
|
||||
line-height: 60rpx;
|
||||
}
|
||||
.goods-popup .number-content button
|
||||
{
|
||||
background: #eee;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
font-weight: bold;
|
||||
color: #666;
|
||||
}
|
||||
.goods-popup .number-content {
|
||||
width: calc(100% - 200rpx);
|
||||
}
|
||||
.goods-popup .number-content input {
|
||||
width: 50px;
|
||||
margin: 2rpx 10rpx 0 10rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.goods-popup .number-content button,
|
||||
.goods-popup .number-content input
|
||||
{
|
||||
border: 1px solid #ddd;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.goods-detail-app .content-items view {
|
||||
padding: 15rpx 10rpx;
|
||||
line-height: 44rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.goods-buy-nav {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 100rpx;
|
||||
}
|
||||
.goods-buy-nav .fl {
|
||||
width: calc(25% - 1rpx);
|
||||
}
|
||||
.goods-buy-nav .fr {
|
||||
width: 50%;
|
||||
}
|
||||
.goods-buy-nav .fr button {
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.goods-buy-nav .fr button,
|
||||
.goods-buy-nav .fl
|
||||
{
|
||||
height: 100rpx;
|
||||
}
|
||||
.goods-buy-nav .collect { border-left: 1px solid #e1e1e1; }
|
||||
.goods-buy-nav .fl image { width: 25px; height: 25px; margin: 0 auto; }
|
||||
|
||||
.goods-base {
|
||||
padding: 15rpx 10rpx;
|
||||
}
|
||||
.goods-base .goods-price .fr {
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.goods-base .goods-title {
|
||||
width: calc(100% - 100rpx);
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.goods-base .goods-share image {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
.goods-base .goods-share button {
|
||||
height: auto;
|
||||
font-size: 26rpx;
|
||||
border: 0;
|
||||
min-width: initial;
|
||||
}
|
||||
.goods-base .goods-price {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 100rpx;
|
||||
}
|
118
alipay/pages/goods-detail/goods-detail.axml
Normal file
@ -0,0 +1,118 @@
|
||||
<view a:if="{{goods != null}}" class="page">
|
||||
<!-- 轮播图片 -->
|
||||
<swiper
|
||||
indicator-dots="{{indicator_dots}}"
|
||||
indicator-color="{{indicator_color}}"
|
||||
indicator-active-color="{{indicator_active_color}}"
|
||||
autoplay="{{autoplay}}"
|
||||
circular="{{circular}}"
|
||||
class="goods-photo bg-white"
|
||||
a:if="{{goods_photo.length > 0}}">
|
||||
<block a:for="{{goods_photo}}">
|
||||
<swiper-item>
|
||||
<image class="swiper-item wh-auto" onTap="goods_photo_view_event" data-index="{{index}}" src="{{item}}" mode="aspectFit" onTap="banner_event" />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
|
||||
<!-- 基础信息 -->
|
||||
<view class="goods-base bg-white">
|
||||
<view class="oh">
|
||||
<view class="goods-title fl multi-text" style="color:{{goods.title_color}}">{{goods.title}}</view>
|
||||
<view class="goods-share fr tc">
|
||||
<button type="default" size="mini" open-type="share" hover-class="none" onTap="defaultTap">
|
||||
<image src="/images/goods-detail-share-icon.png" mode="scaleToFill" class="dis-block" />
|
||||
<text class="dis-block cr-888">分享</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-price">
|
||||
<text class="sales-price">¥{{goods.price}}</text>
|
||||
<text a:if="{{goods.original_price > 0}}" class="original-price">¥{{goods.original_price}}</text>
|
||||
<!-- <view class="fr cr-ccc">
|
||||
<text>销量 {{goods.sales_count}}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 属性导航 -->
|
||||
<view a:if="{{goods_attribute_show.length > 0}}" class="spacing">
|
||||
<view class="goods-attr-show-title bg-white arrow-right cr-666" onTap="good_attribute_nav_event">
|
||||
属性
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品详情 -->
|
||||
<view a:if="{{goods_content_app.length > 0}}" class="goods-detail spacing">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="line"></text>
|
||||
<text class="text-wrapper">简历</text>
|
||||
</view>
|
||||
<view a:for="{{goods_content_app}}" class="goods-detail-app bg-white">
|
||||
<image a:if="{{(item.images || null) != null}}" onTap="goods_detail_images_view_event" data-value="{{item.images}}" class="wh-auto" src="{{item.images}}" mode="widthFix" />
|
||||
<view a:if="{{(item.content || null) != null}}" class="content-items">
|
||||
<view a:for="{{item.content}}" a:for-item="items">{{items}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底线 -->
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
|
||||
<!-- 底部操作 -->
|
||||
<view class="goods-buy-nav wh-auto bg-white">
|
||||
<view class="shop fl tc" onTap="shop_event">
|
||||
<image src="/images/goods-detail-home-icon.png" mode="scaleToFill" />
|
||||
<text class="dis-block cr-888">首页</text>
|
||||
</view>
|
||||
<view class="collect fl tc" onTap="goods_favor_event">
|
||||
<image src="{{goods_favor_icon}}" mode="scaleToFill" />
|
||||
<text class="dis-block cr-888">{{goods_favor_text}}</text>
|
||||
</view>
|
||||
<view class="fr">
|
||||
<button class="bg-main" type="default" onTap="buy_submit_event" hover-class="none">立即预约</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 弹层 -->
|
||||
<view class="goods-popup wh-auto {{popup_status}}" onTap="popup_close_event">
|
||||
<view class="goods-popup-choose bg-white" catchTap>
|
||||
<view class="close tr dis-block oh">
|
||||
<view class="fr" catchTap="popup_close_event">
|
||||
<icon type="clear" size="20" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-popup-content">
|
||||
<!-- 商品属性 -->
|
||||
<view a:if="{{goods_attribute_choose.length > 0}}" class="goods-attr-choose">
|
||||
<view a:for="{{goods_attribute_choose}}" a:for-index="key" a:if="{{item.type == 'choose'}}" class="item br-b">
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view a:if="{{item.find.length > 0}}" class="attribute">
|
||||
<block a:for="{{item.find}}" a:for-index="keys" a:for-item="items">
|
||||
<button a:if="{{temp_attribute_active[key] == keys}}" catchTap="goods_attribute_event" data-key="{{key}}" data-keys="{{keys}}" class="bg-active-main" type="default" size="mini" hover-class="none">{{items.name}}</button>
|
||||
<button a:else catchTap="goods_attribute_event" data-key="{{key}}" data-keys="{{keys}}" type="default" size="mini" hover-class="none">{{items.name}}</button>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 购买数量 -->
|
||||
<view class="goods-buy-number oh">
|
||||
<view class="title fl">购买数量</view>
|
||||
<view class="number-content fr tr">
|
||||
<button type="default" size="mini" catchTap="goods_buy_number_event" data-type="0" hover-class="none">﹣</button>
|
||||
<input onBlur="goods_buy_number_blur" class="tc cr-888" type="number" value="{{temp_buy_number}}" />
|
||||
<button type="default" size="mini" catchTap="goods_buy_number_event" data-type="1" hover-class="none">+</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="goods-popup-submit bg-main" type="default" catchTap="goods_buy_confirm_event" hover-class="none">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view a:if="{{goods == null}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
335
alipay/pages/goods-detail/goods-detail.js
Normal file
@ -0,0 +1,335 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
indicator_dots: false,
|
||||
indicator_color: 'rgba(0, 0, 0, .3)',
|
||||
indicator_active_color: '#e31c55',
|
||||
autoplay: true,
|
||||
circular: true,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
|
||||
goods: null,
|
||||
goods_photo: [],
|
||||
goods_attribute_show: [],
|
||||
goods_attribute_choose: [],
|
||||
goods_content_app: [],
|
||||
|
||||
popup_status: 'dis-none',
|
||||
goods_favor_text: '收藏',
|
||||
goods_favor_icon: '/images/goods-detail-favor-icon-0.png',
|
||||
temp_attribute_active: {},
|
||||
temp_buy_number: 1,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
//params['goods_id']=1;
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.goods_detail});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
init() {
|
||||
// 数据初始化
|
||||
this.setData({
|
||||
temp_attribute_active: {}
|
||||
});
|
||||
|
||||
// 参数校验
|
||||
if((this.data.params.goods_id || null) == null)
|
||||
{
|
||||
my.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '商品ID有误',
|
||||
});
|
||||
} else {
|
||||
var self = this;
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({content: '加载中...'});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Detail", "Goods"),
|
||||
method: "POST",
|
||||
data: {goods_id: this.data.params.goods_id},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.stopPullDownRefresh();
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
goods: data.goods,
|
||||
indicator_dots: (data.photo.length > 1),
|
||||
autoplay: (data.photo.length > 1),
|
||||
goods_photo: data.photo,
|
||||
goods_attribute_show: data.attribute.show || [],
|
||||
goods_attribute_choose: data.attribute.choose || [],
|
||||
goods_content_app: data.content_app,
|
||||
temp_buy_number: (data.goods.buy_min_number) || 1,
|
||||
goods_favor_text: (data.goods.is_favor == 1) ? '已收藏' : '收藏',
|
||||
goods_favor_icon: '/images/goods-detail-favor-icon-'+data.goods.is_favor+'.png',
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_status: 3,
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.stopPullDownRefresh();
|
||||
my.hideLoading();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 进入商品属性事件
|
||||
good_attribute_nav_event(e) {
|
||||
my.navigateTo({
|
||||
url: "/pages/goods-attribute/goods-attribute?data="+JSON.stringify(this.data.goods_attribute_show)
|
||||
});
|
||||
},
|
||||
|
||||
// 弹层关闭
|
||||
popup_close_event(e) {
|
||||
this.setData({popup_status: 'dis-none'});
|
||||
},
|
||||
|
||||
// 进入店铺
|
||||
shop_event(e)
|
||||
{
|
||||
my.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
},
|
||||
|
||||
// 立即购买
|
||||
buy_submit_event(e) {
|
||||
this.setData({popup_status: ''});
|
||||
},
|
||||
|
||||
// 收藏事件
|
||||
goods_favor_event(e)
|
||||
{
|
||||
var user = app.GetUserInfo(this, 'goods_favor_event');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
var self = this;
|
||||
my.showLoading({content: '处理中...'});
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url('Favor', 'Goods'),
|
||||
method: 'POST',
|
||||
data: {goods_id: self.data.goods.id},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
my.hideLoading();
|
||||
if(res.data.code == 0)
|
||||
{
|
||||
var status = (self.data.goods.is_favor == 1) ? 0 : 1;
|
||||
this.setData({
|
||||
'goods.is_favor': status,
|
||||
goods_favor_text: (status == 1) ? '已收藏' : '收藏',
|
||||
goods_favor_icon: '/images/goods-detail-favor-icon-'+status+'.png'
|
||||
});
|
||||
my.showToast({
|
||||
type: 'success',
|
||||
content: res.data.msg
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: '服务器请求出错'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 属性事件
|
||||
goods_attribute_event(e) {
|
||||
var key = e.currentTarget.dataset.key || 0;
|
||||
var keys = e.currentTarget.dataset.keys || 0;
|
||||
var temp_data = this.data.temp_attribute_active;
|
||||
|
||||
// 相同则移除
|
||||
if(temp_data[key] == keys)
|
||||
{
|
||||
delete temp_data[key];
|
||||
} else {
|
||||
temp_data[key] = keys;
|
||||
}
|
||||
this.setData({temp_attribute_active: temp_data});
|
||||
},
|
||||
|
||||
// 数量输入事件
|
||||
goods_buy_number_blur(e) {
|
||||
var buy_number = parseInt(e.detail.value) || 1;
|
||||
this.setData({temp_buy_number: buy_number});
|
||||
this.goods_buy_number_func(buy_number);
|
||||
},
|
||||
|
||||
// 数量操作事件
|
||||
goods_buy_number_event(e) {
|
||||
var type = parseInt(e.currentTarget.dataset.type) || 0;
|
||||
var temp_buy_number = parseInt(this.data.temp_buy_number);
|
||||
if(type == 0)
|
||||
{
|
||||
var buy_number = temp_buy_number - 1;
|
||||
} else {
|
||||
var buy_number = temp_buy_number + 1;
|
||||
}
|
||||
this.goods_buy_number_func(buy_number);
|
||||
},
|
||||
|
||||
// 数量处理方法
|
||||
goods_buy_number_func(buy_number) {
|
||||
var buy_min_number = parseInt(this.data.goods.buy_min_number) || 1;
|
||||
var buy_max_number = parseInt(this.data.goods.buy_max_number) || 0;
|
||||
var inventory = parseInt(this.data.goods.inventory);
|
||||
var inventory_unit = this.data.goods.inventory_unit;
|
||||
if(buy_number < buy_min_number)
|
||||
{
|
||||
buy_number = buy_min_number;
|
||||
if(buy_min_number > 1)
|
||||
{
|
||||
my.showToast({content: '起购'+buy_min_number+inventory_unit});
|
||||
}
|
||||
}
|
||||
if(buy_max_number > 0 && buy_number > buy_max_number)
|
||||
{
|
||||
buy_number = buy_max_number;
|
||||
my.showToast({content: '限购'+buy_max_number+inventory_unit});
|
||||
}
|
||||
if(buy_number > inventory)
|
||||
{
|
||||
buy_number = inventory;
|
||||
my.showToast({content: '库存数量'+inventory+inventory_unit});
|
||||
}
|
||||
this.setData({temp_buy_number: buy_number});
|
||||
},
|
||||
|
||||
// 购买确认
|
||||
goods_buy_confirm_event(e) {
|
||||
var user = app.GetUserInfo(this, 'goods_buy_confirm_event');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 属性
|
||||
var goods_attribute_choose = this.data.goods_attribute_choose;
|
||||
var temp_attribute_active = this.data.temp_attribute_active;
|
||||
var attr_count = goods_attribute_choose.length;
|
||||
var attribute_all = [];
|
||||
if(attr_count > 0)
|
||||
{
|
||||
var attr_active_count = app.get_length(temp_attribute_active);
|
||||
if(attr_active_count < attr_count)
|
||||
{
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: '请选择属性'
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
for(var i in temp_attribute_active)
|
||||
{
|
||||
attribute_all.push(goods_attribute_choose[i]['id']+':'+goods_attribute_choose[i]['find'][temp_attribute_active[i]]['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 进入订单确认页面
|
||||
var data = [{
|
||||
"goods_id": this.data.goods.id,
|
||||
"buy_number": this.data.temp_buy_number,
|
||||
"attribute": attribute_all.join(',')
|
||||
}]
|
||||
my.navigateTo({
|
||||
url: '/pages/buy/buy?data='+JSON.stringify(data)
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 详情图片查看
|
||||
goods_detail_images_view_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if(value != null)
|
||||
{
|
||||
my.previewImage({
|
||||
current: 0,
|
||||
urls: [value]
|
||||
});
|
||||
}
|
||||
},
|
||||
// 商品相册图片查看
|
||||
goods_photo_view_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
my.previewImage({
|
||||
current: index,
|
||||
urls: this.data.goods_photo
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: app.data.application_title +'-'+ this.data.goods.title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-detail/goods-detail?share=goods-detail&goods_id='+this.data.goods.id
|
||||
};
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/goods-detail/goods-detail.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
28
alipay/pages/goods-search/goods-search.acss
Normal file
@ -0,0 +1,28 @@
|
||||
/* 商品列表 */
|
||||
.data-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
.data-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 200px !important;
|
||||
}
|
||||
.data-list .items .base {
|
||||
text-align: left;
|
||||
font-size: 32rpx;
|
||||
padding: 0 15rpx;
|
||||
}
|
||||
.data-list .items .base,
|
||||
.data-list .items .base .price {
|
||||
margin-top: 15rpx;
|
||||
}
|
25
alipay/pages/goods-search/goods-search.axml
Normal file
@ -0,0 +1,25 @@
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" onScrollToLower="scroll_lower" lower-threshold="30">
|
||||
<view class="data-list">
|
||||
<view class="items bg-white" a:for="{{data_list}}">
|
||||
<navigator url="/pages/goods-detail/goods-detail?goods_id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.images}}" mode="aspectFit" />
|
||||
<view class="base">
|
||||
<view class="single-text">{{item.title}}</view>
|
||||
<view class="price">
|
||||
<text class="sales-price">¥{{item.price}}</text>
|
||||
<text a:if="{{item.original_price > 0}}" class="original-price">¥{{item.original_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view a:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</scroll-view>
|
132
alipay/pages/goods-search/goods-search.js
Normal file
@ -0,0 +1,132 @@
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
params: null,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.goods_search});
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 搜索
|
||||
search_event() {
|
||||
this.setData({
|
||||
data_list: [],
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
var params = this.data.params;
|
||||
params['page'] = this.data.data_page;
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "GoodsSearch"),
|
||||
method: "POST",
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total)
|
||||
{
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({data_bottom_line_status: false});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
});
|
3
alipay/pages/goods-search/goods-search.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
27
alipay/pages/index/index.acss
Normal file
@ -0,0 +1,27 @@
|
||||
/* 轮播图片 */
|
||||
.banner {
|
||||
height: 320rpx!important;
|
||||
}
|
||||
|
||||
/* 商品分类 */
|
||||
.category-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
.category-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.category-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.category-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.category-list .items image {
|
||||
height: 200px !important;
|
||||
}
|
||||
.category-list .items .title {
|
||||
margin-top: 10rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
46
alipay/pages/index/index.axml
Normal file
@ -0,0 +1,46 @@
|
||||
<swiper
|
||||
indicator-dots="{{indicator_dots}}"
|
||||
indicator-color="{{indicator_color}}"
|
||||
indicator-active-color="{{indicator_active_color}}"
|
||||
autoplay="{{autoplay}}"
|
||||
circular="{{circular}}"
|
||||
class="banner bg-white spacing-mb"
|
||||
a:if="{{banner_list.length > 0}}">
|
||||
<block a:for="{{banner_list}}">
|
||||
<swiper-item>
|
||||
<image class="wh-auto" src="{{item.images_url}}" mode="widthFix" data-value="{{item.jump_url}}" data-type="{{item.jump_url_type}}" onTap="banner_event" />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
|
||||
<view a:if="{{category_list.length > 0}}">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="line"></text>
|
||||
<text class="text-wrapper">网上选人</text>
|
||||
</view>
|
||||
<view class="category-list">
|
||||
<view class="items bg-white" a:for="{{category_list}}">
|
||||
<navigator url="/pages/goods-search/goods-search?category_id={{item.id}}" hover-class="none">
|
||||
<image class="wh-auto" src="{{item.icon}}" mode="aspectFit" />
|
||||
<view class="title tc single-text">{{item.name}}</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view a:if="{{category_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
|
||||
<view a:if="{{load_status == 1}}" class="spacing-10">
|
||||
<navigator url="/pages/answer-form/answer-form" hover-class="none" class="bg-white">
|
||||
<image class="wh-auto" mode="widthFix" src="/images/home-consulting-image.jpg" />
|
||||
</navigator>
|
||||
</view>
|
||||
|
||||
<view a:if="{{load_status == 1}}" class="customer-service" onTap="call_event">
|
||||
<image src="/images/customer-service-icon.png" mode="scaleToFill" />
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
138
alipay/pages/index/index.js
Normal file
@ -0,0 +1,138 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
indicator_dots: false,
|
||||
indicator_color: 'rgba(0, 0, 0, .3)',
|
||||
indicator_active_color: '#e31c55',
|
||||
autoplay: true,
|
||||
circular: true,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
|
||||
banner_list: [],
|
||||
category_list: [],
|
||||
cart_count: 0,
|
||||
username: null,
|
||||
nickname: null,
|
||||
customer_service_tel: null,
|
||||
|
||||
load_status: 0,
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
init() {
|
||||
var self = this;
|
||||
|
||||
// 加载loding
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 加载loding
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "Index"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.stopPullDownRefresh();
|
||||
self.setData({load_status: 1});
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
banner_list: data.banner,
|
||||
indicator_dots: (data.banner.length > 1),
|
||||
autoplay: (data.banner.length > 1),
|
||||
category_list: data.category,
|
||||
cart_count: data.cart_count,
|
||||
username: data.username,
|
||||
nickname: data.nickname,
|
||||
customer_service_tel: data.customer_service_tel,
|
||||
data_list_loding_status: data.category.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: true,
|
||||
load_status: 1,
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 轮播图事件
|
||||
banner_event(e) {
|
||||
var value = e.target.dataset.value || null;
|
||||
var type = parseInt(e.target.dataset.type);
|
||||
if (value != null) {
|
||||
switch(type) {
|
||||
// web
|
||||
case 0 :
|
||||
my.navigateTo({url: '/pages/web-view/web-view?url='+value});
|
||||
break;
|
||||
|
||||
// 内部页面
|
||||
case 1 :
|
||||
my.navigateTo({url: value});
|
||||
break;
|
||||
|
||||
// 跳转到外部小程序
|
||||
case 2 :
|
||||
my.navigateToMiniProgram({appId: value});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 客服电话
|
||||
call_event() {
|
||||
if(this.data.customer_service_tel == null)
|
||||
{
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "客服电话有误"
|
||||
});
|
||||
} else {
|
||||
my.makePhoneCall({ number: this.data.customer_service_tel });
|
||||
}
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/index/index?share=index'
|
||||
};
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/index/index.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
49
alipay/pages/login/login.acss
Normal file
@ -0,0 +1,49 @@
|
||||
.a-input{
|
||||
padding: 0;
|
||||
}
|
||||
page{
|
||||
background: #fff;
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
}
|
||||
.content {
|
||||
padding: 30% 40rpx 0 40rpx;
|
||||
}
|
||||
.content .mobile{
|
||||
width: 100%;
|
||||
margin: 20rpx 0;
|
||||
border-bottom: solid 1rpx #a6a6a6;
|
||||
}
|
||||
.content input{
|
||||
font-size: 28rpx;
|
||||
color: #4e4e4e;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
.content .code{
|
||||
margin: 20rpx 0;
|
||||
border-bottom: solid 1rpx #a6a6a6;
|
||||
}
|
||||
.content .code .verify{
|
||||
width: 63%;
|
||||
}
|
||||
.content .code .verify-sub{
|
||||
border: solid 1rpx #ff6482;
|
||||
color: #ff6482;
|
||||
width: 35%;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.content .code .verify-sub.sub-disabled{
|
||||
border: solid 1rpx #a6a6a6;
|
||||
color: #a6a6a6
|
||||
}
|
||||
.content .submit{
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
right: 20rpx;
|
||||
bottom: 34rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
}
|
10
alipay/pages/login/login.axml
Normal file
@ -0,0 +1,10 @@
|
||||
<view class="content">
|
||||
<form onSubmit="formSubmit">
|
||||
<input type="number" placeholder="输入手机号码" maxlength="11" name="mobile" onInput="bind_key_input" class="mobile" />
|
||||
<view class="code clearfix">
|
||||
<input type="number" placeholder="验证码" maxlength="6" name="verify" class="verify" />
|
||||
<button type="default" hover-class="none" size="mini" loading="{{verify_loading}}" disabled="{{verify_disabled}}" onTap="verify_send" class="verify-sub fr {{verify_disabled ? 'sub-disabled' : ''}}">{{verify_submit_text}}</button>
|
||||
</view>
|
||||
<button type="default" formType="submit" hover-class="none" plain loading="{{form_submit_loading}}" disabled="{{form_submit_loading}}" class="submit {{form_submit_loading ? 'my-btn-gray' : 'my-btn-default'}}">确认绑定</button>
|
||||
</form>
|
||||
</view>
|
170
alipay/pages/login/login.js
Normal file
@ -0,0 +1,170 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
params: null,
|
||||
user: null,
|
||||
mobile: null,
|
||||
verify_submit_text: '获取验证码',
|
||||
verify_loading: false,
|
||||
verify_disabled: false,
|
||||
form_submit_loading: false,
|
||||
verify_time_total: 60,
|
||||
temp_clear_time: null,
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面加载初始化
|
||||
*/
|
||||
onLoad(option) {
|
||||
// 标题设置
|
||||
my.setNavigationBar({title: '手机绑定'});
|
||||
|
||||
// 设置用户信息
|
||||
this.setData({params: option, user: app.GetUserCacheInfo()});
|
||||
},
|
||||
|
||||
/**
|
||||
* 输入手机号码事件
|
||||
*/
|
||||
bind_key_input(e)
|
||||
{
|
||||
this.setData({mobile: e.detail.value});
|
||||
},
|
||||
|
||||
/**
|
||||
* 短信验证码发送
|
||||
*/
|
||||
verify_send()
|
||||
{
|
||||
// 数据验证
|
||||
var validation = [{fields: 'mobile', msg: '请填写手机号码'}];
|
||||
if(app.fields_check(this.data, validation))
|
||||
{
|
||||
// 网络请求
|
||||
var $this = this;
|
||||
my.showLoading({content: '发送中...'});
|
||||
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url('RegVerifySend', 'User'),
|
||||
method: 'POST',
|
||||
data: {mobile: this.data.mobile},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
my.hideLoading();
|
||||
if(res.data.code == 0)
|
||||
{
|
||||
this.setData({verify_loading: false});
|
||||
var temp_time = this.data.verify_time_total;
|
||||
this.data.temp_clear_time = setInterval(function()
|
||||
{
|
||||
if(temp_time <= 1)
|
||||
{
|
||||
clearInterval($this.data.temp_clear_time);
|
||||
$this.setData({verify_submit_text: '获取验证码', verify_disabled: false});
|
||||
} else {
|
||||
temp_time--;
|
||||
$this.setData({verify_submit_text: '剩余 '+temp_time+' 秒'});
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
this.setData({verify_submit_text: '获取验证码', verify_loading: false, verify_disabled: false});
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
this.setData({verify_submit_text: '获取验证码', verify_loading: false, verify_disabled: false});
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: '服务器请求出错'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
formSubmit(e)
|
||||
{
|
||||
// 数据验证
|
||||
var validation = [
|
||||
{fields: 'mobile', msg: '请填写手机号码'},
|
||||
{fields: 'verify', msg: '请填写验证码'},
|
||||
{fields: 'alipay_openid', msg: '授权id不能为空'}
|
||||
];
|
||||
e.detail.value['alipay_openid'] = this.data.user.alipay_openid;
|
||||
e.detail.value['nickname'] = this.data.user.nickname;
|
||||
e.detail.value['avatar'] = this.data.user.avatar;
|
||||
e.detail.value['province'] = this.data.user.province;
|
||||
e.detail.value['city'] = this.data.user.city;
|
||||
e.detail.value['gender'] = this.data.user.gender;
|
||||
e.detail.value['referrer'] = this.data.user.referrer;
|
||||
e.detail.value['app_type'] = 'alipay';
|
||||
if(app.fields_check(e.detail.value, validation))
|
||||
{
|
||||
my.showLoading({content: '处理中...'});
|
||||
this.setData({form_submit_loading: true});
|
||||
|
||||
// 网络请求
|
||||
my.httpRequest({
|
||||
url: app.get_request_url('Reg', 'User'),
|
||||
method: 'POST',
|
||||
data: e.detail.value,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
my.hideLoading();
|
||||
|
||||
if(res.data.code == 0 && (res.data.data || null) != null)
|
||||
{
|
||||
clearInterval(this.data.temp_clear_time);
|
||||
my.showToast({
|
||||
type: 'success',
|
||||
content: res.data.msg
|
||||
});
|
||||
|
||||
my.setStorage({
|
||||
key: app.data.cache_user_info_key,
|
||||
data: res.data.data
|
||||
});
|
||||
|
||||
var event_callback = this.data.params.event_callback || null;
|
||||
setTimeout(function()
|
||||
{
|
||||
// 触发回调函数
|
||||
if(event_callback != null)
|
||||
{
|
||||
getCurrentPages()[getCurrentPages().length-2][event_callback]();
|
||||
}
|
||||
my.navigateBack();
|
||||
}, 1000);
|
||||
} else {
|
||||
this.setData({form_submit_loading: false});
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
this.setData({form_submit_loading: false});
|
||||
|
||||
my.showToast({
|
||||
type: 'fail',
|
||||
content: '服务器请求出错'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
3
alipay/pages/login/login.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": false
|
||||
}
|
33
alipay/pages/paytips/paytips.acss
Normal file
@ -0,0 +1,33 @@
|
||||
page{
|
||||
background: #fff;
|
||||
}
|
||||
.content{
|
||||
padding-top: 15%;
|
||||
text-align: center;
|
||||
}
|
||||
.content .pay-img{
|
||||
display: block;
|
||||
width:500rpx;
|
||||
margin: 80rpx auto;
|
||||
}
|
||||
.content .pay-icon{
|
||||
display: block;
|
||||
width: 250rpx;
|
||||
margin: 60rpx auto;
|
||||
}
|
||||
|
||||
.btn-box{
|
||||
text-align: center;
|
||||
margin-top: 150rpx;
|
||||
}
|
||||
.btn-box button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
width: 300rpx;
|
||||
}
|
||||
.dis-block {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
.price-box {
|
||||
margin-top: 20rpx;
|
||||
}
|
18
alipay/pages/paytips/paytips.axml
Normal file
@ -0,0 +1,18 @@
|
||||
<view class="content">
|
||||
<image class="pay-icon" a:if="{{params.code == '9000'}}" mode="widthFix" src="{{default_round_success_icon}}" />
|
||||
<image class="pay-icon" a:else mode="widthFix" src="{{default_round_error_icon}}" />
|
||||
<text class="dis-block">{{params.msg}}</text>
|
||||
<view a:if="{{params.code == '9000'}}" class="price-box">
|
||||
<text class="sales-price">¥{{params.pay.total_amount}}</text>
|
||||
<text class="price-unit cr-888">元</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn-box">
|
||||
<navigator class="dy-wib" open-type="navigateBack">
|
||||
<button class="my-btn-default" type="default" hover-class="none" size="mini">返回</button>
|
||||
</navigator>
|
||||
<navigator a:if="{{(params.page || null) != null && (params.title || null) != null}}" class="dy-wib" url="/pages/{{params.page}}/{{params.page}}" open-type="redirect">
|
||||
<button class="my-btn-default" type="default" hover-class="none" size="mini">{{params.title}}</button>
|
||||
</navigator>
|
||||
</view>
|
60
alipay/pages/paytips/paytips.js
Normal file
@ -0,0 +1,60 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
params: {},
|
||||
default_round_success_icon: app.data.default_round_success_icon,
|
||||
default_round_error_icon: app.data.default_round_error_icon,
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面加载初始化
|
||||
*/
|
||||
onLoad(options)
|
||||
{
|
||||
var msg = null;
|
||||
switch(options.code)
|
||||
{
|
||||
// 支付成功
|
||||
case '9000' :
|
||||
msg = '支付成功';
|
||||
break;
|
||||
|
||||
// 正在处理中
|
||||
case '8000' :
|
||||
msg = '正在处理中';
|
||||
break;
|
||||
|
||||
// 支付失败
|
||||
case '4000' :
|
||||
msg = '支付失败';
|
||||
break;
|
||||
|
||||
// 用户中途取消
|
||||
case '6001' :
|
||||
msg = '已取消支付';
|
||||
break;
|
||||
|
||||
// 网络连接出错
|
||||
case '6002' :
|
||||
msg = '网络连接出错';
|
||||
break;
|
||||
|
||||
// 用户点击忘记密码导致快捷界面退出(only iOS)
|
||||
case '99' :
|
||||
msg = '支付异常错误';
|
||||
break;
|
||||
|
||||
// 默认错误
|
||||
default :
|
||||
msg = '其它异常错误';
|
||||
}
|
||||
options['msg'] = msg;
|
||||
|
||||
// 支付成功返回的信息
|
||||
var pay = ((options.result || null) == null) ? {} : JSON.parse(options.result);;
|
||||
options['pay'] = pay.alipay_trade_app_pay_response;
|
||||
|
||||
// 设置信息
|
||||
this.setData({params: options});
|
||||
}
|
||||
});
|
3
alipay/pages/paytips/paytips.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": false
|
||||
}
|
34
alipay/pages/user-address-save/user-address-save.acss
Normal file
@ -0,0 +1,34 @@
|
||||
/* 填写信息 */
|
||||
.person-box{
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.person-box input{
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.addressee .addressee-name{
|
||||
width: 250rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.addressee .addressee-phone{
|
||||
box-sizing: border-box;
|
||||
width: calc(100% - 250rpx);
|
||||
}
|
||||
/* 三级联动 */
|
||||
.select-address{
|
||||
box-sizing: border-box;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.select-address .section{
|
||||
width: 33%;
|
||||
box-sizing: border-box;
|
||||
padding: 0 5rpx;
|
||||
}
|
||||
/* end 三级联动 */
|
||||
.addressee-address{
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
32
alipay/pages/user-address-save/user-address-save.axml
Normal file
@ -0,0 +1,32 @@
|
||||
<form onSubmit="form_submit">
|
||||
<view class="person-box bg-white">
|
||||
<view class="addressee br-b oh">
|
||||
<input class="addressee-name fl br-r" name="name" type="text" value="{{name}}" placeholder="姓名" />
|
||||
<input class="addressee-phone fl" name="tel" type="number" value="{{tel}}" placeholder="手机号" />
|
||||
</view>
|
||||
|
||||
<!-- 地区选择 -->
|
||||
<view class="select-address br-b oh">
|
||||
<view class="section fl br-r">
|
||||
<picker name="province" onChange="select_province" value="{{province_value}}" range="{{province_list}}" range-key="name">
|
||||
<view class="name">{{province_list[province_value].name || default_province}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="section fl br-r">
|
||||
<picker name="city" onChange="select_city" value="{{city_value}}" range="{{city_list}}" range-key="name">
|
||||
<view class="name">{{city_list[city_value].name || default_city}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="section fl">
|
||||
<picker name="county" onChange="select_county" value="{{county_value}}" range="{{county_list}}" range-key="name">
|
||||
<view class="name">{{county_list[county_value].name || default_county}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<!-- end地区选择 -->
|
||||
|
||||
<input name="address" class="addressee-address" type="text" value="{{address}}" placeholder="详细地址" />
|
||||
</view>
|
||||
|
||||
<button class="submit-fixed submit-bottom" type="default" formType="submit" hover-class="none">保存</button>
|
||||
</form>
|
317
alipay/pages/user-address-save/user-address-save.js
Normal file
@ -0,0 +1,317 @@
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
province_list: [],
|
||||
city_list: [],
|
||||
county_list: [],
|
||||
|
||||
province_id: null,
|
||||
city_id: null,
|
||||
county_id: null,
|
||||
|
||||
default_province: "请选择省",
|
||||
default_city: "请选择市",
|
||||
default_county: "请选择区/县",
|
||||
|
||||
params: null,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if((this.data.params.address_id || null) == null)
|
||||
{
|
||||
var title = app.data.common_pages_title.user_address_save_add;
|
||||
} else {
|
||||
var title = app.data.common_pages_title.user_address_save_edit;
|
||||
}
|
||||
my.setNavigationBar({title: title});
|
||||
this.init();
|
||||
},
|
||||
|
||||
init() {
|
||||
var user = app.GetUserInfo(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取地址数据
|
||||
if((this.data.params.address_id || null) != null)
|
||||
{
|
||||
this.get_user_address();
|
||||
}
|
||||
|
||||
// 获取省
|
||||
this.get_province_list();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 获取用户地址
|
||||
get_user_address() {
|
||||
var self = this;
|
||||
// 加载loding
|
||||
my.showLoading({ content: "加载中..." });
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("GetDetail", "UserAddress"),
|
||||
method: "POST",
|
||||
data: self.data.params,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
name: data.name,
|
||||
tel: data.tel,
|
||||
address: data.address,
|
||||
province_id: data.province,
|
||||
city_id: data.city,
|
||||
county_id: data.county
|
||||
});
|
||||
|
||||
self.get_city_list();
|
||||
self.get_county_list();
|
||||
|
||||
setTimeout(function() {
|
||||
self.init_value();
|
||||
}, 500);
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 获取选择的省市区
|
||||
get_province_list() {
|
||||
var self = this;
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "Region"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
province_list: data
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
get_city_list() {
|
||||
var self = this;
|
||||
if (self.data.province_id) {
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "Region"),
|
||||
method: "POST",
|
||||
data: {
|
||||
pid: self.data.province_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
city_list: data
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
get_county_list() {
|
||||
var self = this;
|
||||
if (self.data.city_id) {
|
||||
// 加载loding
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "Region"),
|
||||
method: "POST",
|
||||
data: {
|
||||
pid: self.data.city_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
county_list: data
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
select_province(e) {
|
||||
var value = e.detail.value,
|
||||
data = this.data.province_list[value];
|
||||
this.setData({
|
||||
province_value: value,
|
||||
province_id: data.id,
|
||||
city_value: null,
|
||||
county_value: null,
|
||||
city_id: null,
|
||||
county_id: null
|
||||
});
|
||||
this.get_city_list();
|
||||
},
|
||||
|
||||
select_city(e) {
|
||||
var value = e.detail.value,
|
||||
data = this.data.city_list[value];
|
||||
this.setData({
|
||||
city_value: value,
|
||||
city_id: data.id,
|
||||
county_value: null,
|
||||
county_id: null
|
||||
});
|
||||
this.get_county_list();
|
||||
},
|
||||
|
||||
select_county(e) {
|
||||
var value = e.detail.value,
|
||||
data = this.data.county_list[value];
|
||||
this.setData({
|
||||
county_value: value,
|
||||
county_id: data.id
|
||||
});
|
||||
},
|
||||
|
||||
init_value() {
|
||||
var province_value = this.get_init_value("province_list", "province_id"),
|
||||
city_value = this.get_init_value("city_list", "city_id"),
|
||||
county_value = this.get_init_value("county_list", "county_id");
|
||||
this.setData({
|
||||
province_value: province_value,
|
||||
city_value: city_value,
|
||||
county_value: county_value
|
||||
});
|
||||
},
|
||||
|
||||
get_init_value(list, id) {
|
||||
var data = this.data[list],
|
||||
data_id = this.data[id],
|
||||
value;
|
||||
data.forEach((d, i) => {
|
||||
if (d.id == data_id) {
|
||||
value = i;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return value;
|
||||
},
|
||||
|
||||
form_submit(e) {
|
||||
var self = this,
|
||||
data = self.data;
|
||||
// 表单数据
|
||||
var form_data = e.detail.value;
|
||||
|
||||
// 数据校验
|
||||
var validation = [
|
||||
{ fields: "name", msg: "请填写姓名" },
|
||||
{ fields: "tel", msg: "请填写手机号" },
|
||||
{ fields: "province", msg: "请选择省份" },
|
||||
{ fields: "city", msg: "请选择城市" },
|
||||
{ fields: "county", msg: "请选择区县" },
|
||||
{ fields: "address", msg: "请填写详细地址" }
|
||||
];
|
||||
|
||||
form_data["province"] = data.province_id;
|
||||
form_data["city"] = data.city_id;
|
||||
form_data["county"] = data.county_id;
|
||||
form_data["address_id"] = self.data.params.address_id || 0;
|
||||
|
||||
if (app.fields_check(form_data, validation)) {
|
||||
// 加载loding
|
||||
my.showLoading({ content: "处理中..." });
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Edit", "UserAddress"),
|
||||
method: "POST",
|
||||
data: form_data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
my.showToast({
|
||||
type: "success",
|
||||
content: res.data.msg
|
||||
});
|
||||
setTimeout(function() {
|
||||
my.navigateBack();
|
||||
}, 1000);
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
3
alipay/pages/user-address-save/user-address-save.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": false
|
||||
}
|
29
alipay/pages/user-address/user-address.acss
Normal file
@ -0,0 +1,29 @@
|
||||
.item {
|
||||
padding: 10rpx 10rpx 0 10rpx;
|
||||
}
|
||||
.base, .address, .operation {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.address .item-icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address .text {
|
||||
line-height: 44rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.operation .default {
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
.operation .default .item-icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx !important;
|
||||
margin-right: 10rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.operation .delete-submit {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 85rpx;
|
||||
}
|
39
alipay/pages/user-address/user-address.axml
Normal file
@ -0,0 +1,39 @@
|
||||
<view class="page">
|
||||
<view a:if="{{data_list.length > 0}}">
|
||||
<view class="item bg-white spacing-mb" a:for="{{data_list}}">
|
||||
<view onTap="address_conent_event" data-index="{{index}}">
|
||||
<view class="base oh">
|
||||
<text>{{item.name}}</text>
|
||||
<text class="fr">{{item.tel}}</text>
|
||||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{item.province_name}}{{item.city_name}}{{item.county_name}}{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
<view class="default fl" onTap="address_default_event" data-value="{{item.id}}">
|
||||
<image a:if="{{is_default == item.id}}" class="item-icon" src="/images/address-select-active-icon.png" mode="widthFix" />
|
||||
<image a:else class="item-icon" src="/images/address-select-icon.png" mode="widthFix" />
|
||||
<text>设为默认地址</text>
|
||||
</view>
|
||||
<button class="fr cr-666 delete-submit" type="default" size="mini" onTap="address_delete_event" data-index="{{index}}" data-value="{{item.id}}" hover-class="none">删除</button>
|
||||
<navigator url="/pages/user-address-save/user-address-save?address_id={{item.id}}" open-type="navigate" hover-class="none">
|
||||
<button class="fr cr-666" type="default" size="mini" onTap="address_edit_event" hover-class="none">编辑</button>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view a:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
|
||||
<navigator url="/pages/user-address-save/user-address-save" open-type="navigate" hover-class="none">
|
||||
<button class="submit-fixed submit-bottom" type="default" hover-class="none">新增地址</button>
|
||||
</navigator>
|
||||
</view>
|
249
alipay/pages/user-address/user-address.js
Normal file
@ -0,0 +1,249 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
params: null,
|
||||
is_default: 0,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.user_address});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.GetUserInfo(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list() {
|
||||
// 加载loding
|
||||
my.showLoading({ content: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("GetList", "UserAddress"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.length > 0) {
|
||||
// 获取当前默认地址
|
||||
var is_default = 0;
|
||||
for(var i in res.data.data)
|
||||
{
|
||||
if(res.data.data[i]['is_default'] == 1)
|
||||
{
|
||||
is_default = res.data.data[i]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// 设置数据
|
||||
this.setData({
|
||||
data_list: res.data.data,
|
||||
is_default: is_default,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 删除地址
|
||||
address_delete_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if(value == null)
|
||||
{
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: '地址ID有误'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
my.confirm({
|
||||
title: "温馨提示",
|
||||
content: "删除后不可恢复,确定继续吗?",
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "不了",
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
// 加载loding
|
||||
my.showLoading({ content: "处理中..." });
|
||||
|
||||
// 获取数据
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Delete", "UserAddress"),
|
||||
method: "POST",
|
||||
data: {address_id: value},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0)
|
||||
{
|
||||
var temp_data = self.data.data_list;
|
||||
temp_data.splice(index, 1);
|
||||
self.setData({
|
||||
data_list: temp_data,
|
||||
data_list_loding_status: temp_data.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: temp_data.length == 0 ? false : true,
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "success",
|
||||
content: res.data.msg
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 默认地址设置
|
||||
address_default_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if(value == null)
|
||||
{
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: '地址ID有误'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
if(value == self.data.is_default)
|
||||
{
|
||||
my.showToast({
|
||||
type: "success",
|
||||
content: '设置成功'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "处理中..." });
|
||||
|
||||
// 获取数据
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("SetDefault", "UserAddress"),
|
||||
method: "POST",
|
||||
data: {address_id: value},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0)
|
||||
{
|
||||
self.setData({is_default: value});
|
||||
|
||||
my.showToast({
|
||||
type: "success",
|
||||
content: res.data.msg
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 地址内容事件
|
||||
address_conent_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var is_back = this.data.params.is_back || 0;
|
||||
if(is_back == 1)
|
||||
{
|
||||
my.setStorage({
|
||||
key: app.data.cache_buy_user_address_select_key,
|
||||
data: this.data.data_list[index]
|
||||
});
|
||||
my.navigateBack();
|
||||
}
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/user-address/user-address.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
22
alipay/pages/user-answer-list/user-answer-list.acss
Normal file
@ -0,0 +1,22 @@
|
||||
.item {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.item .base {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
.item .base .name {
|
||||
font-size: 28rpx;
|
||||
color: #4e4e4e;
|
||||
}
|
||||
.item .content, .item .answer {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.item .answer .reply-icon {
|
||||
border-radius: 5px;
|
||||
padding: 0px 3px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.item .answer .reply-content, .item .content .desc {
|
||||
line-height: 42rpx;
|
||||
}
|
22
alipay/pages/user-answer-list/user-answer-list.axml
Normal file
@ -0,0 +1,22 @@
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" onScrollToLower="scroll_lower" lower-threshold="30">
|
||||
<view class="item bg-white spacing-mb" a:if="{{data_list.length > 0}}" a:for="{{data_list}}">
|
||||
<view class="base br-b-dashed oh">
|
||||
<text class="name cr-666">{{item.name}}</text>
|
||||
<text class="time fr cr-888">{{item.add_time}}</text>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="desc">{{item.content}}</view>
|
||||
</view>
|
||||
<view a:if="{{(item.reply || null) != null}}" class="answer br-t">
|
||||
<text class="reply-icon bg-main cr-fff">答</text>
|
||||
<text class="reply-content cr-888">{{item.reply}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view a:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</scroll-view>
|
128
alipay/pages/user-answer-list/user-answer-list.js
Normal file
@ -0,0 +1,128 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false
|
||||
},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.user_answer_list});
|
||||
this.init();
|
||||
},
|
||||
|
||||
init() {
|
||||
var user = app.GetUserInfo(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "Answer"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total)
|
||||
{
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({data_bottom_line_status: false});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({ data_page: 1 });
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/user-answer-list/user-answer-list.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
27
alipay/pages/user-faovr/user-faovr.acss
Normal file
@ -0,0 +1,27 @@
|
||||
.goods-title {
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.goods-item {
|
||||
padding: 20rpx 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.goods-title {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.goods-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.item-base {
|
||||
padding: 25rpx 10rpx 20rpx 10rpx;
|
||||
}
|
||||
|
||||
.submit-cancel {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
bottom: 20rpx;
|
||||
border: 1px solid #f7c3b3;
|
||||
color: #f7c3b3;
|
||||
padding: 0 35rpx;
|
||||
}
|
23
alipay/pages/user-faovr/user-faovr.axml
Normal file
@ -0,0 +1,23 @@
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" onScrollToLower="scroll_lower" lower-threshold="30">
|
||||
<view class="list-item" a:if="{{data_list.length > 0}}">
|
||||
<view class="goods-item oh bg-white spacing-mb" a:for="{{data_list}}" a:for-item="item" >
|
||||
<navigator url="/pages/goods-detail/goods-detail?goods_id={{item.goods_id}}">
|
||||
<image class="goods-image fl" src="{{item.images}}" mode="aspectFill" />
|
||||
<view class="goods-base">
|
||||
<view class="goods-title multi-text">{{item.title}}</view>
|
||||
<view class="oh goods-price">
|
||||
<text class="sales-price">¥{{item.price}}</text>
|
||||
<text a:if="{{item.original_price > 0}}" class="original-price">¥{{item.original_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<button class="submit-cancel" type="default" size="mini" onTap="cancel_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">取消</button>
|
||||
</view>
|
||||
</view>
|
||||
<view a:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</scroll-view>
|
193
alipay/pages/user-faovr/user-faovr.js
Normal file
@ -0,0 +1,193 @@
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
params: null,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({params: params});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
my.setNavigationBar({title: app.data.common_pages_title.user_favor});
|
||||
this.init();
|
||||
},
|
||||
|
||||
init() {
|
||||
var user = app.GetUserInfo(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if ((user.mobile || null) == null) {
|
||||
my.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Index", "UserGoodsFavor"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total)
|
||||
{
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({data_bottom_line_status: false});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 取消
|
||||
cancel_event(e) {
|
||||
my.confirm({
|
||||
title: "温馨提示",
|
||||
content: "取消后不可恢复,确定继续吗?",
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "不了",
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
// 参数
|
||||
var id = e.target.dataset.value;
|
||||
var index = e.target.dataset.index;
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "处理中..." });
|
||||
|
||||
my.httpRequest({
|
||||
url: app.get_request_url("Cancel", "UserGoodsFavor"),
|
||||
method: "POST",
|
||||
data: {id: id},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data.data_list;
|
||||
temp_data_list.splice(index, 1);
|
||||
this.setData({data_list: temp_data_list});
|
||||
if(temp_data_list.length == 0)
|
||||
{
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
|
||||
my.showToast({
|
||||
type: "success",
|
||||
content: res.data.msg
|
||||
});
|
||||
} else {
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.hideLoading();
|
||||
my.showToast({
|
||||
type: "fail",
|
||||
content: "服务器请求出错"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
});
|
3
alipay/pages/user-faovr/user-faovr.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"pullRefresh": true
|
||||
}
|
65
alipay/pages/user-order-detail/user-order-detail.acss
Normal file
@ -0,0 +1,65 @@
|
||||
.address {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.address-base, .address-detail {
|
||||
padding: 10rpx 35rpx 10rpx 10rpx;
|
||||
}
|
||||
.address-detail .icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-detail .text {
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.address-divider {
|
||||
height: 4px;
|
||||
background-image: url("/images/buy-address-divider.png");
|
||||
background-repeat-y: no-repeat;
|
||||
}
|
||||
.address-detail .text, .goods-title {
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.no-address {
|
||||
height: 85rpx;
|
||||
line-height: 85rpx;
|
||||
}
|
||||
|
||||
.goods .goods-item:not(:last-child) {
|
||||
border-bottom: 1px dashed #efefef;
|
||||
}
|
||||
.goods-item {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.goods-title, .goods-attribute {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.goods-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.goods-price {
|
||||
position: relative;
|
||||
}
|
||||
.buy-number {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.detail-list {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.detail-list .item {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.detail-list .item .title {
|
||||
width: 25%;
|
||||
}
|
||||
.detail-list .item .content {
|
||||
width: calc(75% - 30rpx);
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.detail-list .item view {
|
||||
line-height: 46rpx;
|
||||
}
|