Commit 538e0f2c by DX666

Initial

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

APPID = wxbd88273b028bd83d
VUE_APP_BASE_API = https://service-dev.iyibianmin.com
VUE_APP_TRTC_SDKAPPID = 1400622723
VUE_APP_TRTC_SECRETKEY = 83fa43157002d2acca9dfeab263e0be4331099cdb6af156443754968bf16a5e6
\ No newline at end of file
APPID = wx5e4695edab747e8f
VUE_APP_BASE_API = https://service.iyibianmin.com
VUE_APP_TRTC_SDKAPPID = 1400622723
VUE_APP_TRTC_SECRETKEY = 83fa43157002d2acca9dfeab263e0be4331099cdb6af156443754968bf16a5e6
\ No newline at end of file
APPID = wxbd88273b028bd83d
VUE_APP_BASE_API = https://ybm-stress.thinkmacro.cn
VUE_APP_TRTC_SDKAPPID = 1400608993
VUE_APP_TRTC_SECRETKEY = 1e64e7ce9f398ab11926c2e78b968591f618242d05e810676198315f240b4efc
\ No newline at end of file
build/*.js
src/assets
public
dist
manifest.json
src/generateTestUserSig.js
src/lib-generate-test-usersig-es.min.js
src/tim-wx.js
src/trtc
mainWeixinMp/
\ No newline at end of file
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
globals: {
uni: true,
wx: true,
Component: true,
getApp: true,
App: true,
Page: true
},
rules: {
'vue/max-attributes-per-line': [
2,
{
singleline: 10,
multiline: {
max: 1,
allowFirstLine: false
}
}
],
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/name-property-casing': ['error', 'PascalCase'],
'vue/no-v-html': 'off',
'accessor-pairs': 2,
'arrow-spacing': [
2,
{
before: true,
after: true
}
],
'block-spacing': [2, 'always'],
'brace-style': [
2,
'1tbs',
{
allowSingleLine: true
}
],
camelcase: [
0,
{
properties: 'always'
}
],
'comma-dangle': [2, 'never'],
'comma-spacing': [
2,
{
before: false,
after: true
}
],
'comma-style': [2, 'last'],
'constructor-super': 2,
curly: [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
eqeqeq: ['error', 'always', { null: 'ignore' }],
'generator-star-spacing': [
2,
{
before: true,
after: true
}
],
'handle-callback-err': [2, '^(err|error)$'],
indent: [
2,
2,
{
SwitchCase: 1
}
],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [
2,
{
beforeColon: false,
afterColon: true
}
],
'keyword-spacing': [
2,
{
before: true,
after: true
}
],
'new-cap': [
2,
{
newIsCap: true,
capIsNew: false
}
],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 0,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [
2,
{
allowLoop: false,
allowSwitch: false
}
],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [
2,
{
max: 1
}
],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [
2,
{
defaultAssignment: false
}
],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [
2,
{
vars: 'all',
args: 'none'
}
],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [
2,
{
initialized: 'never'
}
],
'operator-linebreak': [
2,
'after',
{
overrides: {
'?': 'before',
':': 'before'
}
}
],
'padded-blocks': [2, 'never'],
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
semi: [2, 'never'],
'semi-spacing': [
2,
{
before: false,
after: true
}
],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [
2,
{
words: true,
nonwords: false
}
],
'spaced-comment': [
2,
'always',
{
markers: [
'global',
'globals',
'eslint',
'eslint-disable',
'*package',
'!',
','
]
}
],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
yoda: [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [
2,
'always',
{
objectsInObjects: true
}
],
'array-bracket-spacing': [2, 'never']
}
}
.DS_Store
node_modules/
unpackage/
dist/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
project.config.json
project.private.config.json
dist
# Editor directories and files
.project
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
{
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": true,
"jsxSingleQuote": true,
"printWidth": 80,
"proseWrap": "always",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"wrapAttributes": false,
"sortAttributes": false,
"endWithNewline": false
}
# uni-app 脚手架模板
## UI 框架
项目中使用的 UI 框架是uView,官网: https://www.uviewui.com/guide/demo.html
## 运行
1. 如果没有安装依赖,请先运行 `npm i``yarn` 安装依赖
2. 执行 `npm run dev:mp-{平台名}``yarn run dev:mp-{平台名}` 等命令执行完成后使用对应的模拟器打开 `{root}/dist/dev/mp-{平台名}` 目录进行预览
## 打包
- *暂时只支持微信小程序的上传*
1. 执行 `npm run build:mp-weixin:upload``yarn run build:mp-weixin:upload` 会将当前分支下的代码先打包后上传到微信后台
## 注意事项
1. 微信小程序需要在两个地方配置 appId ,分别是 `src/manifest.json``package.json`中的属性`buildConfig`中的`weixin`
2. 如果想修改微信小程序上传配置信息可以修改根目录下的 `weixin.upload.js` 文件,可用配置如下
<table><thead><tr><th></th> <th>类型</th> <th>必填</th> <th>说明</th></tr></thead> <tbody><td>version</td> <td>string</td> <td></td> <td>自定义版本号</td></tr> <tr><td>desc</td> <td>string</td> <td></td> <td>自定义备注</td></tr> <tr><td>setting</td> <td>object</td> <td></td> <td>#编译设置</td></tr> <tr><td>onProgressUpdate</td> <td>function</td> <td></td> <td>进度更新监听函数</td></tr> <tr><td>robot</td> <td>number</td> <td></td> <td>指定使用哪一个 ci 机器人,可选值:1 ~ 30</td></tr> <tr><td>threads</td> <td>number</td> <td></td> <td>指定本地编译过程中开启的线程数</td></tr></tbody></table>
\ No newline at end of file
const plugins = []
if (process.env.UNI_OPT_TREESHAKINGNG) {
plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
}
if (
(
process.env.UNI_PLATFORM === 'app-plus' &&
process.env.UNI_USING_V8
) ||
(
process.env.UNI_PLATFORM === 'h5' &&
process.env.UNI_H5_BROWSER === 'builtin'
)
) {
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const input = normalizePath(process.env.UNI_INPUT_DIR)
try {
plugins.push([
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
{
file (file) {
file = normalizePath(file)
if (file.indexOf(input) === 0) {
return path.relative(input, file)
}
return false
}
}
])
} catch (e) {}
}
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
process.UNI_LIBRARIES.forEach(libraryName => {
plugins.push([
'import',
{
'libraryName': libraryName,
'customName': (name) => {
return `${libraryName}/lib/${name}/${name}`
}
}
])
})
module.exports = {
presets: [
[
'@vue/app',
{
modules: 'commonjs',
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
}
]
],
plugins
}
module.exports = {
globalTeardown: '@dcloudio/uni-automator/dist/teardown.js',
testEnvironment: '@dcloudio/uni-automator/dist/environment.js',
testEnvironmentOptions: {},
testTimeout: 15000,
reporters: [
'default'
],
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
moduleFileExtensions: ['js', 'json'],
rootDir: __dirname,
testMatch: ['<rootDir>/src/**/*test.[jt]s?(x)'],
testPathIgnorePatterns: ['/node_modules/']
}
{
"compilerOptions": {
"types": ["@dcloudio/types", "miniprogram-api-typings", "mini-types"],
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/
.vscode
*-lock.json
analyzer/*
project.config.json
project.private.config.json
\ No newline at end of file
const app = getApp()
Component({
properties: {
navbarData: { //navbarData 由父页面传递的数据,变量名字自命名
type: Object,
value: {},
observer: function (newVal, oldVal) { }
}
},
data: {
height: '',
//默认值 默认显示左上角
navbarData: {
showCapsule: 1
}
},
attached: function () {
// 获取是否是通过分享进入的小程序
this.setData({
share: app.globalData.share
})
// 定义导航栏的高度 方便对齐
this.setData({
height: app.globalData.height
})
},
methods: {
// 返回上一页面
_navback() {
wx.navigateBack()
},
//返回到首页
_backhome() {
wx.reLaunch({
url: '/pages/lunch/lunch',
})
},
takepage(){
wx.reLaunch({
url: '/pages/lunch/lunch',
})
}
}
})
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<!-- <view class='nav-wrap' style='height: {{height*2 + 20}}px; background:{{navbarData.background}} '> -->
<view class='nav-wrap' style='height: {{height*2 + 20}}px '>
<image src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/activetop.png" class="topimg" style='height: {{height*2 + 20}}px '></image>
<!-- // 导航栏 中间的标题 -->
<view class="nav-title {{!navbarData.showCapsule?'topbg':''}}" style='line-height: {{height*2 + 44}}px;' >{{navbarData.title}}</view>
<!-- 导航栏的返回按钮 -->
<view class="nav-page" style='line-height: {{height*2 + 44}}px;' catchtap="takepage">
<image src="../../image/gopage.png" class="gopage" mode="widthFix"></image>
</view>
<view style='display: flex; justify-content: space-around;flex-direction: column'>
<!-- // 导航栏 左上角的返回按钮 和home按钮
// 其中wx:if='{{navbarData.showCapsule}}' 是控制左上角按钮的显示隐藏,首页不显示 -->
<view class='nav-capsule' style='height: {{height*2 + 44}}px;' wx:if='{{navbarData.showCapsule}}'>
<!-- //左上角的返回按钮,wx:if='{{!share}}'空制返回按钮显示
//从分享进入小程序时 返回上一级按钮不应该存在 -->
<view bindtap='_navback' wx:if='{{!share}}'>
<image src='https://ybm-public.oss-cn-beijing.aliyuncs.com/image/gopage.png' mode='aspectFill' class='back-pre'></image>
</view>
<view class='navbar-v-line' wx:if='{{!share}}'></view>
<view bindtap='_backhome'>
<image src='https://ybm-public.oss-cn-beijing.aliyuncs.com/image/gopage.png' mode='aspectFill' class='back-home'></image>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* 顶部要固定定位 标题要居中 自定义按钮和标题要和右边微信原生的胶囊上下对齐 */
.nav-wrap {
position: fixed;
width: 100%;
top: 0;
/* background: #f5f5f5; */
/* background-image: url('data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMgIyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT3/wgARCABYAu4DAREAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAAAAEFBv/EABgBAQEBAQEAAAAAAAAAAAAAAAABBQQH/9oADAMBAAIQAxAAAADuvLtwAAAAAAAAAAAAAAAAAAAAAAAARQBBaIKEVQlCC0QUWUJRRKEtEoS0ShFUqKFQW6OdyAAAAAAAAAAAAAAAAAAAAAAAARQBBaIKEFolBUUShFUJRYKWwEoS0ShFUJRVQWw0s7kAAAAAAAAAAAAAAAAAAAAAAAAigQWgSgBLRKAlolAsoSiygWUJQlolCWgS0SgqLpZ3IAAAAAAAAAAAAAAAAAAAAAAAAIoAgtAlCKoKgJRYKiqEoolCWiUJaJQLKEoqoF0c/kAAAAAAAAAAAAAAAAAAAAAAAAigCC0CUIqhKEFogosoSiiUJaJQlolCKoSiqgthpZ3IAAAAAAAAAAAAAAAAAAAAAAABFAEoogoRVCUBKLKBZQlFVAS0ShLRKEtAlFlBbDSzuQAAAAAAAAAAAAAAAAAAAAAAACKAJRRBQEtEoCWiUCyhKLBUVQlCWiUJaBLRKEtGlncgAAAAAAAAAAAAAAAAAAAAAAAAigCC0CUILRBQlFEosoQUWUJaJQloVAS0SiqgNHP5QAAAAAAAAAAAAAAAAAAAAAAAIoAgtAlCC0SgJaBKiqEoolCWiUJaJQLKEoqoLYaWdyAAAAAAAAAAAAAAAAAAAAAAAARQBLQJQihQlCUWCiygqBZQlolCWhUBLRKKqBZQ0s7kAAAAAAAAAAAAAAAAAAAAAAAAEUACWgShFUFQEosFFlASiyhLRKEtAlCWiUVUC//EABQQAQAAAAAAAAAAAAAAAAAAAKD/2gAIAQEAAT8AAV//xAAUEQEAAAAAAAAAAAAAAAAAAACg/9oACAECAQE/AAFf/8QAFBEBAAAAAAAAAAAAAAAAAAAAoP/aAAgBAwEBPwABX//Z'); */
color: #000;
z-index: 9999999;
}
.topimg{
width: 100%;
height: 100%;
}
.gopage{
width: 100%;
height: 100%;
}
/* 标题要居中 */
.nav-title {
position: absolute;
text-align: center;
max-width: 400rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
top: 0;
left: 0;
right: 100rpx;
bottom:20rpx;
margin: auto;
font-size: 30rpx;
color: #1e1e1e;
font-weight: bold;
/* font-weight: 600; */
}
.nav-page{
position: absolute;
/* text-align: center; */
max-width: 400rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
top: 16rpx;
left: 30rpx;
/* right: 0; */
bottom:20rpx;
margin: auto;
font-size: 30rpx;
color: #1e1e1e;
font-weight: bold;
}
.nav-page image{
width: 45rpx;
height: 45rpx;
}
.topbg{
/* background:url("http://youke.yiyawlkj.com/background/topbg.png") no-repeat center bottom; */
background-size:50% 50%;
}
.nav-capsule {
display: flex;
align-items: center;
margin-left: 30rpx;
width: 100rpx;
justify-content: space-between;
height: 100%;
}
.navbar-v-line {
width: 1px;
height: 32rpx;
background-color: #ccc;
}
.back-pre{
width:24rpx;
height: 30rpx;
margin-top: 4rpx;
/* padding: 10rpx; */
}
.back-home {
width: 30rpx;
height: 30rpx;
margin-top: 4rpx;
/* padding: 10rpx; */
}
/* .nav-capsule .back-home {
width: 30rpx;
height: 30rpx;
margin-top: 3rpx;
} */
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-17 10:37:48
* @LastEditors: HJ
* @LastEditTime: 2021-06-25 14:05:14
*/
import { fhGetAddressList } from "../../api/address/index";
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
customStyle: {
type: String,
value: "",
},
selectId: {
type: [Number, String],
value: null,
observer(id) {
this.setData({
currentId: id,
});
},
},
showRadio: {
type: Boolean,
value: true
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
// 收货地址列表
addressList: [],
// 加载中
loading: false,
// 当前选中的id
currentId: null,
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
// 获取所有收货地址
async getAddressList() {
this.setData({
loading: true,
});
try {
const { results } = await fhGetAddressList();
this.setData({
addressList: results,
});
} catch (e) {
console.log("debug axios", e);
}
this.setData({
loading: false,
});
},
// 跳转
nav({ currentTarget: { dataset } }) {
const { type = "add", info = "" } = dataset;
wx.$routerTo({
url: "/pages/address/manage/index",
query: {
type,
...info,
},
});
},
// 点击一个地址
clickItem({ currentTarget: { dataset } }) {
const { info } = dataset;
this.triggerEvent("change", info);
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
this.getAddressList();
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-icon": "@vant/weapp/icon/index",
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
"van-tag": "@vant/weapp/tag/index",
"van-button": "@vant/weapp/button/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"empty": "../empty/index"
}
}
.address-list-outer {
position: relative;
--cell-horizontal-padding: 0;
.scroll-view {
height: 100vh;
.list {
.item {
width: 100%;
.van-cell-text {
display: inline-block;
font-weight: 600;
}
.tag {
margin-right: 8rpx;
}
}
}
.disabled {
.item {
.van-cell-text {
color: #969696;
}
}
}
.tip {
font-size: 26rpx;
font-weight: 400;
color: #969696;
padding: 19rpx var(--cell-horizontal-padding, 16px);
}
.virtual-box {
height: 144rpx;
}
}
.btn {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 0 20rpx 36rpx;
background-color: #fff;
}
.loading-box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
.loading-img {
width: 180rpx;
height: 180rpx;
margin-bottom: 30%;
}
}
.radio-label {
width: 100% !important;
}
.radio-box {
padding: 0 20rpx;
}
.radio-icon {
width: 52rpx;
height: 52rpx;
}
}
<view class="address-list-outer">
<scroll-view scroll-y class="scroll-view" style="{{customStyle}}">
<!-- 在配送范围中的地址 -->
<van-cell-group class="list">
<van-radio-group value="{{ currentId }}">
<van-radio
wx:for="{{addressList}}"
name="{{item.id}}"
custom-class="radio-box"
label-class="radio-label"
bindtap="clickItem"
data-info="{{item}}"
use-icon-slot
>
<van-icon
slot="icon"
class="radio-icon"
color="{{ item.id === currentId ? '#52ACFF' : '#969696' }}"
name="{{ item.id === currentId ? 'checked' : 'circle' }}"
wx:if="{{showRadio}}"
/>
<view slot="icon" wx:else />
<van-cell use-label-slot center class="item" catchclick="clickItem" data-info="{{item}}">
<view slot="title">
<van-tag class="tag" type="danger" wx:if="{{item.label}}">{{item.label}}</van-tag>
<view class="van-cell-text">{{item.poiName}}{{item.addressDetail}}</view>
</view>
<view slot="label">
<view>{{item.name}} {{item.phone}}</view>
</view>
<van-icon size="26" name="edit" catchtap="nav" data-type="edit" data-info="{{item}}" />
</van-cell>
</van-radio>
</van-radio-group>
</van-cell-group>
<!-- 不在配送范围中的地址 -->
<view wx:if="{{false}}">
<view class="tip">超配送范围地址</view>
<van-cell-group class="list disabled">
<van-cell use-label-slot center class="item" wx:for="{{addressList}}">
<view slot="title">
<van-tag class="tag" type="danger" wx:if="{{item.label}}">{{item.label}}</van-tag>
<view class="van-cell-text">{{item.poiName}}{{item.addressDetail}}</view>
</view>
<view slot="label">
<view>{{item.name}} {{item.phone}}</view>
</view>
<van-icon size="26" name="edit" />
</van-cell>
</van-cell-group>
</view>
<empty text="暂无地址" wx:if="{{addressList.length <= 0}}" />
<view class="virtual-box" />
</scroll-view>
<view class="btn" bindtap="nav">
<van-button type="primary" color="#52ACFF" block round>新增地址</van-button>
</view>
<view class="loading-box" wx:if="{{loading}}">
<image class="loading-img" src="/images/ybm-loading2.gif" />
</view>
</view>
.address-list-outer{position:relative;--cell-horizontal-padding:0}.address-list-outer .scroll-view{height:100vh}.address-list-outer .scroll-view .list .item{width:100%}.address-list-outer .scroll-view .list .item .van-cell-text{display:inline-block;font-weight:600}.address-list-outer .scroll-view .list .item .tag{margin-right:8rpx}.address-list-outer .scroll-view .disabled .item .van-cell-text{color:#969696}.address-list-outer .scroll-view .tip{font-size:26rpx;font-weight:400;color:#969696;padding:19rpx var(--cell-horizontal-padding, 16px)}.address-list-outer .scroll-view .virtual-box{height:144rpx}.address-list-outer .btn{position:absolute;bottom:0;left:0;width:100%;padding:0 20rpx 36rpx;background-color:#fff}.address-list-outer .loading-box{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff;display:flex;justify-content:center;align-items:center}.address-list-outer .loading-box .loading-img{width:180rpx;height:180rpx;margin-bottom:30%}.address-list-outer .radio-label{width:100% !important}.address-list-outer .radio-box{padding:0 20rpx}.address-list-outer .radio-icon{width:52rpx;height:52rpx}
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-17 13:56:04
* @LastEditors: HJ
* @LastEditTime: 2021-06-25 14:07:38
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
selectId: {
type: [Number, String],
value: null,
},
showRadio: {
type: Boolean,
value: true,
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
show: false,
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
// 关闭弹窗
onClose() {
this.setData({
show: false,
});
},
// 展示弹窗
showModal() {
this.setData({
show: true,
});
},
addressChange({ detail }) {
this.triggerEvent("change", detail);
this.onClose();
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"usingComponents": {
"address-list": "../address-list/index",
"van-popup": "@vant/weapp/popup/index",
"van-radio": "@vant/weapp/radio/index"
}
}
.title {
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-size: 30rpx;
font-weight: 600;
color: #3c3c3c;
}
<van-popup position="bottom" closeable close-icon="cross" show="{{ show }}" bind:close="onClose">
<view>
<view class="title">选择服务地址</view>
<address-list
custom-style="height: 50vh"
select-id="{{selectId}}"
show-radio="{{showRadio}}"
bindchange="addressChange"
/>
</view>
</van-popup>
.title{height:90rpx;line-height:90rpx;text-align:center;font-size:30rpx;font-weight:600;color:#3c3c3c}
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-03-10 16:50:09
* @LastEditors: HJ
* @LastEditTime: 2021-06-07 18:04:07
*/
const { Tips, Loading, hLoading } = getApp();
const { _AUTH_PHONE_KEY } = require("../../utils/global-key");
const baseUrl = require("../../api/index.js").config;
const order = require("../../api/order.js");
const { clone } = require("../../utils/deep-copy");
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
// props
properties: {
value: {
type: Object,
value: {},
observer(v) {
if (v.province) {
this.initInfo(v);
}
},
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
// 自定义样式
customStyle: "padding: 10px 0;",
// 地址信息
addressText: "",
// 楼宇名
buildingName: "",
// 表单信息
form: { name: "", phone: "", sex: "", addressDetail: "" },
// 是否自动聚焦
autoFocus: false,
},
// 组件方法
methods: {
init() {},
// 获取用户信息
getUserInfo() {
return new Promise((resolve, reject) => {
wx.getUserInfo({
success: function (res) {
const userInfo = res.userInfo;
resolve(userInfo);
},
fail(err) {
console.log("get user info error", err);
reject();
},
});
});
},
// 初始化信息
async initInfo(v) {
const {
sendId = null,
province,
city,
area,
addressDetail,
buildingName,
longitude,
latitude,
phone: rawPhone,
houseNumber,
} = v;
// 手机号
const phone = rawPhone || wx.getStorageSync(_AUTH_PHONE_KEY);
// 用户信息
const { nickName, gender } = await this.getUserInfo();
const provinceText = province === city ? province : `${province}${city}`;
const detailText =
buildingName === addressDetail
? addressDetail
: `${addressDetail}${buildingName}`;
const form = Object.assign({}, this.data.form, {
id: sendId,
phone,
city,
longitude,
latitude,
poiName: buildingName,
address: addressDetail,
addressDetail: houseNumber || "",
sex: gender,
name: nickName,
// 暂时用于分众活动写死为 true
focusAddressFlag: true,
});
this.setData({
addressText: `${provinceText}${area}${detailText}`,
buildingName,
form,
tempForm: clone(form),
autoFocus: !houseNumber,
});
},
// 点击地址
clickAddress() {
Tips("当前的订单是活动订单,不允许修改收货地址");
},
// 输入内容
onChange({ detail, currentTarget: { dataset } }) {
const { type } = dataset;
this.setData({
[`form.${type}`]: detail,
});
},
// 校验输入
verifyForm() {
return new Promise(async (resolve, rej) => {
try {
Loading();
const { form = {} } = this.data;
const { phone, name, addressDetail } = form;
const { id } = form;
// 校验是否修改
if (id && !this.verifyChange()) {
hLoading();
resolve(form);
return;
}
if (!name) {
hLoading();
Tips("请输入联系人");
rej();
return;
}
if (!phone) {
hLoading();
Tips("请输入手机号");
rej();
return;
}
if (!/^1[3456789]\d{9}$/.test(phone)) {
hLoading();
Tips("请输入正确的手机号");
rej();
return;
}
if (!addressDetail) {
hLoading();
Tips("请输入门牌号");
rej(Error("请输入门牌号"));
return;
}
await (id ? this.updateAddress() : this.createAddress());
const address = await this.getAddress();
resolve(address);
} catch (e) {
console.log("axios error", e);
}
});
},
// 校验是否发生改变,没有发生改变的话直接原路返回
verifyChange() {
const { form, tempForm } = this.data;
const keys = ["name", "phone", "addressDetail"];
let flag = true;
for (let i = 0; i < keys.length; i++) {
flag = form[keys[i]] === tempForm[keys[i]];
if (!flag) break;
}
return !flag;
},
// 请求创建地址
createAddress() {
return new Promise((resolve, reject) => {
const { form } = this.data;
const memberId = wx.getStorageSync("memberId");
order.getAddress(
baseUrl.waimaiUrl + `/client/${memberId}/address`,
{},
form,
"加载中",
function (res) {
hLoading();
resolve(res.results);
},
function (err) {
console.log("axios error", err);
reject(err);
Tips("创建地址错误,请重新进入小程序后重试");
}
);
});
},
// 编辑地址
updateAddress() {
return new Promise((resolve, reject) => {
const { form } = this.data;
const { id: addressId } = form;
const memberId = wx.getStorageSync("memberId");
order.putRditAddress(
baseUrl.waimaiUrl + `/client/${memberId}/address/${addressId}`,
{},
form,
"加载中",
function (res) {
hLoading();
resolve(res.results);
},
function (err) {
console.log("axios error", err);
reject(err);
Tips("创建地址错误,请重新进入小程序后重试");
}
);
});
},
// 由于后端没有返回地址信息,所以通过请求获取新创建的地址的id
getAddress() {
return new Promise((resolve, reject) => {
const memberId = wx.getStorageSync("memberId");
order.getRequire(
baseUrl.waimaiUrl + "/client/" + memberId + "/address",
{},
{},
"加载中",
(res) => {
const { results } = res;
if (Array.isArray(results)) {
const { longitude, latitude } = this.data.value;
const { addressDetail, poiName } = this.data.form;
const temp = results.filter((i) => {
const {
longitude: rawLon,
latitude: rawLat,
poiName: rawPoi,
addressDetail: rawAdd,
focusAddressFlag,
} = i;
console.log(
"debug",
focusAddressFlag,
(+rawLon).toFixed(3) === (+longitude).toFixed(3),
(+rawLat).toFixed(3) === (+latitude).toFixed(3),
poiName === rawPoi,
addressDetail === rawAdd
);
if (
focusAddressFlag &&
(+rawLon).toFixed(3) === (+longitude).toFixed(3) &&
(+rawLat).toFixed(3) === (+latitude).toFixed(3) &&
poiName === rawPoi &&
addressDetail === rawAdd
) {
return i;
}
});
console.log("debug", temp);
if (temp.length > 0) {
resolve(temp[0]);
} else {
reject();
}
} else {
reject();
}
},
function (err) {
console.log("axios error", err);
reject(err);
Tips("创建地址错误,请重新进入小程序后重试");
}
);
});
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-cell-group": "@vant/weapp/cell-group/index",
"van-field": "@vant/weapp/field/index",
"van-divider": "@vant/weapp/divider/index"
}
}
<view
class="address-text"
bindtap="clickAddress"
hidden="{{!addressText}}"
>{{buildingName}}({{addressText}})
</view>
<van-cell-group custom-class="address-group" border="{{false}}">
<van-field
value="{{ form.name }}"
custom-style="{{customStyle}}"
border="{{false}}"
clearable
label="联系人"
placeholder="请输入联系人"
bind:change="onChange"
data-type="name"
/>
<van-divider custom-style="margin: 0" />
<van-field
value="{{ form.phone }}"
custom-style="{{customStyle}}"
border="{{false}}"
type="number"
clearable
label="手机号"
placeholder="请输入手机号"
bind:change="onChange"
data-type="phone"
/>
<van-divider custom-style="margin: 0" />
<van-field
value="{{ form.addressDetail }}"
custom-style="{{customStyle}}"
border="{{false}}"
clearable
label="门牌号"
placeholder="例: A座2501"
bind:change="onChange"
data-type="addressDetail"
focus="{{autoFocus}}"
/>
</van-cell-group>
.address-text {
font-size: 32rpx;
font-weight: 600;
line-height: 1.6;
}
.address-group {
padding: 0;
width: 100%;
}
const baseUrl = require('../../api/index').config
const store = require('../../api/order.js')
const { _AUTH_PHONE_KEY } = require('../../utils/global-key')
const { compareVersion } = require('../../utils/util')
const { fhPutInfo} = require('../../api/hospital/index.js')
import { fhIsVerityPatientVerty } from '../../api/sign/index'
const { Loading, Tips, bus, hLoading } = getApp()
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
properties: {
visible: {
type: Boolean,
value: false,
observer() {
this.init()
}
},
isPage: {
type: Boolean,
value: false
}
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
btnflag: false,
phoneflag: false,
// 动画
animationData: null,
// 是否有新版授权的能力
canIUseGetUserProfile: false
},
// 组件方法
methods: {
init(data = {}) {
this.tempDetail = data
this.animation = wx.createAnimation({
duration: 600
})
this.setData(
{
btnflag: wx.getStorageSync('btnflag'),
phoneflag: wx.getStorageSync('phoneflag')
},
() => {
const { btnflag } = this.data
if (!btnflag) {
this.scrollX('-100%')
}
}
)
},
// 滑动效果
scrollX(x) {
this.setData({
animationData: this.animation.translateX(x).step().export()
})
},
// 获取用户信息
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: res => {
this.authUserInfo(res)
}
})
},
// 获取用户信息
bindGetUserInfo: function (e) {
//接下来写业务代码
wx.getUserInfo({
success: rawUserInfo => {
this.authUserInfo(rawUserInfo)
},
fail(err) {
console.log('auth Error:', err)
hLoading()
}
})
},
// 授权信息
authUserInfo(rawUserInfo) {
Loading()
wx.login({
success: res => {
const { code } = res
const accountInfo = wx.getAccountInfoSync()
var appId = accountInfo.miniProgram.appId
const sendData = {
...rawUserInfo,
code,
appId
}
wx.request({
url:
wx.$unienv.VUE_APP_BASE_API +
baseUrl.unionUrl +
'/mini-users/auth-user-info',
method: 'POST',
data: sendData,
header: {
'content-type': 'application/json'
},
success: data => {
const { results } = data.data
if (data.data.code == 200) {
const { openId, memberId, token,nickName,avatarUrl } = results || {}
wx.setStorageSync('token', token)
wx.setStorageSync('openid', openId)
wx.setStorageSync('memberId', memberId)
wx.setStorageSync('phoneflag', true)
wx.setStorageSync('btnflag', false)
wx.setStorageSync('avatar-name', {nickName,avatarUrl})
if(wx.getStorageSync('memberId')) {
console.log(111)
this.handleAuthedIdent()
if(!wx.getStorageSync('hospitalFlag')) this.putInfo()
}
this.scrollX('-100%')
getApp().getStorage()
getApp().fhGetPatientInfo()
hLoading()
} else if (data.data.code == 2002) {
wx.showToast({
title: data.data.message,
duration: 1000,
mask: true,
icon: 'none',
success: function () {
setTimeout(function () {
wx.redirectTo({
url: '/pages/empty/empty'
})
}, 2000)
}
})
} else if (data.data.code == 520) {
wx.showToast({
title: data.data.message,
icon: 'none'
})
} else {
wx.showToast({
title: data.data.message,
icon: 'none'
})
wx.hideLoading()
}
}
})
},
fail: function () {
Tips('授权出错,请重试')
}
})
},
/**
* 扫码登录时编辑患者住院信息
*
*/
async putInfo() {
try{
const memberId = wx.getStorageSync('memberId')
const { hospitalId } = wx.getStorageSync('hospital-info')
await fhPutInfo(
memberId,
hospitalId
)
} catch (e) {
console.log('debug axios: ', e)
}
},
/***
* 患者是否认证过
*/
async handleAuthedIdent() {
wx.showLoading({ title: "正在加载中", mask: true })
try {
const params = {
patientId: wx.getStorageSync('memberId')
}
const {
results
} = await fhIsVerityPatientVerty(params);
wx.setStorageSync('authedFlag', results)
} catch (e) {
console.log(e)
} finally {
wx.hideLoading()
}
},
// 获取手机号
getPhoneNumber: function (e) {
const { isPage } = this.data
var that = this
Loading()
wx.login({
success: function (res) {
//res.code
that.setData({
code: res.code
})
var openid = wx.getStorageSync('openid')
const accountInfo = wx.getAccountInfoSync()
var appid = accountInfo.miniProgram.appId
store.takePhone(
wx.$unienv.VUE_APP_BASE_API +
baseUrl.unionUrl +
'/mini-users/auth-user-phone',
{},
{
appId: appid,
code: that.data.code,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
shareManCardNo: that.data.shareManCardNo,
activityType: that.data.activityType,
openId: openid
},
'加载中',
function (res) {
if (res.code == 200) {
wx.setStorageSync('memberId', res.results.memberId)
wx.setStorageSync('token', res.results.token)
wx.setStorageSync('phoneflag', false)
wx.setStorageSync('btnflag', false)
wx.setStorageSync('anflag', false)
wx.setStorageSync(_AUTH_PHONE_KEY, res.results.phoneNumber)
getApp().getStorage()
getApp()
.updateRecord()
.then(() => {
isPage
? wx.navigateBack({
delta: 1
})
: bus.emit(
'onNeedAuth',
Object.assign({}, that.tempDetail, {
show: false,
authFlag: true
})
)
})
}
wx.hideLoading()
},
function (err) {
Tips('授权手机出错,请重试')
}
)
},
fail(err) {
console.log('login error', err)
hLoading()
}
})
}
},
// 生命周期
lifetimes: {
attached() {
const { SDKVersion } = wx.getSystemInfoSync()
if (
wx.getUserProfile &&
compareVersion(SDKVersion, '2.14.1') &&
compareVersion(SDKVersion, '2.15.0')
) {
this.setData({
canIUseGetUserProfile: true
})
}
if (this.data.isPage) {
this.init()
}
},
ready() {
// 订阅
bus.on('onNeedAuth', this.init.bind(this))
}
},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
})
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
}
}
Component(componentOptions)
{
"component": true,
"usingComponents": {}
}
<view class="auth-page-outer">
<view class="auth-title" wx:if="{{!isPage}}">您还未登录</view>
<view class="auth-tips">欢迎使用,请您登录</view>
<image
src="https://top50-dev.oss-cn-shenzhen.aliyuncs.com/doctor/1639359573332_4c56a67a"
class="logo"
mode="widthFix"
/>
<view class="animation-box">
<view class="auth-btn-box" animation="{{animationData}}">
<view class="auth-user-info">
<view class="auth-info">
<text>获取你的昵称、头像、地区及性别</text>
</view>
<button
class="auth-btn"
open-type="getUserInfo"
lang="zh_CN"
bindtap="getUserProfile"
wx:if="{{canIUseGetUserProfile}}"
>立即登录
</button>
<button
class="auth-btn"
open-type="getUserInfo"
lang="zh_CN"
bindgetuserinfo="bindGetUserInfo"
wx:else
>立即登录
</button>
</view>
<view class="auth-phone">
<view class="auth-info">
<text>获取你的手机号</text>
</view>
<button
class="auth-btn"
open-type="getPhoneNumber"
bindgetphonenumber="getPhoneNumber"
>授权手机号
</button>
</view>
</view>
</view>
</view>
.auth-page-outer {
text-align: center;
letter-spacing: 3rpx;
}
.auth-title {
font-size: 42rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.auth-tips {
font-size: 28rpx;
font-weight: 400;
color: #999;
line-height: 1.6;
margin-bottom: 24rpx;
}
.logo {
width: 200rpx;
/* height: 250rpx; */
margin: 32rpx 0 52rpx;
}
.auth-info {
font-weight: 400;
font-size: 24rpx;
color: #666;
text-align: left;
margin-bottom: 32rpx;
}
.auth-info::before {
content: " ";
display: inline-block;
width: 12rpx;
height: 12rpx;
border-radius: 100%;
background-color: #999;
vertical-align: top;
margin-top: 6rpx;
margin-right: 12rpx;
}
.animation-box {
width: 100%;
overflow: hidden;
}
.auth-btn-box {
text-align: left;
white-space: nowrap;
}
.auth-user-info,
.auth-phone {
display: inline-block;
width: 100%;
}
.auth-btn {
width: 100%;
height: 80rpx;
background-color: #3694ec;
font-size: 32rpx;
color: #fff;
line-height: 98rpx;
text-align: center;
border-radius: 8rpx;
font-weight: 600;
margin: 0 auto;
}
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-08 10:54:51
* @LastEditors: HJ
* @LastEditTime: 2021-06-08 11:05:56
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
properties: {},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
show: false,
},
// 组件方法
methods: {
init() {
const flag = wx.getStorageSync("collection");
!flag && this.controlPopup(true);
},
// 弹窗
controlPopup(flag = false) {
this.setData({
show: flag,
}, () => {
if(!flag) {
wx.setStorageSync('collection', true)
}
});
},
// 点击遮罩
clickMask() {
this.controlPopup()
}
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {}
}
<!-- 添加到我的小程序 -->
<view class="add-mine" wx:if="{{show}}" catchtap="clickMask">
<view class="add-card-box">
<view class="add-card">
点击
<image class="add-img" src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/add_card.png" />选择"添加到我的小程序"
</view>
<view class="add-card">随时查看订单及领取福利</view>
</view>
</view>
/* 添加到我的小程序 */
.add-mine {
z-index: 9999;
position: fixed;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.6);
width: 100%;
height: 100%;
}
.add-card-box {
display: inline-block;
font-size: 28rpx;
padding: 18rpx 14rpx;
background: #fff;
border-radius: 9rpx;
color: rgba(0, 0, 0, 0.8);
float: right;
margin-top: 14rpx;
margin-right: 32rpx;
position: relative;
}
.add-card-box::after {
content: " ";
position: absolute;
left: calc(63% + 28rpx);
top: 0;
transform: translate(-50%, -100%);
border-bottom: #fff solid 14rpx;
border-left: transparent solid 10rpx;
border-right: transparent solid 10rpx;
}
.add-img {
display: inline-block;
width: 31rpx;
height: 16rpx;
line-height: 28rpx;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-16 15:09:32
* @LastEditors: HJ
* @LastEditTime: 2021-06-30 17:57:13
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
visible: {
type: Boolean,
value: false,
observer(visible) {
this.setData({
show: visible,
});
},
},
minHour: {
type: Number,
value: 0,
},
minDate: {
type: Number,
value: new Date().getTime(),
},
maxDate: {
type: Number,
value: null,
},
filter: {
type: Function,
value: null
}
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
show: false,
currentDate: null,
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
showPopup() {
this.setData({ show: true });
},
onClose() {
this.setData({ show: false });
},
onInput({ detail }) {
this.setData({
currentDate: detail,
});
},
onConfirm({ detail }) {
this.triggerEvent("change", { value: detail });
wx.nextTick(() => {
this.onClose();
});
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-popup": "@vant/weapp/popup/index"
}
}
<van-popup
custom-class="pop-up"
show="{{ show }}"
position="bottom"
bind:close="onClose"
>
<van-datetime-picker
type="datetime"
value="{{ currentDate }}"
min-date="{{ minDate }}"
min-hour="{{minHour}}"
filter="{{filter}}"
bind:input="onInput"
bind:confirm="onConfirm"
bind:cancel="onClose"
/>
</van-popup>
Component({
properties: {
title: String,
padding: Boolean
},
externalClasses: ['custom-class']
});
<view class="custom-class demo-block van-clearfix {{ padding ? 'demo-block--padding' : '' }}">
<view wx:if="{{ title }}" class="demo-block__title">{{ title }}</view>
<slot />
</view>
.demo-block__title {
margin: 0;
font-weight: 400;
font-size: 14px;
color: rgba(69,90,100,.6);
padding: 20px 15px 15px;
}
.demo-block--padding {
padding: 0 15px;
}
.demo-block--padding .demo-block__title {
padding-left: 0;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-03-23 15:56:46
* @LastEditors: HJ
* @LastEditTime: 2021-06-07 18:22:45
*/
const { bus } = getApp();
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
externalClasses: ["custom-class"],
properties: {
value: {
type: Object,
value: {},
observer(v) {
if (v) this.initData(v);
},
},
direction: {
type: String,
value: "horizontal",
observer(v) {
this.setData({
isHorizontal: v === "horizontal",
});
},
},
extraInfo: {
type: Object,
value: {},
},
needBtn: {
type: Boolean,
value: false,
},
isInPublic: {
type: Boolean,
value: false,
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
// 菜品的UUID
dishKey: "",
// 菜品数据
dishData: {},
// 购买信息
buyInfo: {
number: 0,
},
// 是否不允许点击
disabled: false,
// 是否横向展示
isHorizontal: true,
// 图片是否展示
imgShow: false,
// 优惠的价格
diffPrice: 0,
},
// 组件方法
methods: {
init() {},
// 计算菜品数据
initData(dishData) {
const { price, discount } = dishData;
const diffPrice = price - discount;
this.setData({
dishData,
diffPrice: diffPrice.toFixed(2),
});
},
// 点击菜品获取详情
clickItem() {},
},
// 组件生命周期
lifetimes: {
attached() {
this.init();
},
},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-image": "@vant/weapp/image/index"
}
}
<view class="dishes-outer {{direction}} custom-class" bindtap="clickItem">
<view class="dishes-info-box _flex">
<view class="img-box _line">
<image
class="dishes-img"
lazy-load
src="{{dishData.miniImage}}?x-oss-process=image/resize,w_165/quality,Q_70"
mode="aspectFill"
wx:if="{{dishData.miniImage}}"
/>
<image class="dishes-img" lazy-load src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/empty/image.png" mode="aspectFill" wx:else />
<view class="tag-box" wx:if="{{dishData.tagName}}">{{dishData.tagName}}</view>
<view class="seller-out" wx:if="{{dishData.oversell || dishData.sellerOut}}">售 罄</view>
</view>
<view class="dishes-info _flex">
<view>
<view class="dishes-name _ft_bold _ell">{{dishData.foodName}}</view>
<!-- 简介 -->
<view
class="dishes-desc _c_999 _ell"
style="opacity: {{dishData.store.storeName ? 1 : 0}}"
wx:if="{{isInPublic}}"
>{{dishData.store.storeName}}</view>
<view class="dishes-desc _c_999 _ell" wx:else>{{dishData.introduction}}</view>
<!-- 优惠的内容 -->
<view class="special-label" wx:if="{{!isInPublic && diffPrice && diffPrice !== '0.00'}}">优惠{{diffPrice}}元</view>
</view>
<view class="price-box">
<view class="discounted-price _c_000 _inline {{isInPublic && 'public-price'}}">
<text class="discount-icon discount-tip _inline" wx:if="{{isInPublic}}">特惠价</text>
<text class="discount-icon _inline">¥</text>
<view class="discounted-number _inline _ft_bold">{{dishData.discount}}</view>
</view>
<view
class="raw-price _inline _c_ccc"
style="opacity: {{dishData.price ? 1 : 0 }}"
wx:if="{{needBtn}}"
>¥{{dishData.price}}</view>
</view>
<!-- 数量控制 -->
<view class="control" wx:if="{{needBtn}}">
<!-- 选规格 -->
<view class="select-sku">一键购买</view>
</view>
</view>
</view>
</view>
@import "/style/common.wxss";
.horizontal {
--outer-pd-r: 30rpx;
--outer-pd-tb: 16rpx;
/* --dishes-img-width: 120rpx;
--dishes-img-height: 116rpx;
--ml: 10rpx; */
}
._inline {
display: inline-block;
}
._c_600 {
color: #3694ec;
}
._c_999 {
color: #999;
}
._c_ccc {
color: #ccc;
}
._c_000 {
color: #000;
}
._c_333 {
color: #333;
}
._b_fff {
background-color: #fff;
}
.dishes-outer {
font-size: 28rpx;
overflow: hidden;
}
/* 菜品信息 */
.dishes-info-box {
position: relative;
}
.img-box {
position: relative;
width: var(--dishes-img-width);
height: var(--dishes-img-height);
}
.img-box::after {
border: 1px solid #ccc;
border-radius: 14rpx;
}
.dishes-img {
width: var(--dishes-img-width);
height: var(--dishes-img-height);
border-radius: 7rpx;
flex: none;
}
.tag-box {
position: absolute;
top: 0rpx;
left: 0rpx;
min-width: 60rpx;
min-height: 30rpx;
text-align: center;
line-height: 30rpx;
background: linear-gradient(
53deg,
rgba(249, 203, 113, 1),
rgba(246, 188, 10, 1)
);
box-shadow: 0rpx 8rpx 12rpx 0rpx rgba(85, 88, 96, 0.12);
border-radius: 0rpx 8rpx 0rpx 8rpx;
color: #fff;
font-size: 20rpx;
letter-spacing: 2rpx;
}
.seller-out {
position: absolute;
bottom: 0;
left: 0;
text-align: center;
width: 100%;
height: 40rpx;
line-height: 40rpx;
background: #1e1f1f;
opacity: 0.7;
border-radius: 0rpx 0rpx 12rpx 12rpx;
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
}
.dishes-info {
flex: 1;
margin-left: var(--ml);
width: calc(100% - var(--ml) - var(--dishes-img-width));
flex-direction: column;
justify-content: space-between;
}
.dishes-name {
font-size: 32rpx;
line-height: 32rpx;
margin-bottom: rpx;
margin-bottom: 7rpx;
}
.dishes-desc {
min-height: 26rpx;
font-size: 26rpx;
margin-bottom: 7rpx;
}
.special-label {
display: inline;
width: fit-content;
min-width: 80rpx;
height: 30rpx;
line-height: 30rpx;
text-align: center;
padding: 0 7rpx;
font-size: 20rpx;
color: #fff;
background-color: #ff5c5d;
border-radius: 7rpx;
}
.price-box {
justify-self: flex-end;
}
.discount-mark {
margin-right: 14rpx;
padding: 3rpx 12rpx;
font-size: 20rpx;
}
.discount-mark::after {
border: 2px solid #3694ec;
border-radius: 7rpx;
}
.discounted-number {
font-size: 36rpx;
margin-right: 12rpx;
}
.discount-icon {
font-size: 22rpx;
font-weight: bold;
}
.discount-tip {
color: #000;
margin-right: 7rpx;
}
.raw-price {
text-decoration: line-through;
}
.raw-price-icon {
line-height: 26rpx;
color: #3C3C3C;
}
.public-price {
color: #f64932 !important;
word-break: keep-all;
white-space: nowrap;
}
.control {
position: absolute;
bottom: 0;
right: 0;
}
.reduce,
.add {
width: 40rpx;
height: 40rpx;
padding: 0 12rpx;
vertical-align: middle;
}
.buy-number {
display: inline-block;
font-size: 32rpx;
color: #999;
line-height: 48rpx;
vertical-align: middle;
min-width: 1em;
text-align: center;
}
.select-sku {
position: relative;
min-width: 130rpx;
height: 60rpx;
background: #f96146;
border-radius: 9rpx;
line-height: 60rpx;
font-size: 28rpx;
font-weight: 400;
color: #ffffff;
text-align: center;
letter-spacing: 2rpx;
padding: 0 12rpx;
}
.disabled {
background-color: #bbb;
}
/* 竖版展示 */
.vertical {
--dishes-img-width: 190rpx;
--dishes-img-height: 182rpx;
--ml: 0;
}
.vertical .dishes-info-box {
flex-direction: column;
}
.vertical .img-box {
margin-bottom: 13rpx;
}
.vertical .dishes-info {
width: var(--dishes-img-width);
}
.vertical .dishes-name {
font-size: 28rpx;
margin-bottom: 6rpx;
}
.vertical .price-box {
display: flex;
flex-direction: row;
vertical-align: bottom;
align-items: flex-end;
}
.vertical .discounted-number {
font-size: 32rpx;
letter-spacing: -3rpx;
margin-right: 5rpx;
}
.vertical .discount-icon {
letter-spacing: -2rpx;
}
.vertical .raw-price {
font-size: 20rpx;
line-height: 30rpx;
}
.vertical .select-sku {
width: 90rpx;
height: 40rpx;
border-radius: 20rpx;
line-height: 40rpx;
font-size: 20rpx;
}
.vertical .reduce,
.vertical .add {
padding: 0;
}
.vertical .raw-price-icon {
font-size: 22rpx;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-18 14:06:46
* @LastEditors: HJ
* @LastEditTime: 2021-06-18 14:07:27
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
text: {
type: String,
value: "暂无数据",
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {}
}
<view class="empty-warp">
<view class="empty-icon">
<image src="/images/empty.png" />
</view>
<view class="tip">{{text}}</view>
</view>
.empty-warp {
padding-top: 30%;
}
.empty-warp .empty-icon {
width: 200rpx;
height: 153rpx;
margin: 0 auto;
}
.empty-warp .empty-icon image {
width: 100%;
height: 100%;
}
.empty-warp .tip {
font-size: 24rpx;
font-family: PingFang-SC-wRegular, PingFang-SC;
color: #666666;
line-height: 80rpx;
text-align: center;
display: block;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-03-17 14:45:35
* @LastEditors: HJ
* @LastEditTime: 2021-03-17 15:50:56
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
// 浮窗 靠左还是靠右
float: {
type: String,
value: "left",
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
// 是否靠左
isFloatLeft: true,
// 动画
animationData: null,
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {
this.setData({
isFloatLeft: this.data.float === "left",
});
this.animation = wx.createAnimation({});
},
// 设置窗口是否隐藏
hideWindow() {
this._animation(0.2, 60);
},
// 设置窗口是否展示
showWindow() {
this._animation(1, 0);
},
// 窗口动画
_animation(opacity = 0.2, x = 0) {
x *= this.data.isFloatLeft ? -1 : 1
const animation = this.animation
.opacity(opacity)
.translateX(x + '%')
.step()
.export();
this.setData({
animationData: animation,
});
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {}
}
<view
class="floating-window-outer"
style="{{isFloatLeft ? 'left: 0' : 'right: 0'}}"
animation="{{animationData}}"
>
<slot/>
</view>
.floating-window-outer {
position: fixed;
bottom: 15vh;
z-index: 201;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2020-09-23 10:01:01
* @LastEditors: HJ
* @LastEditTime: 2020-09-23 17:23:17
*/
Component({
/**
* 组件的属性列表
*/
properties: {
value: {
type: Object,
value: {},
},
anflag: {
type: Boolean,
value: false,
},
searchflag:{
type:Boolean,
value:false
},
searchflag: {
type: Boolean,
value: false
},
index:{
type:Number,
value:0
},
uidata: {
type: Object,
value: {},
},
catgid: {
type: Object,
value: {},
},
storelist: {
type: Object,
value: {},
},
},
observers: {},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
takeImgseckill(e) {
this.triggerEvent("takeImgseckill", e, {});
},
takeImg(e) {
this.triggerEvent("takeImg", e, {});
},
codingminus(e) {
this.triggerEvent("codingminus", e, {});
},
codingadd(e) {
this.triggerEvent("codingadd", e, {});
},
takeAnflag(e) {
this.triggerEvent("takeAnflag", e, {});
},
},
});
{
"component": true,
"usingComponents": {
"mina-lazy-image": "/miniprogram_npm/mina-lazy-image/index"
}
}
<!-- <wxs module="test">
sum = 0
T = {
add: function(n) {
sum += parseFloat(n)
},
check: function(data, m) {
num = 0
for (var j = 0; j < data.length; j++) {
if (data[j].id === m) {
num += data[j].num
}
}
}
}
module.exports = T
</wxs> -->
<view
id="newfoodname"
class="newfoodname"
bindtap="takeImg"
data-img="{{value.images}}"
data-id="{{value.id}}"
data-index="{{index}}"
data-specsnum="{{uidata[value.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].num}}"
>
<view class="shop-list" id="shoplist">
<view class="mina-layout">
<mina-lazy-image
src="{{value.miniImage}}"
mode="widthFIx"
image-class="custom-class-name"
styles="width: 172rpx;height: 164rpx;border-radius: 12rpx;"
data-id="{{value.id}}"
data-img="{{value.images}}"
lazy-load='true'
catchtap="takeImg"
data-foodtype="{{value.foodType}}"
data-index="{{index}}"
data-specsnum="{{uidata[value.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].num}}"
/>
<view class="dish-label" wx:if="{{value.tagName}}">{{value.tagName}}</view>
<view class="shouqin-text" wx:if="{{value.oversell==1||value.sellout==false}}">售罄</view>
</view>
<view class="{{searchflag?'shop-searchdata':'shop-data'}}">
<view class="{{value.categoryId==-1?'shop-onexian':'shop-one'}}">{{value.name}}</view>
<view class="{{value.categoryId==-1?'shop-descriptionxian':'shop-description'}} _ell" hidden="{{!value.introduction}}">{{value.introduction}}</view>
<view class="{{value.categoryId==-1?'shop-secondxian':'shop-second'}}" style="opacity: 0">月销量{{value.saleNum}}份</view>
<!-- 折扣内容 -->
<view class="discount-box _line" wx:if="{{value.discount}}">{{value.discount}}折
<view class="discount-line _line"></view>
{{value.limitBuyNumber ? '每单限购' + value.limitBuyNumber + '份' : '不限购'}}</view>
<!-- 价格 -->
<view class="shopsingle-price" wx:if="{{value.categoryId==-1}}">
<view class="shopsingle-icon">¥</view>
<view class="shopsingle-money">{{value.discountPrice}}</view>
<view class="shop-pricetwo">¥{{value.minimumPrice}}</view>
</view>
<!-- 推荐 -->
<view class="shopsingle-price" wx:if="{{value.categoryId !=-1&&value.foodType==3}}">
<view class="shopsingle-icon">¥</view>
<view class="shopsingle-money">{{value.minimumRecPrice}}</view>
<view class="shop-pricetwo">¥{{value.minimumPrice}}</view>
<text class='more-sku-tip' hidden="{{value.storeFoodSkuDtoList.length<=1}}">起</text>
</view>
<!-- 普通菜品 -->
<view class="shopsingle-price" wx:if="{{value.categoryId !=-1&&value.foodType==1}}">
<view class="shopsingle-icon">¥</view>
<view class="shopsingle-money">{{value.minimumPrice}}</view>
<text class='more-sku-tip' hidden="{{value.storeFoodSkuDtoList.length<=1}}">起</text>
</view>
<view class="shop-st" wx:if="{{value.oversell=='0'&&(storelist.storeOperatingStatus==1||storelist.storeOperatingStatus==3)&&value.sellout}}">
<view class="food-count" wx:if="{{value.moreSku==false}}">
<view
class="enlarges-reducefood"
catchtap="codingminus"
wx:if="{{(uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].num>0)&&(uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].foodType===value.foodType)}}"
data-id="{{value.storeFoodSkuDtoList[0].id}}"
data-index='{{index}}'
data-catgid="{{catgid.categoryId}}"
data-foodtype="{{value.foodType}}"
data-attributerealid="{{uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].attributeid}}"
>
<image class="reduce" src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/ordermealjs.png"></image>
</view>
<view class="results result-box" wx:if="{{(uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].num>0)&&(uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].foodType===value.foodType)}}">{{uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].num}}</view>
<view
class="enlarges-addfood"
catchtap="codingadd"
data-id="{{value.storeFoodSkuDtoList[0].id}}"
data-catgid="{{catgid.categoryId}}"
data-index='{{index}}'
data-foodtype="{{value.foodType}}"
data-attributerealid="{{uidata[catgid.categoryId][value.storeFoodSkuDtoList[0].id+'_'+value.foodType].attributeid}}"
>
<image class="add" src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/ordermealtj.png"></image>
</view>
</view>
<view
class="Specifications"
data-id="{{value.id}}"
wx:if="{{value.moreSku&&value.foodType==1}}"
data-index="{{index}}"
catchtap="takeImg"
data-img="{{value.images}}"
>
选规格
</view>
<view
class="Specifications"
data-id="{{value.id}}"
wx:if="{{value.moreSku&&value.foodType==2}}"
data-index="{{index}}"
catchtap="takeImg"
data-img="{{value.images}}"
data-foodtype="{{value.foodType}}"
>
选规格
</view>
</view>
<view class="shop-st" wx:if="{{value.oversell=='1'||(storelist.storeOperatingStatus==2)||value.sellout==false}}">
<view class="count" wx:if="{{value.moreSku==false}}">
<view class="enlarges-add">
<image
class="add"
src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/shouqin01.png"
data-id="{{value.id}}"
></image>
</view>
</view>
<view
class="Specifications-list"
data-id="{{value.id}}"
wx:if="{{value.moreSku}}"
data-img="{{value.images}}"
>选规格
</view>
<!-- <button wx:if="{{anflag}}" class="sh-btn" bindtap="takeAnflag"></button> -->
</view>
</view>
</view>
</view>
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-10 07:19:16
* @LastEditors: HJ
* @LastEditTime: 2021-06-24 18:43:12
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
loading: {
type: Boolean,
value: true,
},
customStyle: {
type: String,
value: "",
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index"
}
}
<view class="loading-outer" style="{{customStyle}}" wx:if="{{loading}}">
<image class="loading-img" src="/images/ybm-loading2.gif" />
</view>
.loading-outer {
position: fixed;
top: 0;
left: 0;
z-index: 9999;
width: 100vw;
height: 100vh;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.loading-img {
width: 180rpx;
height: 180rpx;
margin-bottom: 30vh;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-09 23:18:37
* @LastEditors: HJ
* @LastEditTime: 2021-07-27 13:42:59
*/
import { status, nurseOrderStatusMap } from '../../utils/enumMap'
import { fhPayNurseOrders, fhCancelNurseOrders } from '../../api/hospital/index'
import { fhReminderOrder } from '../../api/order/index'
import { Tips } from '../../utils/util'
const baseUrl = require('../../api/index.js').config
const order = require('../../api/order')
const { Loading, hLoading } = getApp()
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {
value: {
type: Object,
value: {}
},
orderType: {
type: String,
value: null,
observer(type) {
this.setData({
orderStatus: type === 'patient' ? status : nurseOrderStatusMap
})
}
},
listInfo: {
type: String,
value: 'all'
}
},
observers: {
'value,orderStatus'(value, orderStatus) {
if (value && orderStatus) {
const { payTime } = value
if (payTime) this.computedReminder(value)
const orderStatusText = this.compoutedStatusText(value)
this.setData({
orderStatusText
})
}
}
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
// 订单状态
orderStatus: null,
// 订单状态文案
orderStatusText: '',
funs: [],
// 是否显示催单按钮
isShowReminderBtn: false
},
// 组件方法
methods: {
init() {},
// 打电话
ringUp({ currentTarget: { dataset } }) {
wx.makePhoneCall({
phoneNumber: dataset.phone
})
},
// //去支付
goPaid({ currentTarget: { dataset } }) {
const { id } = dataset
Loading()
this.setData(
{
orderid: id
},
() => {
this.data.orderType === 'patient'
? this.payWechat(id)
: this.payNurseOrders()
}
)
},
// 微信支付
payWechat(id) {
var that = this
var memberId = wx.getStorageSync('memberId')
order.takePayment(
baseUrl.waimaiUrl + `/client/${memberId}/order/${id}/pay`,
{},
{
payType: 1
},
'加载中',
function(res) {
hLoading()
var result = res.results
that.evokeWechatPay(result)
},
function(err) {
hLoading()
wx.showToast({
title: '支付失败'
})
that.setData({
payflag: false
})
}
)
},
// 去反馈
toEval({ currentTarget: { dataset } }) {
const { item } = dataset
try {
wx.setStorageSync('j_feedback', item)
wx.navigateTo({
url: '/package/good/feedback/feedback'
})
} catch (e) {
wx.showToast({
title: '数据异常,请重试',
icon: 'none'
})
}
},
// 跳转商家门店
jumpSaleroom({ currentTarget: { dataset } }) {
if (this.data.orderType !== 'patient') {
this.nav({ currentTarget: { dataset } })
return
}
const { storeid } = dataset
wx.setStorageSync('storeid', storeid)
wx.navigateTo({
url: '/store/pages/lunch/index'
})
},
// 跳转到详情
nav({ currentTarget: { dataset } }) {
const { orderId } = dataset
wx.$routerTo({
url: '/pages/order/detail/index',
query: {
orderId,
type: this.data.orderType,
from: this.data.listInfo
}
})
},
// 支付护工订单
async payNurseOrders() {
try {
const { results } = await fhPayNurseOrders(this.data.orderid, {
payType: 1
})
this.evokeWechatPay(results)
} catch (e) {
console.log('debug axios', e)
hLoading()
}
},
// 取消护工订单
async fhCancelNurseOrders() {
try {
await fhCancelNurseOrders(this.data.orderid)
Tips('取消订单成功')
setTimeout(() => {
wx.reLaunch({
url: '/pages/order/list/index'
})
}, 1000 * 1.2)
} catch (e) {
console.log('debug axios', e)
}
},
// 唤起微信支付
evokeWechatPay(info) {
hLoading()
const { prepayId } = info
wx.requestPayment({
...info,
package: prepayId,
success: res => {
wx.showToast({
title: '支付成功',
duration: 1000,
mask: true,
success: () => {
setTimeout(() => {
wx.$routerTo({
url: '/package/good/successpage/successpage',
type: 'reLaunch',
query: {
type: this.data.orderType,
orderid: this.data.value.orderId,
price: this.data.value.totalPrice
}
})
}, 1000) //延迟时间
}
})
},
fail: res => {
hLoading()
this.setData({
payflag: false
})
wx.showToast({
title: '取消支付',
icon: 'error',
duration: 800,
success: function() {}
})
}
})
},
// 计算当前订单实际状态
compoutedStatusText(info) {
const { orderStatus, refundStatus } = info
const key = (refundStatus !== 603 && refundStatus) || orderStatus
return this.data.orderStatus[key]
},
// 催单
async takeReminder({ currentTarget: { dataset } }) {
const { id } = dataset
await fhReminderOrder(id)
Tips('催单成功')
},
// 计算是否展示催单按钮
computedReminder(value) {
if (this.data.orderType === 'patient') {
const { payTime, orderStatus } = value
const payTimeStamp = new Date(payTime).valueOf()
const nowTimeStamp = new Date().valueOf()
const showFlag = [4, 3, 5, 102, 201, 202, 301].includes(orderStatus)
if (nowTimeStamp - payTimeStamp > 30 * 60000 && showFlag) {
this.setData({
isShowReminderBtn: true
})
}
}
}
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init()
},
ready() {},
moved() {},
detached() {}
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
})
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
}
}
Component(componentOptions)
{
"component": true,
"usingComponents": {
"van-divider": "@vant/weapp/divider/index",
"price-display": "../price-display/index",
"nurse-display-card": "../nurse-display-card/index"
}
}
.order-card-outer {
background-color: #fff;
padding: 20rpx 20rpx 28rpx;
box-shadow: 0 0 12rpx 3rpx rgba(0, 0, 0, 0.07);
.info {
display: flex;
justify-content: space-between;
font-size: 32rpx;
line-height: 32rpx;
font-weight: 500;
color: #3c3c3c;
margin-bottom: 24rpx;
.status {
.text {
margin-right: 12rpx;
}
.right-icon {
width: 15rpx;
height: 24rpx;
}
}
.order-time {
font-size: 24rpx;
font-weight: 400;
color: #6a6a6a;
margin-top: 18rpx;
line-height: 24rpx;
}
}
.foods-box {
width: 100%;
height: 144rpx;
.foods {
display: flex;
.food {
width: 160rpx;
height: 120rpx;
border-radius: 12rpx;
margin-right: 12rpx;
flex: none;
overflow: hidden;
.img {
width: 160rpx;
height: 120rpx;
}
.dishes-img {
width: 160rpx;
height: 120rpx;
border-radius: 7rpx;
flex: none;
}
}
.total {
flex: none;
line-height: 120rpx;
}
}
}
.fun-box {
display: flex;
justify-content: space-between;
align-items: flex-end;
.other-info {
flex: none;
.text {
font-size: 24rpx;
font-weight: 400;
color: #3c3c3c;
}
.margin {
margin-right: 24rpx;
}
}
.btn {
flex: none;
width: 164rpx;
height: 52rpx;
line-height: 52rpx;
background: #52acff;
border-radius: 26rpx;
font-size: 28rpx;
font-weight: 400;
color: #ffffff;
text-align: center;
box-shadow: 0 0 12rpx 3rpx rgba(0, 0, 0, 0.07);
}
.reminder {
background-color: transparent;
width: 104rpx;
color: rgba(0, 0, 0, 0.664);
}
}
}
.orange {
background-color: #f88a24 !important;
}
.purple {
background-color: #9098ff !important;
}
<wxs module="utils" src="./index.wxs"></wxs>
<wxs src="../../common/wxs/includes.wxs" module="includes" />
<view
class="order-card-outer"
bindtap="nav"
data-order-id="{{value.orderId}}"
>
<view class="info">
<view>
<text
class="store-name"
catchtap="jumpSaleroom"
data-storeid="{{value.storeId}}"
data-order-id="{{value.orderId}}"
>{{value.storeName || value.merchantName}}</text>
<view class="order-time" wx:if="{{orderType === 'nurse'}}">{{value.payTime || value.createTime}}</view>
</view>
<view class="status">
<text class="text">{{orderStatusText}}</text>
<image src="/images/rightArrow_grey.png" class="right-icon" />
</view>
</view>
<van-divider wx:if="{{orderType === 'patient'}}" custom-style="margin:0 0 24rpx 0" />
<scroll-view
class="foods-box"
scroll-x
wx:if="{{orderType === 'patient'}}"
>
<view class="foods">
<view
class="food"
wx:for="{{value.foodItemVoList}}"
wx:key="index"
>
<image
class="img"
src="{{item.image}}"
wx:if="{{item.image}}"
mode="aspectFill"
/>
<image
class="dishes-img"
lazy-load
src="https://ybm-public.oss-cn-beijing.aliyuncs.com/image/empty/image.png"
mode="aspectFill"
wx:else
/>
</view>
<view class="total">{{utils.totalFoodNames(value.foodItemVoList)}}</view>
</view>
</scroll-view>
<nurse-display-card
value="{{value}}"
in="list"
wx:else
/>
<view class="fun-box">
<view class="other-info">
<block wx:if="{{ orderType === 'patient' }}">
<text class="text margin">{{value.createTime}}</text>
<price-display
price="{{value.totalPrice}}"
custom-price-style="font-size: 30rpx"
custom-price-icon-style="font-size: 22rpx"
class="margin"
/>
<text class="text">共{{value.foodItemVoList.length}}件</text>
</block>
</view>
<view
class="btn reminder"
catchtap="takeReminder"
data-id="{{value.orderId}}"
wx:if="{{isShowReminderBtn}}"
>催单
</view>
<view
class="btn"
catchtap="goPaid"
data-id="{{value.orderId}}"
wx:if="{{value.orderStatus === 1}}"
>立即支付
</view>
<view
class="btn orange"
catchtap="ringUp"
data-phone="{{value.storePhone}}"
wx:if="{{value.type === 1 || value.type === 2}}"
>联系商家
</view>
<view
class="btn orange"
catchtap="ringUp"
data-phone="{{value.riderInfoDto.riderPhone}}"
wx:if="{{includes([102,201,202,301,501,502], value.orderStatus) && value.riderInfoDto !== null}}"
>联系骑手
</view>
<!-- <view
class="btn orange"
wx:elif="{{value.orderStatus === 202 || value.orderStatus === 301}}"
>联系护工</view>-->
<view
class="btn purple"
wx:if="{{value.isComment === 1 && !includes([602,604, 605], value.orderStatus)}}"
data-item="{{value}}"
catchtap="toEval"
data-ordertype="{{value.orderType}}"
>去评价
</view>
</view>
</view>
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-09 23:55:50
* @LastEditors: HJ
* @LastEditTime: 2021-06-18 15:29:09
*/
module.exports = {
totalFoodNames: function (value) {
var res = [];
if (value) {
for (i = 0; i < value.length; i++) {
res.push(value[i].foodName);
}
}
return res.join('+');
},
};
.order-card-outer{background-color:#fff;padding:20rpx 20rpx 28rpx;box-shadow:0 0 12rpx 3rpx rgba(0,0,0,0.07)}.order-card-outer .info{display:flex;justify-content:space-between;font-size:32rpx;line-height:32rpx;font-weight:500;color:#3c3c3c;margin-bottom:24rpx}.order-card-outer .info .status .text{margin-right:12rpx}.order-card-outer .info .status .right-icon{width:15rpx;height:24rpx}.order-card-outer .info .order-time{font-size:24rpx;font-weight:400;color:#6a6a6a;margin-top:18rpx;line-height:24rpx}.order-card-outer .foods-box{width:100%;height:144rpx}.order-card-outer .foods-box .foods{display:flex}.order-card-outer .foods-box .foods .food{width:160rpx;height:120rpx;border-radius:12rpx;margin-right:12rpx;flex:none;overflow:hidden}.order-card-outer .foods-box .foods .food .img{width:160rpx;height:120rpx}.order-card-outer .foods-box .foods .food .dishes-img{width:160rpx;height:120rpx;border-radius:7rpx;flex:none}.order-card-outer .foods-box .foods .total{flex:none;line-height:120rpx}.order-card-outer .fun-box{display:flex;justify-content:space-between;align-items:flex-end}.order-card-outer .fun-box .other-info{flex:none}.order-card-outer .fun-box .other-info .text{font-size:24rpx;font-weight:400;color:#3c3c3c}.order-card-outer .fun-box .other-info .margin{margin-right:24rpx}.order-card-outer .fun-box .btn{flex:none;width:164rpx;height:52rpx;line-height:52rpx;background:#52acff;border-radius:26rpx;font-size:28rpx;font-weight:400;color:#ffffff;text-align:center;box-shadow:0 0 12rpx 3rpx rgba(0,0,0,0.07)}.order-card-outer .fun-box .reminder{background-color:transparent;width:104rpx;color:rgba(0,0,0,0.664)}.orange{background-color:#f88a24 !important}.purple{background-color:#9098ff !important}
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-02-07 09:20:03
* @LastEditors: HJ
* @LastEditTime: 2021-07-02 16:27:16
*/
Component({
options: {
multipleSlots: true,
},
properties: {
navbarData: {
//navbarData 由父页面传递的数据,变量名字自命名
type: Object,
value: {
showCapsule: 1,
},
},
// 背景图片
bgImg: {
type: String,
value: "",
},
// 背景颜色
backgroundColor: {
type: String,
value: "",
},
// custom-style
customStyle: {
type: String,
value: "",
},
},
data: {
// 整体的高度
height: 84,
// 胶囊的高度
menuHeight: 84,
// 首页地址
homePageUrl: "/pages/public/public",
// 是否为分享
share: false,
// 左上角是否显示返回首页的按钮
isBackHome: false,
// 背景是否透明
opacity: 0,
// 胶囊的宽度
menuWidth: 87,
// 距离顶部
menuTop: 0,
},
methods: {
// 判断当前页面是否需要返回首页
computedRouter() {
const pages = getCurrentPages();
const { homePageUrl } = this.data;
if (pages.length === 1) {
const { route } = pages[0];
this.setData({
isBackHome: route !== homePageUrl,
});
}
},
// 初始化组件
init(data) {
if (data) {
const { navBarHeight, menuHeight, menuTop, menuLeft } =
getApp().globalData;
this.setData({
menuWidth: menuLeft,
menuTop: menuTop,
height: navBarHeight,
menuHeight,
});
}
},
// 返回上一页面
_navback() {
wx.navigateBack();
},
//返回到首页
_backhome() {
wx.reLaunch({
url: this.data.homePageUrl,
});
},
// 判断背景色是否透明
setOpacity(scrollTop, maxTop) {
let opacity = 0;
if (scrollTop <= maxTop) {
opacity = scrollTop / maxTop;
} else {
opacity = 1;
}
this.setData({
opacity: opacity,
});
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.computedRouter();
const { watch, navBarFlag } = getApp();
navBarFlag ? watch("navBarFlag", this.init.bind(this)) : this.init(true);
this.setData({
// 获取是否是通过分享进入的小程序
share: getApp().globalData.share,
});
},
ready() {},
// 组件被移动到其他页面
moved() {
this.computedRouter();
},
detached() {},
},
});
{
"component": true
}
\ No newline at end of file
<view class="nav-wrap" style="height: {{height || 84}}px; {{customStyle}}">
<image wx:if="{{bgImg}}" src="{{bgImg}}" class="topimg" style="height: {{height || 84}}px " />
<view class="nav-bg" style="opacity: {{opacity}}; background-color: {{backgroundColor}}" />
<view
class="nav-fun-bar"
style="height: {{menuHeight || 84}}px; top: {{menuTop || 0}}px; width: {{menuWidth || 320}}px"
>
<view class="nav-capsule" wx:if="{{navbarData.showCapsule}}">
<!-- //左上角的返回按钮,wx:if='{{!share}}'空制返回按钮显示
//从分享进入小程序时 返回上一级按钮不应该存在-->
<view bindtap="_navback" class="back-pre" wx:if="{{!isBackHome}}">
<i class="naviconfont nav-icon-fanhui" />
</view>
<!-- 返回上一级 -->
<view bindtap="_backhome" class="back-home" wx:else>
<!-- <image src="/img/back-home.png" mode="aspectFill" class="back-home" /> -->
<i class="naviconfont nav-icon-Home" />
</view>
</view>
<text class="capsule-title" wx:if="{{navbarData.title}}">{{navbarData.title}}</text>
<view class="capsule-title" wx:else>
<slot name="nav-title" />
</view>
</view>
</view>
/* 图标样式 */
@font-face {
font-family: "naviconfont";
src: url("data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAMIAAsAAAAABvQAAAK6AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqBOIEuATYCJAMMCwgABCAFhREHNxsZBsgekiRBBAGFBa4KkDiK4+FrDX1/d2+DoFARakKViQJqq6KKwkW4asO2U83CtOr+by39S4G9AOsJMZTU4Z8FfLNT4E1UESWwiiqgqq+KKyh6Pvryv5Vh4pr6/9ssCiSa51gdFkkDHOV5nnef70a4nU/QN4xd4BIeE+g2pYlwNLO0BVkKa1UgXhpaHLJyHkVh8U6h1hwssnADGp3povgB78PPx1+bkQWSJoO18eJxOgVjPyr+7OSndOjeB8BLgMcbZCwDhXhWG7kmCUaQdEvk9vSqCGkuf5sm5Oiiav/hkQRRwcrtBfMomvhR4XJS6Q7k3fVDGVQUrAI7LOSoV4dci+VCh2oHUniaNty7VJJ6+ehzdUQslCIvvm6nVCFySFSl7dc16tOXEE9UNfx1nv+mp9/DV3+F3XcX3r/78Wri1d7egR78budlvOP7q61vF57+h/8u8V1l5GHbm7aHxcoud5+D5+AFQBvmGSkE7b3SJ5n/8ze+PTo/Es0f2u/skQG+B6+Gqjbslx8CnRK9uX+vpOSANl36ON/S5qKKtXJMWzZ/J+GEbt2uBcsx7Od4xdgdmkJPjstoSYcZWtZjDiyITbBBbIMVcUbrtmTzeI8R50iiZAOLbgJaGPeRlvT7SsvG/QILYh9oUBEBK6Kc1u0yei/sMRtX1UOGcY4pkjhJjKTnUifOVTd+DPbfQO2oHWelcoV4EFlgtJL2lraa+Cy6yObbEhzTOjinhDLPITPiObRtj/jMMzHJW3TO/YHWVlr3ppak54DqEIPiOJRCJJxEGJI8LurjOLV53DH4PRuQ5ihbHGuvQ2M/CDEBYzxEuxZt/cBZidu36h5Fgcaq6cDx5QTFeBzEzDgTsu2Ih/Dr55lQEtdCHxHyDWhFjWhfScv6MueL90A368YcoiAJMtTHuKsfNeQ5z0EAAAA=")
format("woff2");
}
.naviconfont {
font-family: "naviconfont" !important;
font-size: 42rpx;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.nav-icon-fanhui:before {
content: "\e682";
}
.nav-icon-Home:before {
content: "\e622";
}
/* 顶部要固定定位 标题要居中 自定义按钮和标题要和右边微信原生的胶囊上下对齐 */
.nav-wrap {
position: fixed;
top: 0;
left: 0;
width: 100%;
color: #000;
z-index: 100;
}
.topimg {
width: 100%;
height: 100%;;
}
.nav-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 重构 */
.nav-fun-bar {
position: absolute;
display: flex;
align-items: center;
}
.nav-capsule {
display: flex;
align-items: center;
justify-content: space-between;
margin-left: 30rpx;
width: 100rpx;
height: 100%;
color: #fff;
font-size: 42rpx;
}
.back-home {
background-color: #bbb;
color: #000;
width: 60rpx;
height: 60rpx;
border-radius: 100%;
line-height: 60rpx;
text-align: center;
}
.back-home .naviconfont {
font-size: 36rpx;
vertical-align: text-bottom;
}
.capsule-title {
position: relative;
text-align: center;
width: 100%;
height: 100%;
}
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-16 17:00:32
* @LastEditors: HJ
* @LastEditTime: 2021-06-19 17:02:28
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
value: {
type: Object,
value: {},
},
in: {
type: String,
value: "",
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {}
}
.card-outer {
display: flex;
align-items: center;
.avatar {
flex: none;
width: 150rpx;
height: 150rpx;
background: #b7dcfe;
box-shadow: 0rpx 2rpx 2rpx 0rpx rgba(153, 153, 153, 0.25);
border-radius: 50%;
margin-right: 20rpx;
}
.info {
flex: 1;
.name {
font-size: 28rpx;
font-weight: 400;
color: #3c3c3c;
}
.time {
font-size: 24rpx;
font-weight: 400;
color: #6a6a6a;
}
}
.settlement {
flex: none;
width: 164rpx;
display: flex;
flex-direction: column;
align-items: center;
.price {
font-size: 28rpx;
font-weight: 400;
color: #ed430f;
}
.day {
font-size: 24rpx;
font-weight: 400;
color: #6a6a6a;
}
}
}
<wxs module="utils" src="./index.wxs"></wxs>
<view class="card-outer">
<image class="avatar" src="{{value.nursePhoto}}" mode="aspectFill" />
<view class="info">
<view class="name">{{value.nurseName}}</view>
<view
class="time"
>{{utils.computedTime(value.nurseStartTime)}}~{{utils.computedTime(value.nurseEndTime)}}</view>
</view>
<view class="settlement">
<view class="price">¥{{in === 'list' ? value.totalPrice : value.nursePrice}}</view>
<view class="day">{{in === 'list' ? '共' : 'x'}}{{value.nurseTotalDay}}天</view>
</view>
</view>
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-16 17:21:25
* @LastEditors: HJ
* @LastEditTime: 2021-06-16 17:26:45
*/
module.exports = {
computedTime: function (value) {
return value.slice(0, -3);
},
};
.card-outer{display:flex;align-items:center}.card-outer .avatar{flex:none;width:150rpx;height:150rpx;background:#b7dcfe;box-shadow:0rpx 2rpx 2rpx 0rpx rgba(153,153,153,0.25);border-radius:50%;margin-right:20rpx}.card-outer .info{flex:1}.card-outer .info .name{font-size:28rpx;font-weight:400;color:#3c3c3c}.card-outer .info .time{font-size:24rpx;font-weight:400;color:#6a6a6a}.card-outer .settlement{flex:none;width:164rpx;display:flex;flex-direction:column;align-items:center}.card-outer .settlement .price{font-size:28rpx;font-weight:400;color:#ed430f}.card-outer .settlement .day{font-size:24rpx;font-weight:400;color:#6a6a6a}
\ No newline at end of file
const arealist = require('../../api/store.js');
Component({
/**
* 组件的属性列表
*/
properties: {
show:{ //控制area_select显示隐藏
type:Boolean,
value:false
},
maskShow:{ //是否显示蒙层
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
provinces: [],
citys: [],
areas: [],
// provinces: provinces,
// citys: areaTool.getCitys(index[0]),
// areas: areaTool.getAreas(index[0], index[0]),
value:[0,0,0],
province: '',
city: '',
area: '',
resultlist:[],
index:[0,0,0]
},
// 组件的生命周期
lifetimes: {
attached: function () {
var that = this;
console.log(that.data.index);
arealist.getStore({},{
}, '加载中',
function (res) {
var results = res.results;
that.setData({
resultlist:results
})
var provinces = that.getProvinces();
var citys = that.getCitys(that.data.index[0]);
var areas = that.getAreas(that.data.index[0],that.data.index[0]);
that.setData({
provinces: provinces,
citys: citys,
areas: areas
})
console.log(that.data.provinces);
console.log(that.data.citys);
console.log(that.data.areas);
},
function (err) {
wx.showToast({
title: '失败',
})
}
)
}
},
/**
* 组件的方法列表
*/
methods: {
// setTimeout(() => {
handleNYZAreaChange:function(e){
var provinces = this.getProvinces();
// var citys = this.getCitys(index[0]);
// var areas = this.getAreas(index[0], index[0]);
var that = this;
console.log("e:" + JSON.stringify(e));
var value = e.detail.value;
/**
* 滚动的是省
* 省改变 市、区都不变
*/
if(that.data.index[0] != value[0]){
that.data.index = [value[0],0,0]
let selectCitys = that.getCitys(that.data.index[0]);
let selectAreas = that.getAreas(that.data.index[0], 0);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [that.data.index[0],0,0],
province: provinces[that.data.index[0]],
city: selectCitys[0],
area: selectAreas[0]
})
} else if (that.data.index[1] != value[1]){
/**
* 市改变了 省不变 区变
*/
that.data.index = [value[0], value[1], 0]
let selectCitys = that.getCitys(that.data.index[0]);
let selectAreas = that.getAreas(that.data.index[0], value[1]);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [that.data.index[0], that.data.index[1], 0],
province: provinces[that.data.index[0]],
city: selectCitys[that.data.index[1]],
area: selectAreas[0]
})
} else if (that.data.index[2] != value[2]){
/**
* 区改变了
*/
that.data.index = [value[0], value[1], value[2]]
let selectCitys = that.getCitys(that.data.index[0]);
let selectAreas = that.getAreas(that.data.index[0], value[1]);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [that.data.index[0], that.data.index[1], that.data.index[2]],
province: provinces[that.data.index[0]],
city: selectCitys[that.data.index[1]],
area: selectAreas[that.data.index[2]]
})
console.log('区'+that.data.area);
}
},
/**
* 确定按钮的点击事件
*/
handleNYZAreaSelect:function(e){
//console.log("e:" + JSON.stringify(e));
// setTimeout(() => {
var that = this;
if (e.currentTarget.dataset.province == "") {
e.currentTarget.dataset.province = that.data.resultlist[0].name;
e.currentTarget.dataset.city = that.data.resultlist[0].city[0].cityName;
e.currentTarget.dataset.area = that.data.resultlist[0].city[0].area[0];
}
var myEventDetail = e; // detail对象,提供给事件监听函数
var myEventOption = {}; // 触发事件的选项
this.triggerEvent('sureSelectArea', myEventDetail, myEventOption)
// }, 700)
},
/**
* 取消按钮的点击事件
*/
handleNYZAreaCancle:function(e){
var that = this;
console.log("e:" + JSON.stringify(e))
that.setData({
show:false
})
},
getProvinces:function(){
var that = this;
var provinces = [];
for (var i = 0; i < that.data.resultlist.length;i++){
provinces.push(that.data.resultlist[i].name);
}
return provinces;
},
/**
* 获取省对应的所有城市
*/
getCitys:function(provinceIndex) {
var that = this;
var citys = [];
for (var i = 0; i < that.data.resultlist[provinceIndex].city.length;i++){
citys.push(that.data.resultlist[provinceIndex].city[i].cityName);
}
return citys;
},
/**
* 获取省市对应的所有地区
*/
getAreas:function(provinceIndex, cityIndex) {
var that = this;
var areas = [];
for (var i = 0; i < that.data.resultlist[provinceIndex].city[cityIndex].area.length; i++) {
areas.push(that.data.resultlist[provinceIndex].city[cityIndex].area[i]);
}
return areas;
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--common/nyz_area_picker/nyz_area_picker.wxml-->
<!--自定义地址选择器-->
<view class="nyz_area_mask {{maskShow?(show ? 'show':'hide'):'hide'}}" catchtouchmove="true"></view>
<view class="nyz_area_view {{show ? 'show':'hide'}}" >
<view class="nyz_area_view_btns">
<text class="nyz_area_view_btn_cancle" bindtap="handleNYZAreaCancle">取消</text>
<text class="nyz_area_view_btn_sure" bindtap="handleNYZAreaSelect" data-province="{{province}}" data-city="{{city}}" data-area="{{area}}">确定</text>
</view>
<picker-view class="nyz_area_pick_view" indicator-style="height: 35px;" bindchange="handleNYZAreaChange" value="{{value}}">
<picker-view-column>
<view class="nyz_area_colum_view" wx:for="{{provinces}}" wx:key="item">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="nyz_area_colum_view" wx:for="{{citys}}" wx:key="item">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="nyz_area_colum_view" wx:for="{{areas}}" wx:key="item">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
/* common/nyz_area_picker/nyz_area_picker.wxss */
.nyz_area_view{
width: 100%;
position: fixed;
bottom:0px;
left: 0px;
background-color: #fff;
z-index: 21;
height: 657rpx;
}
.nyz_area_pick_view{
height: 240px;
width: 100%;
}
.nyz_area_colum_view{
line-height: 35px;
text-align: center;
font-size: 28rpx;
}
.hide{
display: none;
}
.show{
display: block;
}
.nyz_area_view_btns{
background-color: #fff;
border-bottom: 1px solid #eeeeee;
font-size: 30rpx;
padding: 18rpx 0rpx;
}
.nyz_area_view_btns>text{
display: inline-block;
word-spacing: 4rpx;
letter-spacing: 4rpx;
}
.nyz_area_view_btn_cancle{
color: #939393;
padding-right: 20rpx;
padding-left: 25rpx;
}
.nyz_area_view_btn_sure{
float: right;
padding-left: 20rpx;
padding-right: 25rpx;
}
.nyz_area_mask{
width: 100%;
height: 100%;
background-color: rgba(8, 8, 8, 0.8);
position: absolute;
top: 0rpx;
left: 0rpx;
z-index: 20;
/* width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
opacity: 0.5;
overflow: hidden;
z-index: 9000;
color: #fff; */
}
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-06-17 13:56:04
* @LastEditors: HJ
* @LastEditTime: 2021-06-30 17:16:58
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
orderProgress: {
type: Array,
value: [],
observer(steps) {
this.setData({
active: steps.length - 1,
steps: steps.map((i) => {
return {
text: i.progressName,
desc: i.operationTime,
activeIcon: "checked",
};
}).reverse(),
});
},
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
show: false,
active: 3,
steps: [],
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
// 关闭弹窗
onClose() {
this.setData({
show: false,
});
},
// 展示弹窗
showModal() {
this.setData({
show: true,
});
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"van-steps": "@vant/weapp/steps/index"
}
}
.step-box {
padding: 24rpx;
background-color: #fff;
width: 80%;
max-height: 1000rpx;
overflow: hidden auto;
}
\ No newline at end of file
<van-popup closeable close-icon="cross" show="{{ show }}" custom-style="width: 80%" bind:close="onClose">
<view class="step-box">
<van-steps
steps="{{ steps }}"
active="{{ active }}"
direction="vertical"
active-color="#3694ec"
/>
</view>
</van-popup>
.step-box{padding:24rpx;background-color:#fff;width:80%;max-height:1000rpx;overflow:hidden auto}
\ No newline at end of file
/*
* @Descripttion: HJ
* @Company: 思宏科技
* @version: v1.0
* @Author: HJ
* @Date: 2021-05-26 10:15:33
* @LastEditors: HJ
* @LastEditTime: 2021-06-03 15:56:09
*/
const componentOptions = {
// 组件选项
options: {
multipleSlots: true,
},
behaviors: [],
properties: {
foods: {
type: Array,
value: [],
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
nav({ currentTarget: { dataset } }) {
const { info } = dataset;
const { store, ...foodInfo } = info || {};
const { id: storeId } = store || {};
const { foodId, merchantId } = foodInfo;
if (!info || this.data.foods.length >= 4) {
wx.navigateTo({
url: `/activity/pages/preferential/index?foodId=${foodId}`,
});
return;
}
if (this.data.foods.length < 4) {
wx.setStorageSync("storeid", storeId);
wx.setStorageSync("merchantid", merchantId);
const tempFoodInfo = wx.$urlEncode(foodInfo);
wx.nextTick(() => {
wx.navigateTo({
url: `/store/pages/lunch/index?foodId=${foodId}&foodInfo=${tempFoodInfo}&from=preferential`,
});
});
}
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {},
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true,
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {},
},
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-icon": "@vant/weapp/icon/index",
"dish-card": "/Component/dish-card/index"
}
}
<view class="preferential-outer">
<view class="title-box _flex">
<text class="title">特惠套餐</text>
<view class="more _flex _align_middle" bindtap="nav" wx:if="{{foods.length > 3}}">
<text class="more-text">更多</text>
<van-icon name="arrow" />
</view>
</view>
<scroll-view
scroll-x
class="scroll-box scroll-box-{{foods.length}} scroll-box-{{foods.length > 2 ? 'vertical' : 'horizontal'}}"
>
<view class="foods _flex">
<view class="food" wx:for="{{foods}}" wx:key="index">
<dish-card
custom-class="{{foods.length > 2 ? '' : 'custom-outer'}}"
value="{{item}}"
direction="{{foods.length > 2 ? 'vertical' : 'horizontal'}}"
data-info="{{item}}"
is-in-public
bindtap="nav"
/>
</view>
<view class="more-tip _flex _just_center _align_middle" wx:if="{{foods.length > 3}}">
<van-icon name="upgrade" color="#717171" size="20px" />
<text class="more-tip-text">点击上方更多查看全部美食</text>
</view>
</view>
</scroll-view>
</view>
@import "/style/common.wxss";
.preferential-outer {
--margin-lr: 30rpx;
--padding-lr: 30rpx;
padding: 24rpx var(--padding-lr);
margin: 0 var(--margin-lr) 34rpx;
width: calc(100vw - 2 * var(--margin-lr) - 2 * var(--padding-lr));
background-color: #f9f9f9;
border-radius: 7rpx;
}
.title-box {
height: 34rpx;
margin-bottom: 24rpx;
justify-content: space-between;
}
.title {
color: #333;
font-size: 36rpx;
font-weight: 500;
line-height: 34rpx;
}
.more {
color: #3694ec;
font-size: 24rpx;
}
.scroll-box {
width: 100%;
}
.foods .food:last-child {
margin-right: 0;
}
.scroll-box-vertical {
height: 320rpx;
}
.scroll-box-horizontal {
height: 130rpx;
}
.scroll-box-vertical .food {
margin-right: 15rpx;
}
.scroll-box-3 .food {
margin-right: 35rpx;
}
.scroll-box-horizontal .food {
flex: none;
width: calc(50% - 9rpx);
margin-right: 18rpx;
}
.scroll-box-1 .food {
width: 100%;
margin-right: 0rpx;
}
.more-tip {
flex-direction: column;
margin-left: 7rpx;
}
.more-tip-text {
display: inline-block;
width: 2em;
margin-top: 13rpx;
color: #717171;
font-size: 22rpx;
}
.custom-outer {
--dishes-img-width: 120rpx;
--dishes-img-height: 116rpx;
--ml: 10rpx;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment