Repository: woniudiancang/bee
Branch: master
Commit: d26ceea613c7
Files: 653
Total size: 1.2 MB
Directory structure:
gitextract_db_bu7mz/
├── .gitignore
├── LICENSE
├── README.md
├── app.js
├── app.json
├── app.wxss
├── components/
│ ├── parser.20200731.min/
│ │ ├── libs/
│ │ │ ├── CssHandler.js
│ │ │ ├── MpHtmlParser.js
│ │ │ └── config.js
│ │ ├── parser.js
│ │ ├── parser.json
│ │ ├── parser.wxml
│ │ ├── parser.wxss
│ │ └── trees/
│ │ ├── trees.js
│ │ ├── trees.json
│ │ ├── trees.wxml
│ │ └── trees.wxss
│ └── payment/
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ └── sn.txt
├── config.js
├── i18n/
│ ├── en.js
│ ├── index.js
│ └── zh_CN.js
├── miniprogram_npm/
│ ├── @vant/
│ │ └── weapp/
│ │ ├── action-sheet/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── area/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── button/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── calendar/
│ │ │ ├── calendar.wxml
│ │ │ ├── components/
│ │ │ │ ├── header/
│ │ │ │ │ ├── index.d.ts
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── index.json
│ │ │ │ │ ├── index.wxml
│ │ │ │ │ └── index.wxss
│ │ │ │ └── month/
│ │ │ │ ├── index.d.ts
│ │ │ │ ├── index.js
│ │ │ │ ├── index.json
│ │ │ │ ├── index.wxml
│ │ │ │ ├── index.wxs
│ │ │ │ └── index.wxss
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ ├── utils.d.ts
│ │ │ ├── utils.js
│ │ │ └── utils.wxs
│ │ ├── card/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── cascader/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── cell/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── cell-group/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── checkbox/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── checkbox-group/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── circle/
│ │ │ ├── canvas.d.ts
│ │ │ ├── canvas.js
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── col/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── collapse/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── collapse-item/
│ │ │ ├── animate.d.ts
│ │ │ ├── animate.js
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── common/
│ │ │ ├── color.d.ts
│ │ │ ├── color.js
│ │ │ ├── component.d.ts
│ │ │ ├── component.js
│ │ │ ├── index.wxss
│ │ │ ├── relation.d.ts
│ │ │ ├── relation.js
│ │ │ ├── style/
│ │ │ │ ├── clearfix.wxss
│ │ │ │ ├── ellipsis.wxss
│ │ │ │ ├── hairline.wxss
│ │ │ │ ├── mixins/
│ │ │ │ │ ├── clearfix.wxss
│ │ │ │ │ ├── ellipsis.wxss
│ │ │ │ │ └── hairline.wxss
│ │ │ │ └── var.wxss
│ │ │ ├── utils.d.ts
│ │ │ ├── utils.js
│ │ │ ├── validator.d.ts
│ │ │ ├── validator.js
│ │ │ ├── version.d.ts
│ │ │ └── version.js
│ │ ├── config-provider/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxs
│ │ ├── count-down/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── utils.d.ts
│ │ │ └── utils.js
│ │ ├── datetime-picker/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── definitions/
│ │ │ ├── index.d.ts
│ │ │ └── index.js
│ │ ├── dialog/
│ │ │ ├── dialog.d.ts
│ │ │ ├── dialog.js
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── divider/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── dropdown-item/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── shared.d.ts
│ │ │ └── shared.js
│ │ ├── dropdown-menu/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── empty/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── field/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ ├── input.wxml
│ │ │ ├── props.d.ts
│ │ │ ├── props.js
│ │ │ ├── textarea.wxml
│ │ │ ├── types.d.ts
│ │ │ └── types.js
│ │ ├── goods-action/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── goods-action-button/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── goods-action-icon/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── grid/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── grid-item/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── icon/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── image/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── index-anchor/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── index-bar/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── info/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── loading/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── mixins/
│ │ │ ├── basic.d.ts
│ │ │ ├── basic.js
│ │ │ ├── button.d.ts
│ │ │ ├── button.js
│ │ │ ├── link.d.ts
│ │ │ ├── link.js
│ │ │ ├── page-scroll.d.ts
│ │ │ ├── page-scroll.js
│ │ │ ├── touch.d.ts
│ │ │ ├── touch.js
│ │ │ ├── transition.d.ts
│ │ │ └── transition.js
│ │ ├── nav-bar/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── notice-bar/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── notify/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ ├── notify.d.ts
│ │ │ └── notify.js
│ │ ├── overlay/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ └── overlay.wxml
│ │ ├── panel/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── picker/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ ├── shared.d.ts
│ │ │ ├── shared.js
│ │ │ └── toolbar.wxml
│ │ ├── picker-column/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── popup/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ └── popup.wxml
│ │ ├── progress/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── radio/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── radio-group/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── rate/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── row/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── search/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── share-sheet/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ ├── options.d.ts
│ │ │ ├── options.js
│ │ │ ├── options.json
│ │ │ ├── options.wxml
│ │ │ ├── options.wxs
│ │ │ └── options.wxss
│ │ ├── sidebar/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── sidebar-item/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── skeleton/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── slider/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── stepper/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── steps/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── sticky/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── submit-bar/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── swipe-cell/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── switch/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── tab/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── tabbar/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── tabbar-item/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ ├── tabs/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── tag/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── toast/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ ├── toast.d.ts
│ │ │ └── toast.js
│ │ ├── transition/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── tree-select/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ └── index.wxss
│ │ ├── uploader/
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxs
│ │ │ ├── index.wxss
│ │ │ ├── shared.d.ts
│ │ │ ├── shared.js
│ │ │ ├── utils.d.ts
│ │ │ └── utils.js
│ │ └── wxs/
│ │ ├── add-unit.wxs
│ │ ├── array.wxs
│ │ ├── bem.wxs
│ │ ├── memoize.wxs
│ │ ├── object.wxs
│ │ ├── style.wxs
│ │ └── utils.wxs
│ ├── apifm-wxapi/
│ │ └── index.js
│ ├── wxa-plugin-canvas/
│ │ ├── index/
│ │ │ ├── index.js
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ └── index.wxss
│ │ └── poster/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ └── poster.js
│ └── wxbarcode/
│ └── index.js
├── package.json
├── pages/
│ ├── about/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── ad/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── all-orders/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── asset/
│ │ ├── cash-log.js
│ │ ├── cash-log.json
│ │ ├── cash-log.wxml
│ │ ├── cash-log.wxss
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── recharge-log.js
│ │ ├── recharge-log.json
│ │ ├── recharge-log.wxml
│ │ └── recharge-log.wxss
│ ├── booking/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── card/
│ │ ├── exchange.js
│ │ ├── exchange.json
│ │ ├── exchange.wxml
│ │ ├── exchange.wxss
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── logs.js
│ │ ├── logs.json
│ │ ├── logs.wxml
│ │ ├── logs.wxss
│ │ ├── receive.js
│ │ ├── receive.json
│ │ ├── receive.wxml
│ │ ├── receive.wxss
│ │ ├── send.js
│ │ ├── send.json
│ │ ├── send.wxml
│ │ └── send.wxss
│ ├── cart/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── order.js
│ │ ├── order.json
│ │ ├── order.wxml
│ │ └── order.wxss
│ ├── coupons/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── goods/
│ │ ├── list.js
│ │ ├── list.json
│ │ ├── list.wxml
│ │ └── list.wxss
│ ├── goods-details/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── home/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── index/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── member-center/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── my/
│ │ ├── feedback.js
│ │ ├── feedback.json
│ │ ├── feedback.wxml
│ │ ├── feedback.wxss
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── user-code.js
│ │ ├── user-code.json
│ │ ├── user-code.wxml
│ │ └── user-code.wxss
│ ├── notice/
│ │ ├── detail.js
│ │ ├── detail.json
│ │ ├── detail.wxml
│ │ └── detail.wxss
│ ├── order-details/
│ │ ├── doing.js
│ │ ├── doing.json
│ │ ├── doing.wxml
│ │ ├── doing.wxss
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── scan-result.js
│ │ ├── scan-result.json
│ │ ├── scan-result.wxml
│ │ └── scan-result.wxss
│ ├── pay/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── queue/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── score/
│ │ ├── logs.js
│ │ ├── logs.json
│ │ ├── logs.wxml
│ │ └── logs.wxss
│ ├── shop/
│ │ ├── detail.js
│ │ ├── detail.json
│ │ ├── detail.wxml
│ │ ├── detail.wxss
│ │ ├── join-apply.js
│ │ ├── join-apply.json
│ │ ├── join-apply.wxml
│ │ ├── join-apply.wxss
│ │ ├── select.js
│ │ ├── select.json
│ │ ├── select.wxml
│ │ └── select.wxss
│ ├── sign/
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ └── youhui-pay/
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── project.config.json
├── project.private.config.json
├── sitemap.json
└── utils/
├── auth.js
├── image.js
├── pay.js
├── runtime.js
├── tools.js
└── util.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
dist/
package-lock.json
node_modules/
.DS_Store
================================================
FILE: LICENSE
================================================
木兰宽松许可证, 第2版
木兰宽松许可证, 第2版
2020年1月 http://license.coscl.org.cn/MulanPSL2
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
0. 定义
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
“法人实体”是指提交贡献的机构及其“关联实体”。
“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
1. 授予版权许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
2. 授予专利许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
3. 无商标许可
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
4. 分发限制
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
5. 免责声明与责任限制
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
6. 语言
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
条款结束
如何将木兰宽松许可证,第2版,应用到您的软件
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
3, 请将如下声明文本放入每个源文件的头部注释中。
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
Mulan Permissive Software License,Version 2
Mulan Permissive Software License,Version 2 (Mulan PSL v2)
January 2020 http://license.coscl.org.cn/MulanPSL2
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
0. Definition
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
Contribution means the copyrightable work licensed by a particular Contributor under this License.
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
Legal Entity means the entity making a Contribution and all its Affiliates.
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
1. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
2. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
3. No Trademark License
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
4. Distribution Restriction
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
5. Disclaimer of Warranty and Limitation of Liability
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
6. Language
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
END OF THE TERMS AND CONDITIONS
How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
================================================
FILE: README.md
================================================
# 微信小程序——餐饮点餐商城
微信小程序——餐饮点餐商城,是针对餐饮行业推出的一套完整的餐饮解决方案,实现了用户在线点餐下单、外卖、叫号排队、支付、配送等功能,完美的使餐饮行业更高效便捷!
大家如果在使用过程有什么问题,欢迎通过lssues与我们交流!
如果本项目对您有所帮助或者启发,请给我们 Star 吧,您的鼓励是我们最大对动力~
# 加微信联系我
# 自提/外卖 扫码体验
# 扫码点餐演示
| 座号A1 | 座号A2 | 座号A3 | 座号A4 | 座号A5 |
| :------: | :------: | :------: | :------: | :------: |
|
|
|
|
|
|
| 座号A6 | 座号A7 | 座号A8 | 座号A9 | 座号A10 |
| :------: | :------: | :------: | :------: | :------: |
|
|
|
|
|
|
# 本项目使用了下面的组件,在此鸣谢
- [vant-UI库](https://youzan.github.io/vant-weapp/)
- [小程序在线接口-SDK](https://github.com/gooking/apifm-wxapi)
- [api工厂](https://admin.s2m.cc)
- [FMUI-轻松活泼-icon](https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=17041)
- [小程序HTML解析组件](https://github.com/jin-yufeng/Parser)
- [生成条码和二维码](https://github.com/alsey/wxbarcode)
# 其他优秀开源模板推荐
- [天使童装](https://github.com/EastWorld/wechat-app-mall) / [码云镜像](https://gitee.com/javazj/wechat-app-mall) / [GitCode镜像](https://gitcode.com/gooking2/wechat-app-mall)
- [天使童装(uni-app版本)](https://github.com/gooking/uni-app-mall) / [码云镜像](https://gitee.com/javazj/uni-app-mall) / [GitCode镜像](https://gitcode.com/gooking2/uni-app-mall)
- [简约精品商城(uni-app版本)](https://github.com/gooking/uni-app--mini-mall) / [码云镜像](https://gitee.com/javazj/uni-app--mini-mall) / [GitCode镜像](https://gitcode.com/gooking2/uni-app--mini-mall)
- [舔果果小铺(升级版)](https://github.com/gooking/TianguoguoXiaopu)
- [面馆风格小程序](https://gitee.com/javazj/noodle_shop_procedures)
- [AI名片](https://github.com/gooking/visitingCard) / [码云镜像](https://gitee.com/javazj/visitingCard) / [GitCode镜像](https://gitcode.com/gooking2/visitingCard)
- [仿海底捞订座排队 (uni-app)](https://github.com/gooking/dingzuopaidui) / [码云镜像](https://gitee.com/javazj/dingzuopaidui) / [GitCode镜像](https://gitcode.com/gooking2/dingzuopaidui)
- [H5版本商城/餐饮](https://github.com/gooking/vueMinishop) / [码云镜像](https://gitee.com/javazj/vueMinishop) / [GitCode镜像](https://gitcode.com/gooking2/vueMinishop)
- [餐饮点餐](https://github.com/woniudiancang/bee) / [码云镜像](https://gitee.com/woniudiancang/bee) / [GitCode镜像](https://gitcode.com/gooking2/bee)
- [企业微展](https://github.com/gooking/qiyeweizan) / [码云镜像](https://gitee.com/javazj/qiyeweizan) / [GitCode镜像](https://gitcode.com/gooking2/qiyeweizan)
- [无人棋牌室](https://github.com/gooking/wurenqipai) / [码云镜像](https://gitee.com/javazj/wurenqipai) / [GitCode镜像](https://gitcode.com/gooking2/wurenqipai)
- [酒店客房服务小程序](https://github.com/gooking/hotelRoomService) / [码云镜像](https://gitee.com/javazj/hotelRoomService) / [GitCode镜像](https://gitcode.com/gooking2/hotelRoomService)
- [面包店风格小程序](https://github.com/gooking/bread) / [码云镜像](https://gitee.com/javazj/bread) / [GitCode镜像](https://gitcode.com/gooking2/bread)
- [朋友圈发圈素材小程序](https://github.com/gooking/moments) / [码云镜像](https://gitee.com/javazj/moments) / [GitCode镜像](https://gitcode.com/gooking2/moments)
- [小红书企业微展](https://github.com/gooking/xhs-qiyeweizan) / [码云镜像](https://gitee.com/javazj/xhs-qiyeweizan) / [GitCode镜像](https://gitcode.com/gooking2/xhs-qiyeweizan)
- [旧物回收、废品回收](https://github.com/gooking/recycle) / [码云镜像](https://gitee.com/javazj/recycle) / [GitCode镜像](https://gitcode.com/gooking2/recycle)
- [会员卡(饭卡)储值消费系统](https://github.com/gooking/mealcard) / [码云镜像](https://gitee.com/javazj/mealcard) / [GitCode镜像](https://gitcode.com/gooking2/mealcard)
# 使用教程
## 注册开通小程序账号
https://mp.weixin.qq.com/
根据自己的实际情况选择 “企业”、“个体工商户”身份,注册小程序账号,商城类小程序不支持个人用户上线,所以一定要选择企业或者个体户,获得你自己小程序的 appid 和 secret 信息,保存好,下面会用到:
- [如何查看小程序的AppID和AppSecret](https://jingyan.baidu.com/article/642c9d340305e3644a46f795.html)
你需要设置小程序的合法域名,否则开发工具上运行正常,手机访问的时候将看不到数据
- [设置合法服务器域名](https://www.yuque.com/apifm/doc/tvpou9)
## 注册开通后台账号
https://admin.s2m.cc/
免费注册开通新后台后登录,登录后的首页,请记下你的专属域名,后面会用到
左侧菜单 “工厂设置” --> “数据克隆” --> “将别人的数据克隆给我”
对方商户ID填写 27
点击 “立即克隆”,克隆成功后,F5 刷新一下后台
## 配置小程序APPID/SECRET
左侧菜单,微信设置,填写配置上一步获得的 appid 和 secret
这一步很重要!!!
如果没有正确配置,下面步骤中打开小程序将无法连接你的后台
## 配置微信支付
左侧菜单,系统设置 --> 在线支付配置,填写您自己的微信支付的信息
## 下载安装开发工具
https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
## 运行小程序看效果
双击运行第一步安装的小程序开发工具,打开看效果:
导入项目这里,目录选择你 “第二步” 中下载并加压的小程序代码所在目录
APPID 务必要改成你自己的小程序的 APPID
APPID 务必要改成你自己的小程序的 APPID
APPID 务必要改成你自己的小程序的 APPID
然后点击导入按钮
- [如何查看小程序的AppID和AppSecret](https://jingyan.baidu.com/article/642c9d340305e3644a46f795.html)
## 配置对接你自己的后台
在开发工具中 config.js 中的subDomain 改成你自己专属域名, ctrl + s 保存
- [如何查看自己的subDomain](https://www.yuque.com/apifm/doc/qr6l4m)
## 用户自提的订单如何扫码核销
用户选择自提的订单,会在底部取餐菜单界面显示订单信息以及取餐码,商家可通过 “我的” --> “扫码核销” 菜单,点击以后调起手机相机,扫用户出示的取餐码完成核销
但是默认情况下,是看不见 “我的” --> “扫码核销” 菜单的,需要在后台 “系统设置” --> “系统参数” ,添加文本类型的参数:
- 参数名 order_hx_uids
- 参数值,具有核销权限的用户的用户编号,多个用户编号,使用英文的逗号分隔
重新进入小程序以后,就可以看见 “扫码核销” 的菜单了
## 桌号管理
登录后台,左侧菜单 “桌号管理”,添加并管理你的桌号信息,添加以后在列表你将可以看到 ID 和 密钥,这两个数据用来生成桌子的二维码
## 生成桌子二维码
例如上面的ID为 308,密钥为 d3PiIY,那么现在去左侧菜单微信设置 -> 小程序设置 -> 获取小程序二维码(圆形码),即可获取小程序码:
填写信息如下:
- 页面路径: pages/index/index
- scene参数: 12879,308,d3PiIY
- 其中 12879 为门店ID,逗号一定是英文的逗号,而且不要有空格,注意检查下
其中 shopId 为你对应的门店ID,其他参数默认就可以了
## 如何修改小程序首页标题
登录后台,左侧菜单 “系统设置” --> “系统参数” ,添加一个文本类型的参数: mallName (注意大小写),小程序即可显示你后台填的名称
## 根据选择的不同门店,区分显示商品(只显示当前门店的商品)
登录后台,左侧菜单 “系统设置” --> “系统参数” ,添加一个开关类型的参数: shop_goods_split,开启为区分,关闭为不区分
## 如何设置服务范围(多少公里)
后台 “商场管理” --> “门店管理” ,编辑门店,服务距离处,填写你希望配送的距离即可
## 如何显示销量
商品列表接口、商品详情接口,都会返回商品的销量数据,分别是 numberOrders 和 numberSells 两个字段,你可以在界面上任何希望显示销量的地方,进行展示即可
- numberOrders 订单数量
- numberSells 商品数量
假如说用户下了一个订单一次性购买10份这个商品,那么 numberOrders = 1 ,numberSells = 10
## 如何区分门店显示商品
后台左侧菜单“系统设置” -> “系统参数”,增加一个开关类型的参数: shop_goods_split
开启则只会显示当前门店的商品,关闭则显示所有门店的商品
## 在线订座如何配置
1. 左侧菜单 “预约报名” --> “项目设置” ,添加一个项目,添加完以后会得到一个编号
2. 左侧菜单 “系统设置” --> “系统参数”, 修改编号为 `zxdz` 的参数,将你的编号填进去即可
## 配置达达配送
1. [如何对接达达配送,先按这个教程完成配置](https://www.yuque.com/apifm/doc/gxk08t)
2. 后台 “商城管理” --> “门店管理”, 编辑,门店编号填写你达达对应的门店编号,生鲜配送输入框填写 `dada`
## 二次开发如何使用国际化实现多语言
1. `js` 文件中,onload 方法中,加入: `getApp().initLanguage(this)` ;注意这里的路径要填正确,否则提示文件找不到;
2. 页面中可以直接显示语言包中的内容: `{{ $t.test.name }}`;
3. 语言内容,直接修改 `i18n` 文件夹中对应的语言的文件即可;
## 打印机配置自动出票
1. [打印机配置教程](https://www.it120.cc/help/ggrun8.html)
2. [打印机模板变量详细说明](https://www.it120.cc/help/wtviya.html)
3. 小票机模板: [小票机模版①](https://www.it120.cc/help/xc2hk2q4yrop12ll.html) [小票机模版②](https://www.it120.cc/help/taan6w2wvt6d00mg.html) [小票机模版③](https://www.it120.cc/help/vn7l4p2m28x7x30h.html)
3. 杯贴机模板: [杯贴机模版①](https://www.it120.cc/help/nl0frezogy8uunet.html) [杯贴机模版②](https://www.it120.cc/help/mlcqigcmz1ggydw2.html)
# 常见问题
## 无法登陆 / 无法获取 openid
1. 请检查 config.js 文件中的 subDomain 是否已经修改成你自己的专属域名了
[如何查看自己的subDomain](https://www.yuque.com/apifm/doc/qr6l4m)
2. 确保下面3个地方的 appID 你填的是一样的
- 登录你的小程序商户后台(https://mp.weixin.qq.com)左侧菜单 “开发” --> “开发设置” 中的 appid
- 点击你的小程序开发工具 右上角 的“详情” --> “基本信息” 中的 appid
- 登录你的 api工厂 后台(https://admin.s2m.cc),左侧菜单平台设置,微信小程序中的 appid
## 获取手机号码失败,提示没权限
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
官方文档有说明,获取手机号码的前提条件是:非个人开发者,且完成了认证的小程序开放(不包含海外主体)
## wx.getLocation 改为 wx.getFuzzyLocation (getLocation的接口权限太难申请了)
微信申请 getLocation 接口的审核比较严格,可能比较难申请到这个接口,可以用 wx.getFuzzyLocation 来代替: https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html
开发工具,全局替换以下代码:
需要替换3次
`scope.userLocation` 替换为 `scope.userFuzzyLocation`
如图:
再全局替换代码:
`wx.getLocation` 替换为 `wx.getFuzzyLocation`
再全局替换代码:
`"getLocation"` 替换为 `"getFuzzyLocation"`
## 小程序订单中心path 怎么填
请填写 `pages/all-orders/index`
## 小程序订单发货的地址怎么填
小程序订单管理 -> 订单信息录入 -> 小程序商品订单详情path
`pages/order-details/index?payOrderNo=${商品订单号}`
直接一模一样复制上面的这个填进去就行
## 微信支付MA授权(appid和mch_id不匹配)
[微信支付MA授权(appid和mch_id不匹配)](https://www.yuque.com/apifm/doc/zrui8q)
## 使用国际化多语言,切换语言后底部菜单显示不对
`/i18n/index.js` 文件里面的菜单内容估计忘记修改了
## 商家入驻申请页面
1. app.json 中,添加一个页面路径: `pages/shop/join-apply`
2. pages/shop/select 页面最下面的入口代码放开
================================================
FILE: app.js
================================================
const WXAPI = require('apifm-wxapi')
const CONFIG = require('config.js')
const AUTH = require('utils/auth')
const i18n = require("i18n/index")
App({
onLaunch: function() {
i18n.getLanguage()
this.setTabBarLanguage()
const $t = i18n.$t()
WXAPI.init(CONFIG.subDomain)
WXAPI.setMerchantId(CONFIG.merchantId)
const that = this;
// 检测新版本
const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
wx.showModal({
confirmText: $t.common.confirm,
cancelText: $t.common.cancel,
content: $t.common.upgrade,
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
/**
* 初次加载判断网络情况
* 无网络状态下根据实际情况进行调整
*/
wx.getNetworkType({
success(res) {
const networkType = res.networkType
if (networkType === 'none') {
that.globalData.isConnected = false
wx.showToast({
title: $t.common.noNetwork,
icon: 'loading'
})
}
}
});
/**
* 监听网络状态变化
* 可根据业务需求进行调整
*/
wx.onNetworkStatusChange(function(res) {
if (!res.isConnected) {
that.globalData.isConnected = false
wx.showToast({
title: $t.common.networkDown,
icon: 'loading'
})
} else {
that.globalData.isConnected = true
wx.hideToast()
}
})
WXAPI.queryConfigBatch('mallName,myBg,mapPos,order_hx_uids,subscribe_ids,share_profile,zxdz,admin_uids,shop_goods_split,QQ_MAP_KEY,shop_join_open,create_order_select_time,packaging_fee,customerServiceChatCorpId,customerServiceChatUrl,alipay,share_pic,tihuodianOpen').then(res => {
if (res.code == 0) {
res.data.forEach(config => {
wx.setStorageSync(config.key, config.value);
})
if (this.configLoadOK) {
this.configLoadOK()
}
}
})
},
onShow (e) {
if (e && e.query && e.query.scene) {
const scene = decodeURIComponent(e.query.scene) // 处理扫码进商品详情页面的逻辑
if (scene && scene.split(',').length == 3) {
// 扫码点餐
} else {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.authorize().then(() => {
this.getUserApiInfo()
})
} else {
this.getUserApiInfo()
}
})
}
} else {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.authorize().then(() => {
this.getUserApiInfo()
})
} else {
this.getUserApiInfo()
}
})
}
// 保存邀请人
if (e && e.query && e.query.inviter_id) {
wx.setStorageSync('referrer', e.query.inviter_id)
if (e.shareTicket) {
wx.getShareInfo({
shareTicket: e.shareTicket,
success: res => {
console.log(res)
console.log({
referrer: e.query.inviter_id,
encryptedData: res.encryptedData,
iv: res.iv
})
wx.login({
success(loginRes) {
if (loginRes.code) {
WXAPI.shareGroupGetScore(
loginRes.code,
e.query.inviter_id,
res.encryptedData,
res.iv
).then(_res => {
console.log(_res)
}).catch(err => {
console.error(err)
})
} else {
console.error(loginRes.errMsg)
}
}
})
}
})
}
}
this.refreshStorageShopInfo()
},
async refreshStorageShopInfo() {
// 刷新本地缓存的门店信息 https://www.yuque.com/apifm/nu0f75/cu4cfi
let shopInfo = wx.getStorageSync('shopInfo')
if (!shopInfo) {
return
}
const res = await WXAPI.shopSubdetail(shopInfo.id)
if (res.code == 0) {
const distance = shopInfo.distance
shopInfo = res.data.info
shopInfo.distance = distance
wx.setStorageSync('shopInfo', shopInfo)
}
},
initLanguage(_this) {
_this.setData({
language: i18n.getLanguage(),
$t: i18n.$t(),
})
},
changeLang(_this) {
const langs = i18n.langs
const nameArray = []
langs.forEach(ele => nameArray.push(ele.name))
wx.showActionSheet({
itemList: nameArray,
success: (e) => {
const lang = langs[e.tapIndex]
wx.setStorageSync('Language', lang.code)
_this.setData({
language: i18n.getLanguage(),
$t: i18n.$t(),
})
this.setTabBarLanguage()
}
})
},
setTabBarLanguage() {
i18n.setTabBarLanguage()
},
async getUserApiInfo() {
const token = wx.getStorageSync('token')
if (!token) {
return null
}
// https://www.yuque.com/apifm/nu0f75/zgf8pu
const res = await WXAPI.userDetail(token)
if (res.code == 0) {
this.globalData.apiUserInfoMap = res.data
if (this.getUserDetailOK) {
this.getUserDetailOK(res.data)
}
return res.data
}
},
globalData: {
isConnected: true
}
})
================================================
FILE: app.json
================================================
{
"pages": [
"pages/home/index",
"pages/index/index",
"pages/all-orders/index",
"pages/my/index",
"pages/my/feedback",
"pages/my/user-code",
"pages/ad/index",
"pages/pay/index",
"pages/shop/select",
"pages/shop/detail",
"pages/shop/join-apply",
"pages/youhui-pay/index",
"pages/member-center/index",
"pages/order-details/index",
"pages/order-details/scan-result",
"pages/order-details/doing",
"pages/about/index",
"pages/coupons/index",
"pages/booking/index",
"pages/asset/index",
"pages/asset/recharge-log",
"pages/asset/cash-log",
"pages/sign/index",
"pages/score/logs",
"pages/notice/detail",
"pages/queue/index",
"pages/cart/index",
"pages/cart/order",
"pages/goods-details/index",
"pages/goods/list",
"pages/card/index",
"pages/card/logs",
"pages/card/exchange",
"pages/card/send",
"pages/card/receive"
],
"requiredPrivateInfos": [
"getLocation",
"chooseLocation",
"chooseAddress"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#6e6d6b",
"selectedColor": "#e64340",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/home/index",
"iconPath": "images/nav/home-off.png",
"selectedIconPath": "images/nav/home-on.png",
"text": "首页"
},
{
"pagePath": "pages/index/index",
"iconPath": "images/nav/index-off.png",
"selectedIconPath": "images/nav/index-on.png",
"text": "点餐"
},
{
"pagePath": "pages/queue/index",
"iconPath": "images/nav/qh-off.png",
"selectedIconPath": "images/nav/qh-on.png",
"text": "取号"
},
{
"pagePath": "pages/order-details/doing",
"iconPath": "images/nav/qc-off.png",
"selectedIconPath": "images/nav/qc-on.png",
"text": "取餐"
},
{
"pagePath": "pages/my/index",
"iconPath": "images/nav/my-off.png",
"selectedIconPath": "images/nav/my-on.png",
"text": "我的"
}
]
},
"permission": {
"scope.userLocation": {
"desc": "获取离你最近的门店"
}
},
"usingComponents": {
"parser":"/components/parser.20200731.min/parser",
"payment": "/components/payment/index",
"van-button": "@vant/weapp/button/index",
"van-sidebar": "@vant/weapp/sidebar/index",
"van-sidebar-item": "@vant/weapp/sidebar-item/index",
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
"van-card": "@vant/weapp/card/index",
"van-submit-bar": "@vant/weapp/submit-bar/index",
"van-popup": "@vant/weapp/popup/index",
"van-stepper": "@vant/weapp/stepper/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index",
"van-empty": "@vant/weapp/empty/index",
"van-field": "@vant/weapp/field/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-overlay": "@vant/weapp/overlay/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-notice-bar": "@vant/weapp/notice-bar/index",
"van-tabbar": "@vant/weapp/tabbar/index",
"van-tabbar-item": "@vant/weapp/tabbar-item/index",
"van-tag": "@vant/weapp/tag/index",
"van-goods-action": "@vant/weapp/goods-action/index",
"van-goods-action-icon": "@vant/weapp/goods-action-icon/index",
"van-goods-action-button": "@vant/weapp/goods-action-button/index",
"van-uploader": "@vant/weapp/uploader/index",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index",
"van-count-down": "@vant/weapp/count-down/index",
"van-progress": "@vant/weapp/progress/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-sticky": "@vant/weapp/sticky/index"
},
"sitemapLocation": "sitemap.json"
}
================================================
FILE: app.wxss
================================================
page {
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica,
Segoe UI, Arial, Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei',
sans-serif;
}
page,view,image,input {
display: block;
box-sizing: border-box;
}
.badge {
position: absolute;
top: 0;
right: 0;
box-sizing: border-box;
width: 38rpx;
height: 38rpx;
line-height: 38rpx;
color: #fff;
font-size: 20rpx;
text-align: center;
background-color: #e64340;
border: 1rpx solid #fff;
border-radius: 50%;
}
.block-btn {
padding: 0 32rpx;
}
================================================
FILE: components/parser.20200731.min/libs/CssHandler.js
================================================
function t(t){var s=Object.assign(Object.create(null),i.userAgentStyles);for(var h in t)s[h]=(s[h]?s[h]+";":"")+t[h];this.styles=s}function s(t,s){this.data=t,this.floor=0,this.i=0,this.list=[],this.res=s,this.state=this.Space}var i=require("./config.js"),h=function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"};t.prototype.getStyle=function(t){this.styles=new s(t,this.styles).parse()},t.prototype.match=function(t,s){var i,h=(i=this.styles[t])?i+";":"";if(s.class)for(var e,a=s.class.split(" "),o=0;e=a[o];o++)(i=this.styles["."+e])&&(h+=i+";");return(i=this.styles["#"+s.id])&&(h+=i+";"),h},module.exports=t,s.prototype.parse=function(){for(var t;t=this.data[this.i];this.i++)this.state(t);return this.res},s.prototype.section=function(){return this.data.substring(this.start,this.i)},s.prototype.Space=function(t){"."==t||"#"==t||h(t)?(this.start=this.i,this.state=this.Name):"/"==t&&"*"==this.data[this.i+1]?this.Comment():i.blankChar[t]||";"==t||(this.state=this.Ignore)},s.prototype.Comment=function(){this.i=this.data.indexOf("*/",this.i)+1,this.i||(this.i=this.data.length),this.state=this.Space},s.prototype.Ignore=function(t){"{"==t?this.floor++:"}"!=t||--this.floor||(this.state=this.Space)},s.prototype.Name=function(t){i.blankChar[t]?(this.list.push(this.section()),this.state=this.NameSpace):"{"==t?(this.list.push(this.section()),this.Content()):","==t?(this.list.push(this.section()),this.Comma()):!h(t)&&(t<"0"||t>"9")&&"-"!=t&&"_"!=t&&(this.state=this.Ignore)},s.prototype.NameSpace=function(t){"{"==t?this.Content():","==t?this.Comma():i.blankChar[t]||(this.state=this.Ignore)},s.prototype.Comma=function(){for(;i.blankChar[this.data[++this.i]];);"{"==this.data[this.i]?this.Content():(this.start=this.i--,this.state=this.Name)},s.prototype.Content=function(){this.start=++this.i,-1==(this.i=this.data.indexOf("}",this.i))&&(this.i=this.data.length);for(var t,s=this.section(),i=0;t=this.list[i++];)this.res[t]?this.res[t]+=";"+s:this.res[t]=s;this.list=[],this.state=this.Space}
================================================
FILE: components/parser.20200731.min/libs/MpHtmlParser.js
================================================
// 小程序富文本插件 https://github.com/jin-yufeng/Parser
var emoji;function t(t){var s=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.attrs={},this.CssHandler=new e(r.tagStyle,a),this.data=t,this.domain=r.domain,this.DOM=[],this.i=this.start=this.audioNum=this.imgNum=this.videoNum=0,r.prot=(this.domain||"").includes("://")?this.domain.split("://")[0]:"http",this.options=r,this.state=this.Text,this.STACK=[],this.bubble=function(){for(var t,e=s.STACK.length;t=s.STACK[--e];){if(i.richOnlyTags[t.name])return"table"!=t.name||Object.hasOwnProperty.call(t,"c")||(t.c=1),!1;t.c=1}return!0},this.decode=function(t,s){for(var e,a,r=-1;;){if(-1==(r=t.indexOf("&",r+1)))break;if(-1==(e=t.indexOf(";",r+2)))break;"#"==t[r+1]?(a=parseInt(("x"==t[r+2]?"0":"")+t.substring(r+2,e)),isNaN(a)||(t=t.substr(0,r)+String.fromCharCode(a)+t.substr(e+1))):(a=t.substring(r+1,e),(i.entities[a]||a==s)&&(t=t.substr(0,r)+(i.entities[a]||"&")+t.substr(e+1)))}return t},this.getUrl=function(t){return"/"==t[0]?"/"==t[1]?t=s.options.prot+":"+t:s.domain&&(t=s.domain+t):s.domain&&0!=t.indexOf("data:")&&!t.includes("://")&&(t=s.domain+"/"+t),t},this.isClose=function(){return">"==s.data[s.i]||"/"==s.data[s.i]&&">"==s.data[s.i+1]},this.section=function(){return s.data.substring(s.start,s.i)},this.parent=function(){return s.STACK[s.STACK.length-1]},this.siblings=function(){return s.STACK.length?s.parent().children:s.DOM}}var i=require("./config.js"),s=i.blankChar,e=require("./CssHandler.js"),a=wx.getSystemInfoSync().windowWidth;t.prototype.parse=function(){emoji&&(this.data=emoji.parseEmoji(this.data));for(var t;t=this.data[this.i];this.i++)this.state(t);for(this.state==this.Text&&this.setText();this.STACK.length;)this.popNode(this.STACK.pop());return this.DOM},t.prototype.setAttr=function(){var t=this.attrName.toLowerCase(),e=this.attrVal;for(i.boolAttrs[t]?this.attrs[t]="T":e&&("src"==t||"data-src"==t&&!this.attrs.src?this.attrs.src=this.getUrl(this.decode(e,"amp")):"href"==t||"style"==t?this.attrs[t]=this.decode(e,"amp"):"data-"!=t.substr(0,5)&&(this.attrs[t]=e)),this.attrVal="";s[this.data[this.i]];)this.i++;this.isClose()?this.setNode():(this.start=this.i,this.state=this.AttrName)},t.prototype.setText=function(){var t,e=this.section();if(e)if(e=i.onText&&i.onText(e,function(){return t=!0})||e,t){this.data=this.data.substr(0,this.start)+e+this.data.substr(this.i);var a=this.start+e.length;for(this.i=this.start;this.i7&&(l=7);var d=["xx-small","x-small","small","medium","large","x-large","xx-large"];o["font-size"]=d[l-1],h.size=void 0}break;case"embed":var u=t.attrs.src||"",c=t.attrs.type||"";if(c.includes("video")||u.includes(".mp4")||u.includes(".3gp")||u.includes(".m3u8"))t.name="video";else{if(!(c.includes("audio")||u.includes(".m4a")||u.includes(".wav")||u.includes(".mp3")||u.includes(".aac")))break;t.name="audio"}t.attrs.autostart&&(t.attrs.autoplay="T"),t.attrs.controls="T";/*fallsthrough*/case"video":case"audio":h.id?this[t.name+"Num"]++:h.id=t.name+ ++this[t.name+"Num"],"video"==t.name&&(this.videoNum>3&&(t.lazyLoad=1),h.width&&(o.width=parseFloat(h.width)+(h.width.includes("%")?"%":"px"),h.width=void 0),h.height&&(o.height=parseFloat(h.height)+(h.height.includes("%")?"%":"px"),h.height=void 0)),h.controls||h.autoplay||(h.controls="T"),h.source=[],h.src&&(h.source.push(h.src),h.src=void 0),this.bubble();break;case"td":case"th":if(h.colspan||h.rowspan)for(var f,p=this.STACK.length;f=this.STACK[--p];)if("table"==f.name){f.c=void 0;break}}h.align&&(o["text-align"]=h.align,h.align=void 0);var m=n.split(";");n="";for(var g=0,v=m.length;ga&&(o.height="",h.height&&(h.height=void 0))),o.height?(h.height=o.height,o.height=""):h.height&&!h.height.includes("%")&&(h.height+="px")}for(var T in o){var w=o[T];if(w){if((T.includes("flex")||"order"==T||"self-align"==T)&&(t.c=1),w.includes("url")){var A=w.indexOf("(");if(-1!=A++){for(;'"'==w[A]||"'"==w[A]||s[w[A]];)A++;w=w.substr(0,A)+this.getUrl(w.substr(A))}}else w.includes("rpx")?w=w.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*a/750+"px"}):"white-space"==T&&w.includes("pre")&&!e&&(this.pre=t.pre=!0);n+=";"+T+":"+w}}n=n.substr(1),n&&(h.style=n),e?i.filter&&0==i.filter(t,this)||this.siblings().push(t):(t.children=[],"pre"==t.name&&i.highlight&&(this.remove(t),this.pre=t.pre=!0),this.siblings().push(t),this.STACK.push(t))}"/"==this.data[this.i]&&this.i++,this.start=this.i+1,this.state=this.Text},t.prototype.remove=function(t){var e=this,a=t.name,r=this.i,h=function(){var i=e.data.substring(r,e.i+1);t.attrs.xmlns||(i=' xmlns="http://www.w3.org/2000/svg"'+i);for(var s=r;"<"!=e.data[r];)r--;i=e.data.substring(r,s).replace("viewbox","viewBox")+i;var a=e.parent();"100%"==t.attrs.width&&a&&(a.attrs.style||"").includes("inline")&&(a.attrs.style="width:300px;max-width:100%;"+a.attrs.style),e.siblings().push({name:"img",attrs:{src:"data:image/svg+xml;utf8,"+i.replace(/#/g,"%23"),style:(/vertical[^;]+/.exec(t.attrs.style)||[]).shift(),ignore:"T"}})};if("svg"==t.name&&"/"==this.data[r])return h(this.i++);for(;;){if(-1==(this.i=this.data.indexOf("",this.i+1)))return void(this.i="pre"==a||"svg"==a?r:this.data.length);for(this.start=this.i+=2;!s[this.data[this.i]]&&!this.isClose();)this.i++;if(this.section().toLowerCase()==a)return"pre"==a?(this.data=this.data.substr(0,r+1)+i.highlight(this.data.substring(r+1,this.i-5),t.attrs)+this.data.substr(this.i-5),this.i=r):("style"==a?this.CssHandler.getStyle(this.data.substring(r+1,this.i-7)):"title"==a&&(this.DOM.title=this.data.substring(r+1,this.i-7)),-1==(this.i=this.data.indexOf(">",this.i))&&(this.i=this.data.length),void("svg"==a&&h()))}},t.prototype.popNode=function(t){if(t.pre){t.pre=this.pre=void 0;for(var s=this.STACK.length;s--;)this.STACK[s].pre&&(this.pre=!0)}var e=this.siblings(),a=e.length,r=t.children;if("head"==t.name||i.filter&&0==i.filter(t,this))return e.pop();var h=t.attrs;if(i.blockTags[t.name]?t.name="div":i.trustTags[t.name]||(t.name="span"),t.c&&("ul"==t.name||"ol"==t.name))if((t.attrs.style||"").includes("list-style:none"))for(var n,o=0;n=r[o++];)"li"==n.name&&(n.name="div");else if("ul"==t.name){for(var l=1,d=this.STACK.length;d--;)"ul"==this.STACK[d].name&&l++;if(1!=l)for(var u=r.length;u--;)r[u].floor=l}else for(var c,f=0,p=1;c=r[f++];)"li"==c.name&&(c.type="ol",c.num=function(t,i){if("a"==i)return String.fromCharCode(97+(t-1)%26);if("A"==i)return String.fromCharCode(65+(t-1)%26);if("i"==i||"I"==i){t=(t-1)%99+1;var s=["I","II","III","IV","V","VI","VII","VIII","IX"],e=["X","XX","XXX","XL","L","LX","LXX","LXXX","XC"],a=(e[Math.floor(t/10)-1]||"")+(s[t%10-1]||"");return"i"==i?a.toLowerCase():a}return t}(p++,h.type)+".");if("table"==t.name){var m=h.cellpadding,g=h.cellspacing,v=h.border;if(t.c&&(this.bubble(),h.style=(h.style||"")+";display:table",m||(m=2),g||(g=2)),v&&(h.style="border:"+v+"px solid gray;"+(h.style||"")),g&&(h.style="border-spacing:"+g+"px;"+(h.style||"")),(v||m||t.c)&&function i(s){for(var e,a=0;e=s[a];a++)if("text"!=e.type){var r=e.attrs.style||"";t.c&&"t"==e.name[0]&&(e.c=1,r+=";display:table-"+("th"==e.name||"td"==e.name?"cell":"tr"==e.name?"row":"row-group")),"th"==e.name||"td"==e.name?(v&&(r="border:"+v+"px solid gray;"+r),m&&(r="padding:"+m+"px;"+r)):i(e.children||[]),r&&(e.attrs.style=r)}}(r),this.options.autoscroll){var b=Object.assign({},t);t.name="div",t.attrs={style:"overflow:scroll"},t.children=[b]}}this.CssHandler.pop&&this.CssHandler.pop(t),"div"!=t.name||Object.keys(h).length||1!=r.length||"div"!=r[0].name||(e[a-1]=r[0])},t.prototype.Text=function(t){if("<"==t){var i=this.data[this.i+1],s=function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"};s(i)?(this.setText(),this.start=this.i+1,this.state=this.TagName):"/"==i?(this.setText(),s(this.data[++this.i+1])?(this.start=this.i+1,this.state=this.EndTag):this.Comment()):"!"!=i&&"?"!=i||(this.setText(),this.Comment())}},t.prototype.Comment=function(){var t;t="--"==this.data.substring(this.i+2,this.i+4)?"--\x3e":"[CDATA["==this.data.substring(this.i+2,this.i+9)?"]]>":">",-1==(this.i=this.data.indexOf(t,this.i+2))?this.i=this.data.length:this.i+=t.length-1,this.start=this.i+1,this.state=this.Text},t.prototype.TagName=function(t){if(s[t]){for(this.tagName=this.section();s[this.data[this.i]];)this.i++;this.isClose()?this.setNode():(this.start=this.i,this.state=this.AttrName)}else this.isClose()&&(this.tagName=this.section(),this.setNode())},t.prototype.AttrName=function(t){if("="==t||s[t]||this.isClose()){if(this.attrName=this.section(),s[t])for(;s[this.data[++this.i]];);if("="==this.data[this.i]){for(;s[this.data[++this.i]];);this.start=this.i--,this.state=this.AttrValue}else this.setAttr()}},t.prototype.AttrValue=function(t){if('"'==t||"'"==t){if(this.start++,-1==(this.i=this.data.indexOf(t,this.i+1)))return this.i=this.data.length;this.attrVal=this.section(),this.i++}else{for(;!s[this.data[this.i]]&&!this.isClose();this.i++);this.attrVal=this.section()}this.setAttr()},t.prototype.EndTag=function(t){if(s[t]||">"==t||"/"==t){for(var i=this.section().toLowerCase(),e=this.STACK.length;e--&&this.STACK[e].name!=i;);if(-1!=e){for(var a;(a=this.STACK.pop()).name!=i;)this.popNode(a);this.popNode(a)}else"p"!=i&&"br"!=i||this.siblings().push({name:i,attrs:{}});this.i=this.data.indexOf(">",this.i),this.start=this.i+1,-1==this.i?this.i=this.data.length:this.state=this.Text}},module.exports=t
================================================
FILE: components/parser.20200731.min/libs/config.js
================================================
function e(e){for(var t=Object.create(null),a=e.split(","),o=a.length;o--;)t[a[o]]=!0;return t}var t=wx.canIUse("editor");
module.exports={
errorImg:null,
filter:null,
highlight:null,
onText:null,
entities:{quot:'"',apos:"'",semi:";",nbsp:" ",ndash:"–",mdash:"—",middot:"·",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",hellip:"…"},
blankChar:e(' ,\xA0,\t,\r,\n,\f'),
boolAttrs:e('autoplay,autostart,controls,ignore,loop,muted'),
blockTags:e('address,article,aside,body,caption,center,cite,footer,header,html,nav,section'+(t?'':',pre')),
ignoreTags:e('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'+(t?',rp':'')),
richOnlyTags:e('a,colgroup,fieldset,legend,table'+(t?',bdi,bdo,rt,ruby':'')),
selfClosingTags:e('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
trustTags:e('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'+(t?',bdi,bdo,caption,pre,rt,ruby':'')),
userAgentStyles:{address:"font-style:italic",big:"display:inline;font-size:1.2em",blockquote:"background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre;overflow:scroll",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",u:"text-decoration:underline"}
}
================================================
FILE: components/parser.20200731.min/parser.js
================================================
// 小程序富文本插件 https://github.com/jin-yufeng/Parser
var dom;var search;function t(t){for(var e=t.length,i=5381;e--;)i+=(i<<5)+t.charCodeAt(e);return i}var e={},i=require("./libs/MpHtmlParser.js"),n=wx.getFileSystemManager&&wx.getFileSystemManager();Component({options:{pureDataPattern:/^[acdgtu]|W/},data:{nodes:[]},properties:{html:{type:String,observer:function(t){this.setContent(t)}},autopause:{type:Boolean,value:!0},autoscroll:Boolean,autosetTitle:{type:Boolean,value:!0},compress:Number,domain:String,lazyLoad:Boolean,loadingImg:String,selectable:Boolean,tagStyle:Object,showWithAnimation:Boolean,useAnchor:Boolean,useCache:Boolean},relations:{"../parser-group/parser-group":{type:"ancestor"}},created:function(){var t=this;this.imgList=[],this.imgList.setItem=function(t,e){var i=this;if(t&&e){if(0==e.indexOf("http")&&this.includes(e)){for(var s,a="",o=0;(s=e[o])&&("/"!=s||"/"==e[o-1]||"/"==e[o+1]);o++)a+=Math.random()>.5?s.toUpperCase():s;return a+=e.substr(o),this[t]=a}if(this[t]=e,e.includes("data:image")){var r=e.match(/data:image\/(\S+?);(\S+?),(.+)/);if(!r)return;var l=wx.env.USER_DATA_PATH+"/"+Date.now()+"."+r[1];n&&n.writeFile({filePath:l,data:r[3],encoding:r[2],success:function(){return i[t]=l}})}}},this.imgList.each=function(t){for(var e=0,i=this.length;e>>#"+t.id:"")).boundingClientRect();this._in?i.select(this._in.selector).fields({rect:!0,scrollOffset:!0}):i.selectViewport().scrollOffset(),i.exec(function(i){if(!i[0])return e.group?e.group.navigateTo(e.i,t):t.fail&&t.fail("Label not found");var n=i[1].scrollTop+i[0].top-(i[1].top||0)+(t.offset||0);if(e._in){var s={};s[e._in.scrollTop]=n,e._in.page.setData(s)}else wx.pageScrollTo({scrollTop:n});t.success&&t.success()})},getText:function(){for(var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data.nodes,i="",n=0;t=e[n++];)if("text"==t.type)i+=t.text.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");else if("br"==t.type)i+="\n";else{var s="p"==t.name||"div"==t.name||"tr"==t.name||"li"==t.name||"h"==t.name[0]&&t.name[1]>"0"&&t.name[1]<"7";s&&i&&"\n"!=i[i.length-1]&&(i+="\n"),t.children&&(i+=this.getText(t.children)),s&&"\n"!=i[i.length-1]?i+="\n":"td"!=t.name&&"th"!=t.name||(i+="\t")}return i},getVideoContext:function(t){if(!t)return this.videoContexts;for(var e=this.videoContexts.length;e--;)if(this.videoContexts[e].id==t)return this.videoContexts[e]},setContent:function(n,s){var a,o=this,r=new i(n,this.data);if(this.data.useCache){var l=t(n);e[l]?a=e[l]:e[l]=a=r.parse()}else a=r.parse();this.triggerEvent("parse",a);var h={};if(s)for(var c=this.data.nodes.length,d=a.length;d--;)h["nodes["+(c+d)+"]"]=a[d];else h.nodes=a;this.showWithAnimation&&(h.showAm="animation: show .5s"),this.setData(h,function(){o.triggerEvent("load")}),a.title&&this.data.autosetTitle&&wx.setNavigationBarTitle({title:a.title}),this.imgList.length=0,this.videoContexts=[];for(var u,g=this.selectAllComponents(".top,.top>>>._node"),f=0;u=g[f++];){u.top=this;for(var m,p=0;m=u.data.nodes[p++];)if(!m.c)if("img"==m.name)this.imgList.setItem(m.attrs.i,m.attrs.src);else if("video"==m.name||"audio"==m.name){var v;v="video"==m.name?wx.createVideoContext(m.attrs.id,u):u.selectComponent("#"+m.attrs.id),v&&(v.id=m.attrs.id,this.videoContexts.push(v))}}var x;clearInterval(this._timer),this._timer=setInterval(function(){o.createSelectorQuery().select(".top").boundingClientRect(function(t){t&&(o.rect=t,t.height==x&&(o.triggerEvent("ready",t),clearInterval(o._timer)),x=t.height)}).exec()},350)}}})
================================================
FILE: components/parser.20200731.min/parser.json
================================================
{"component":true,"usingComponents":{"trees":"./trees/trees"}}
================================================
FILE: components/parser.20200731.min/parser.wxml
================================================
================================================
FILE: components/parser.20200731.min/parser.wxss
================================================
:host{display:block;overflow:scroll;webkit-overflow-scrolling:touch}.top{display:inherit}@keyframes show{0%{opacity:0}100%{opacity:1}}
================================================
FILE: components/parser.20200731.min/trees/trees.js
================================================
function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var t=require("../libs/config.js").errorImg;Component({data:{canIUse:!!wx.chooseMessageFile,placeholder:"data:image/svg+xml;utf8,",ctrl:[]},properties:{nodes:Array,lazyLoad:Boolean,loading:String},methods:{play:function(t){if(this.top.group&&this.top.group.pause(this.top.i),this.top.videoContexts.length>1&&this.top.data.autopause)for(var e=this.top.videoContexts.length;e--;)this.top.videoContexts[e].id!=t.currentTarget.id&&this.top.videoContexts[e].pause()},imgtap:function(t){var e=t.currentTarget.dataset.attrs;if(!e.ignore){var r=!0;if(this.top.triggerEvent("imgtap",{id:t.currentTarget.id,src:e.src,ignore:function(){return r=!1}}),r){if(this.top.group)return this.top.group.preview(this.top.i,e.i);var i=this.top.imgList,a=i[e.i]?i[e.i]:(i=[e.src],e.src);wx.previewImage({current:a,urls:i})}}},loadImg:function(t){var e=t.target.dataset.i;this.data.lazyLoad&&!this.data.ctrl[e]?this.setData(_defineProperty({},"ctrl["+e+"]",1)):this.data.loading&&2!=this.data.ctrl[e]&&this.setData(_defineProperty({},"ctrl["+e+"]",2))},linkpress:function(t){var e=!0,r=t.currentTarget.dataset.attrs;r.ignore=function(){return e=!1},this.top.triggerEvent("linkpress",r),e&&(r["app-id"]?wx.navigateToMiniProgram({appId:r["app-id"],path:r.path}):r.href&&("#"==r.href[0]?this.top.navigateTo({id:r.href.substring(1)}):0==r.href.indexOf("http")||0==r.href.indexOf("//")?wx.setClipboardData({data:r.href,success:function(){return wx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:r.href,fail:function(){wx.switchTab({url:r.href})}})))},error:function(e){var r=e.target.dataset.source,i=e.target.dataset.i,a=this.data.nodes[i];if("video"==r||"audio"==r){var s=(a.i||0)+1;if(svar s={abbr:1,b:1,big:1,code:1,del:1,em:1,i:1,ins:1,label:1,q:1,small:1,span:1,strong:1,sub:1,sup:1};module.exports={visited:function(s,e){s.instance.hasClass("_visited")||s.instance.addClass("_visited"),e.callMethod("linkpress",s)},use:function(e){return!e.c&&!s[e.name]&&-1==(e.attrs.style||"").indexOf("display:inline")}}{{n.text}}\n{{n.num}}██
================================================
FILE: components/parser.20200731.min/trees/trees.wxss
================================================
._a{display:inline;padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._visited{color:#551a8b}._img{display:inline-block;max-width:100%;overflow:hidden}:host{display:inline}._blockquote,._div,._p,._ul,._ol,._li{display:block}._b,._strong{font-weight:bold}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:bold}._image{display:block;width:100%;height:360px;margin-top:-360px;opacity:0}._ins{text-decoration:underline}._li{flex:1;width:0}._ol-bef{width:36px;margin-right:5px;text-align:right}._ul-bef{margin:0 12px 0 23px;line-height:normal}._ol-bef,._ul-bef{flex:none;user-select:none}._ul-p1{display:inline-block;width:.3em;height:.3em;overflow:hidden;line-height:.3em}._ul-p2{display:inline-block;width:.23em;height:.23em;border:.05em solid black;border-radius:50%}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}.__bdi,.__bdo,.__ruby,.__rt{display:inline-block}._video{position:relative;display:inline-block;width:300px;height:225px;background-color:black}._video::after{position:absolute;top:50%;left:50%;margin:-15px 0 0 -15px;content:'';border-color:transparent transparent transparent white;border-style:solid;border-width:15px 0 15px 30px}
================================================
FILE: components/payment/index.js
================================================
const WXAPI = require('apifm-wxapi');
const { wxaCode } = require('../../utils/auth');
Component({
options: {
addGlobalClass: true,
},
/**
* 组件的对外属性,是属性名到属性设置的映射表
*/
properties: {
money: Number,
remark: String,
nextAction: Object,
extData: Object,
show: Boolean,
useCard: {
type: Boolean,
value: true
}
},
/**
* 组件的内部数据,和 properties 一同用于组件的模板渲染
*/
data: {
payType: 'wx',
alipayOpenMod: '0'
},
// 组件数据字段监听器,用于监听 properties 和 data 的变化
observers: {
'show': function(show) {
this.setData({
alipayQrcode: null,
alipayOpenMod: wx.getStorageSync('alipay')
})
}
},
lifetimes: {
attached() {
getApp().initLanguage(this)
},
detached() {
// 在组件实例被从页面节点树移除时执行
},
},
/**
* 组件的方法列表
*/
methods: {
close() {
this.triggerEvent('cancel')
},
payTypeChange(event) {
this.setData({
payType: event.detail,
alipayQrcode: null,
});
},
payTypeClick(event) {
const { name } = event.currentTarget.dataset;
this.setData({
payType: name,
alipayQrcode: null,
});
},
async submit() {
let token = wx.getStorageSync('payToken')
if (!token) {
token = wx.getStorageSync('token')
}
const postData = {
token,
money: this.data.money,
remark: this.data.remark,
}
if (this.data.extData) {
postData = {
...postData,
...this.data.extData
}
}
if (this.data.nextAction) {
postData.nextAction = JSON.stringify(this.data.nextAction)
}
postData.payName = postData.remark
const url = wx.getStorageSync('wxpay_api_url')
let res
if (this.data.payType == 'wx') {
// https://www.yuque.com/apifm/nu0f75/ppadt8
res = await WXAPI.payVariableUrl(url ? url : '/pay/wx/wxapp', postData)
} else if (this.data.payType == 'alipay') {
// https://www.yuque.com/apifm/nu0f75/hguh83ekxsh71cn7
res = await WXAPI.alipayQrcode(postData)
} else {
wx.showModal({
content: this.data.$t.payment.notSupport,
showCancel: false
})
this.close()
return
}
if (res.code != 0) {
wx.showModal({
content: JSON.stringify(res),
showCancel: false
})
this.close()
return
}
if (this.data.payType == 'wx') {
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
fail: aaa => {
console.error(aaa)
wx.showToast({
title: '' + aaa,
icon: 'none'
})
},
success: () => {
wx.showToast({
title: this.data.$t.asset.success
})
this.triggerEvent('ok', this.data)
}
})
}
if (this.data.payType == 'alipay') {
const qrcodeRes = JSON.parse(res.data.qrcode)
const alipayQrcode = qrcodeRes.alipay_trade_precreate_response.qr_code
console.log(alipayQrcode);
// 生成二维码 https://www.yuque.com/apifm/nu0f75/xrnyo9
const resQrcode = await WXAPI.commonQrcode({
content: alipayQrcode,
width: 650
})
if (resQrcode.code != 0) {
wx.showToast({
title: resQrcode.msg,
icon: 'none'
})
return
}
console.log(resQrcode.data);
this.setData({
alipayQrcode: resQrcode.data
})
}
},
}
})
================================================
FILE: components/payment/index.json
================================================
{
"component": true,
"usingComponents": {
}
}
================================================
FILE: components/payment/index.wxml
================================================
{{ remark }}
¥{{ money }}
{{ $t.payment.select }}
{{ $t.payment.alipayQrcodeText }}
{{ $t.order.toPayTap }}
================================================
FILE: components/payment/index.wxss
================================================
.pop-main {
display: flex;
flex-direction: column;
}
.title {
padding: 32rpx;
text-align: center;
}
.btn-box {
padding: 32rpx;
}
.alipayQrcode {
margin-left: 50rpx;
}
.alipayQrcodeText {
text-align: center;
color: rgb(201, 25, 48);
font-size: 24rpx;
}
.amount {
padding: 16rpx;
text-align: center;
color: #e64340;
font-weight: bold;
font-size: 52rpx;
}
.amount text {
font-weight: normal;
font-size: 28rpx;
}
================================================
FILE: components/payment/sn.txt
================================================
app.json usingComponents 加上
"payment": "/components/payment/index",
在需要的页面上加这句代码即可
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false
})
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
================================================
FILE: config.js
================================================
module.exports = {
version: "26.3.18",
note: '商品存在多SKU的情况下,选择不同的规格,显示不同的规格图片',
subDomain: "beeorder", // 根据教程 https://www.it120.cc/help/qr6l4m.html 查看并设置你自己的 subDomain
merchantId: 27, // 商户ID,可在后台工厂设置-->商户信息查看
customerServiceType: 'QW' // 客服类型,QW为企业微信,需要在后台系统参数配置企业ID和客服URL,否则为小程序的默认客服
}
================================================
FILE: i18n/en.js
================================================
module.exports = {
common: {
select: 'Select',
save: 'Submit',
cancel: 'Cancel',
confirm: 'Confirm',
doubleClick: 'Take a break~',
empty: 'No Data',
submitSuccess: 'Submitted',
gotIt: 'Got it',
search: 'Search',
searchPlaceholder: 'Enter search keywords',
getCodeError: 'Fetch code Fail',
loginFail: 'Can\'t Login',
authorizeRequired: 'Need Authorization',
authorize: 'Auth',
upgrade: 'The new version is ready. Do you want to restart the application?',
noNetwork: 'Currently no network available',
networkDown: 'Network disconnected',
privacyPermission: 'Not agreeing to the user privacy agreement',
},
auth: {
needLogin: 'Please Login First',
goAdmin: 'Manager',
},
date: {
year: 'Y',
month: 'M',
day: 'D',
hour: 'H',
minutes: 'm',
},
ad_index: {
title: 'Shipping Address',
add: 'New Address',
empty: 'Address is Empty',
pleaseAdd: 'Click to Add Address',
linkMan: 'Name',
linkManPlaceholder: 'Input Recipient Name',
mobile: 'Mobile',
mobilePlaceholder: 'Input Mobile',
region: 'Region',
regionPlaceholder: 'Select Region',
location: 'Positioning',
address: 'Address',
addressPlaceholder: 'Streets, buildings, house signs, etc',
apiError: 'Unable to Obtain Data',
deleteProfile: 'Are you sure you want to delete this Shipping Address?',
},
order: {
title: 'Orders',
cancelProfile: 'Are you sure you want to cancel this order?',
scoreNotEnough: 'Your Score are is Not enough!',
amountReal: 'Order Amount',
balance: 'Balance',
payAmount: 'Still need Pay',
payScore: 'Score need to be deducted:',
noCashAccount: 'Unable to obtain user funding information',
status: {
st01: 'Canceled',
st10: 'To be picked',
st11: 'In delivery',
st3: 'Completed',
},
deleteProfile: 'Are you sure you want to delete this order?',
empty: {
t1: 'You haven\'t ordered your meal yet',
t2: 'Hurry up and reward yourself!',
btn: 'Go and order a meal',
},
dateAdd: 'Order Time',
orderNumber: 'Order No',
callShop: 'Contact',
deleteOrder: 'Delete',
cancelOrder: 'Cancel',
toPayTap: 'Pay Now',
detail: 'Order Detail',
askConfirm: 'Are you sure you have received the product?',
VerificationCompleted: 'Verification Completed',
stausClosed: 'Order has been closed',
stausNoPay: 'Waiting to Pay',
stausSuccess: 'Transaction completed',
},
cashLog: {
title: 'Fund details',
},
asset: {
title: 'Wallet',
recharge: 'Recharge',
amount: 'Amount',
amountPlaceholder: 'Please enter the recharge amount',
confirmBtn: 'Confirm Recharge',
success: 'Payment successful',
confine: 'Pay',
send: 'Send',
other: 'Other',
rechargeLogs: 'Recharge Records',
},
booking: {
title: 'Booking',
name: 'Name',
namePlaceholder: 'Enter contact person',
mobile: 'Mobile',
mobilePlaceholder: 'Convenient for us to contact you',
time: 'Arrival',
timePlaceholder: 'Select estimated time of arrival',
person: 'Person',
tip: 'Seat reserved for half an hour, invalid if overdue',
},
cart: {
title: 'Cart',
empty: 'No Data',
clear: 'Clear All',
num: 'Num',
btn: 'Submit',
ordered: 'Ordered Dishes',
tableNum: 'TableNum',
Tobeconfirmed: 'To be confirmed',
Cooked:'Cooked',
Served:'Served',
Numofdishes:'Num of dishes',
Consumptionamount:'Consumption amount',
Payableamount:'Payable amount',
Check:'Check',
},
coupons: {
title: 'Coupons',
inputpassword:'Input password',
Cominglate:'Cominglate',
receivedgreedy:'You have received it, you cannot receive it anymore',
pointsinsufficient:'Your points are insufficient',
Expired :'Expired',
Successfullyclaimed :'Success',
enternum:'Enter the coupon number',
password:'password',
Redemption:'Redemption successful',
Invitingcoupons:'Inviting you to collect coupons',
Vouchers: 'Vouchers',
over: 'Over',
btn: 'Fetch',
expire: 'exp',
toUse: 'Use',
number: 'Code',
numberPlaceholder: 'Please enter the coupon Code',
pwd: 'Password',
pwdPlaceholder: 'Please enter password',
change: 'Exchange',
},
goodsDetail: {
title: 'Product Details',
noStores: 'sold out',
noSelectSku: 'Please select sku',
noSelectAddtion: 'Please select an accessory',
buyNumber: 'Purchase quantity',
noSelectNumber: 'Please select the purchase quantity',
addCartSuccess: 'Add Success',
addCartBtn: 'Add to Cart',
inviteKanJia: 'Inviting you to help TA negotiate',
inviteKanJiaFriend: 'Invite friends to help',
kanJiaAmount: 'Successfully helped TA cut it down',
kanJiaSetting: 'Bargaining Settings',
longTapQrcode: 'Long press to recognize mini program code',
qrcodeSaved: 'saved to phone album',
commission1: 'Sharing rewards, friends can receive rewards after placing an order',
commission2: 'Points reward',
commission3: 'Cash rewards',
limit: 'Limited',
saledNum: 'Sold',
originalPrice: 'Original Price',
minPrice: 'Min Price',
end: 'End',
ended: 'Bargaining has ended',
help: 'Help',
kanjia: 'Bargaining',
help2: 'Help',
helpPerson: 'Help Person',
status: 'Status',
joinTime: 'Registration Time',
buy: 'Purchase',
kanjiaLogs: 'Bargaining Records',
helped: 'You have already Helped',
helphe: 'Help',
buyUseCurPrice: 'Purchase at current price',
storeing: 'Replenishing',
kanjiaBtn: 'Initiate bargaining | Invite friends to help',
saveImage: 'Save to album',
},
index: {
pingtuanNoOpen: 'Grouping function is not enabled',
pickup: 'Pickup',
Delivery: 'Delivery',
shopDetail: 'Merchant Info',
minPrice: 'On hand price',
noStart: 'Start Later',
miaoshaEnd: 'Finished',
pingtuan: 'Join',
selectSku: 'SKU',
submit: 'Selected',
selectShop: ' Select Shop',
noBusiness: 'no Business',
p_persion: 'People Join',
p_numsuc: 'Joined',
remain: 'Remain',
remainToSuccess: ' People, can be successfully',
pingSuccess: 'Successfully',
originalPriceBuy: 'Original Buy',
openNewPingtuan: 'Reopen Group',
pingtuanProcess: 'Collaborating process',
step1: 'Payment Opening',
step2: 'Friend participation',
step3: 'Successfully picked up the meal',
step4: 'Refund failed',
order: 'Ordering',
PickingUp: 'Picking Up',
ordered: 'Ordered',
home: 'Home',
},
queue: {
t: 'Queue',
success: 'Successfully',
myNumber: 'My Number',
ExpectedWaiting: 'Expected Waiting',
minutes: 'Minutes',
},
my: {
title: 'My',
nickEdit: 'Edit Nick',
nickSet: 'Edit Nick',
nickRequired: 'Please fill in your Nick',
uid: 'UID',
userCode: 'Code',
score: 'Score',
signDaily: 'Daily check-in',
scanHx: 'Scan code for verification',
youhuimaidan: 'Discount purchase',
aboutUs: 'About Us',
Contact: 'Contact US',
clearStorage: 'Clear Cache',
},
vip: {
title: 'VIP',
consumption: 'Total Consumption',
notVIP: 'Not VIP',
tip: 'Consumption Reaches, Upgrade Automatically',
growth: 'Member Growth System',
growthName: 'Level',
growthDiscount: 'Discount',
growthConsumption: 'Consumption',
profile: 'Note: When the shopping consumption reaches the specified standard, it will automatically become a member of that level',
},
feedback: {
title: 'Feedback',
name: 'Name',
namePlaceholder: 'Your Name',
nameRequired: 'Please fill in your name',
mobile: 'Mobile',
mobilePlaceholder: 'Convenient for us to contact you',
contentRequired: 'Please fill in feedback information',
imageOrVideo: 'Image/Video',
contentPlaceholder: 'Please leave your valuable suggestions or feedback~',
btn: 'Submit',
},
notice: {
title: 'Notice',
},
PickingUp: {
qudanhao: 'Pickup No',
Deliverying: 'Delivering For You',
total: 'Total',
goodsInfo: 'Goods Info',
DeliveryMethod: 'Delivery Method',
sf: 'SF Express',
remark: 'Remark',
remarkPlaceholder: 'If you need to Remark, please enter',
goodsAmount: 'goods Amount',
freight: 'Freight',
realAmount: 'Total payable amount',
ConfirmVerification: 'Confirm Verification',
},
pay: {
title: '确认订单',
choose: 'Choose coupons',
chooseCard: 'Choose Card',
inputphoneNO: 'Input phone NO.',
select: 'select self pickup/delivery time',
address: 'The current address is beyond the delivery range',
servicesclosed: 'The dine in and takeout services have been closed',
setaddress: 'set delivery address',
Receivingaddress: 'Please set the Receiving address',
information: 'Unable to obtain user funding information',
login: 'Please login first',
fetchsuccessful: 'Fetch successful',
memberinformation: 'Used to improve member information',
Loginsuccessful: 'Login successful',
Fullconsumption: 'Full consumption',
RMBreduced: 'Yuan can be reduced',
reduce: 'Reduce',
Mealtime: 'Meal pickup time',
Deliverytime: 'Delivery time',
Addaddress: 'Add delivery address',
Productdetails: 'Product details',
Total: 'Total',
piecegoods: 'Piece goods',
Subtotal: 'Subtotal',
Insulationbag: 'Insulation bag',
Needbag: 'Need',
UNneedbag: 'Unneed',
reBind: 'ReBind',
DeliveryFee: 'Delivery Fee',
remark: 'Remark',
remarkPlaceholder: 'If you need a note, please enter it',
qisong: ' At least',
login: 'Login',
},
scoreLogs: {
title: 'Score Logs',
},
shop: {
characteristic: 'Characteristic',
openingHours: 'Business Time',
contactUs: 'Contact US',
viewMap: 'Open Map',
Navigation: 'Navigation',
join: 'Merchant Join',
name: 'Name',
namePlaceholder: 'Your Name',
nameRequired: 'Please fill in your name',
mobile: 'Mobile',
mobilePlaceholder: 'Convenient for us to contact you',
mobileRequired: 'Please provide your contact phone number',
joinBtn: 'Apply',
contentPlaceholder: 'If there is more information, please fill in~',
contentRequired: 'Please fill in More information',
select: 'Select Shop',
},
sign: {
signed: 'Signed',
signSuccess: 'Sign Success',
signBtn: 'Sign',
},
youhuipay: {
amountRequired: 'Please fill in the correct consumption amount',
curAmount: 'Your current consumption',
youhui: 'Discount',
askAmount: 'Please ask the waiter and enter',
btn: 'Confirm payment',
youhuiList: 'Discount information',
},
goodsList: {
t: 'Goods List',
sort: {
zh: 'Default',
xp: 'News',
xl: 'Sales',
jg: 'Price',
}
},
payment: {
order: 'Pay Order',
maidan: 'Check',
recharge: 'Recharge',
select: 'Select Payment',
wx: 'WxPay',
alipay: 'Alipay',
alipayQrcodeText: 'Long press the picture to save, and then use Alipay to scan',
notSupport: 'This payment method is not currently supported',
},
home: {
huiyuan: 'VIP0',
zq: 'PICK UP',
ps: 'Delivery',
sc: 'Food',
lpk: 'Gift Card',
tg: 'Group Buy',
bh: 'Stores',
},
card: {
title: 'Gift Card',
buy: 'Buy Card',
my: 'My Card',
empty: 'No Card Sale',
buy2: 'BUY',
excharge: 'Exchange Card',
times: 'CUP',
logs: 'Consumption Details',
pleaseInputNumber: 'Please enter the redemption code',
xieyi: 'Agree to the Gift Card Usage Agreement',
xieyi0: 'Please Read And Agree to the Gift Card Usage Agreement',
cardShareOpen: 'Send Friend',
cardShareClose: 'Cancel Send',
shareplaceholder: 'Please have a cup of milk tea~',
sending: 'Sending',
receiveEmpty: 'The current gift card does not exist or has been claimed',
friend: 'Friend',
cardShareFetch: 'Accept Your Heart',
fetchSuccess: 'The gift card has been deposited into the card bag',
}
}
================================================
FILE: i18n/index.js
================================================
/**
* 获取当前使用的语言
*/
function getLanguage() {
const Language = wx.getStorageSync('Language')
if (Language) {
return Language
}
const allowLanguage = ['zh_CN', 'en'] // 目前支持的语言包
const appBaseInfo = wx.getAppBaseInfo()
let _language = appBaseInfo.language || 'zh_CN'
if (!allowLanguage.includes(_language)) {
_language = 'zh_CN'
}
wx.setStorageSync('Language', _language)
return _language
}
function $t(){
return require(getLanguage() + '.js');
}
function setTabBarLanguage(){
const $t = this.$t()
wx.setTabBarItem({
index: 0,
pagePath: "pages/home/index",
iconPath: "images/nav/home-off.png",
selectedIconPath: "images/nav/home-on.png",
text: $t.index.home
})
wx.setTabBarItem({
index: 1,
pagePath: "pages/index/index",
iconPath: "images/nav/index-off.png",
selectedIconPath: "images/nav/index-on.png",
text: $t.index.order
})
wx.setTabBarItem({
index: 2,
pagePath: "pages/queue/index",
iconPath: "images/nav/qh-off.png",
selectedIconPath: "images/nav/qh-on.png",
text: $t.queue.t
})
wx.setTabBarItem({
index: 3,
pagePath: "pages/order-details/doing",
iconPath: "images/nav/qc-off.png",
selectedIconPath: "images/nav/qc-on.png",
text: $t.index.PickingUp
})
wx.setTabBarItem({
index: 4,
pagePath: "pages/my/index",
iconPath: "images/nav/my-off.png",
selectedIconPath: "images/nav/my-on.png",
text: $t.my.title
})
}
module.exports = {
setTabBarLanguage: setTabBarLanguage,
getLanguage: getLanguage,
$t: $t,
langs: [
{
name: '简体中文',
code: 'zh_CN'
},
{
name: 'English',
code: 'en'
}
]
}
================================================
FILE: i18n/zh_CN.js
================================================
module.exports = {
common: {
select: '请选择',
save: '保存',
cancel: '取消',
confirm: '确定',
doubleClick: '休息一下~',
empty: '暂无数据',
submitSuccess: '提交成功',
gotIt: '知道了',
search: '搜索',
searchPlaceholder: '输入搜索关键词',
getCodeError: '获取code失败',
loginFail: '无法登录',
authorizeRequired: '需要获得您的授权',
authorize: '立即授权',
upgrade: '新版本已经准备好,是否重启应用?',
noNetwork: '当前无网络',
networkDown: '网络已断开',
privacyPermission: '未同意用户隐私协议保护协议,暂时无法使用',
},
auth: {
needLogin: '登陆后才能访问',
goAdmin: '管理后台',
},
date: {
year: '年',
month: '月',
day: '日',
hour: '点',
minutes: '分',
},
ad_index: {
title: '地址管理',
add: '新增收货地址',
empty: '暂无地址信息',
pleaseAdd: '请点击按钮添加地址信息',
linkMan: '收件人姓名',
linkManPlaceholder: '填写收件人姓名',
mobile: '手机号码',
mobilePlaceholder: '填写手机号码',
region: '选择地区',
regionPlaceholder: '选择行政地址(省、市、区县)',
location: '选择定位',
address: '详细地址',
addressPlaceholder: '街道、楼栋、门牌等',
apiError: '无法获取快递地址数据',
deleteProfile: '确定要删除该收货地址吗?',
},
order: {
title: '全部订单',
cancelProfile: '确定要取消该订单吗?',
scoreNotEnough: '您的积分不足,无法支付',
amountReal: '订单金额',
balance: '可用余额',
payAmount: '仍需支付',
payScore: '需要扣除积分:',
noCashAccount: '无法获取用户资金信息',
status: {
st01: '已取消',
st10: '待取餐',
st11: '配送中',
st3: '已完成',
},
deleteProfile: '确定要删除该订单吗?',
empty: {
t1: '您还没有点餐',
t2: '快去犒劳一下自己吧!',
btn: '去点餐',
},
dateAdd: '下单时间',
orderNumber: '订单编号',
callShop: '联系商家',
deleteOrder: '删除订单',
cancelOrder: '关闭订单',
toPayTap: '立即支付',
detail: '订单详情',
askConfirm: '确认您已收到商品?',
VerificationCompleted: '核销完成',
stausClosed: '当前订单已关闭',
stausNoPay: '等待付款',
stausSuccess: '交易完成',
},
cashLog: {
title: '资金明细',
},
asset: {
title: '我的钱包',
recharge: '余额充值',
amount: '充值金额',
amountPlaceholder: '请输入充值金额',
confirmBtn: '确认充值',
success: '支付成功',
confine: '充',
send: '送',
other: '其他',
rechargeLogs: '充值记录',
},
booking: {
title: '在线订位',
name: '联系人',
namePlaceholder: '请输入联系人',
mobile: '联系电话',
mobilePlaceholder: '方便我们联系您',
time: '到店时间',
timePlaceholder: '选择预计到店时间',
person: '用餐人数',
tip: '座位预留半小时,逾期作废',
},
cart: {
title: '购物车',
empty: '暂无菜品',
clear: '清空购物车',
num: '个商品',
btn: '立即下单',
ordered: '已点菜品',
tableNum: '桌号',
Tobeconfirmed: '待确认',
Cooked:'已下厨',
Served:'已上菜',
Numofdishes:'菜品数量',
Consumptionamount:'消费金额',
Payableamount:'应付金额',
Check:'结账买单',
},
coupons: {
title: '优惠券',
inputpassword:'请输入口令',
Cominglate:'来晚了',
receivedgreedy:'你领过了,别贪心哦~',
pointsinsufficient:'您的积分不足~',
Expired :'已过期~',
Successfullyclaimed :'领取成功~',
enternum:'请输入券号',
password:'请输入密码',
Redemption:'兑换成功',
Invitingcoupons:'邀您领取优惠券',
Vouchers: '代金券',
over: '满',
btn: '立即领取',
expire: '到期',
toUse: '立即使用',
number: '券号',
numberPlaceholder: '请输入券号',
pwd: '密码',
pwdPlaceholder: '请输入密码',
change: '立即兑换',
},
goodsDetail: {
title: '商品详情',
noStores: '已售罄',
noSelectSku: '请选择规格',
noSelectAddtion: '请选择配件',
buyNumber: '购买数量',
noSelectNumber: '请选择购买数量',
addCartSuccess: '加入购物车',
addCartBtn: '加入购物车',
inviteKanJia: '邀请您帮TA砍价',
inviteKanJiaFriend: '邀请朋友帮忙',
kanJiaAmount: '成功帮TA砍掉',
kanJiaSetting: '砍价设置',
longTapQrcode: '长按识别小程序码',
qrcodeSaved: '已保存到手机相册',
commission1: '分享有赏,好友下单后可得',
commission2: '积分奖励',
commission3: '现金奖励',
limit: '限量',
saledNum: '已售',
originalPrice: '原价',
minPrice: '底价',
end: '截止',
ended: '砍价已结束',
help: '帮',
kanjia: '砍价',
help2: '帮砍',
helpPerson: '帮砍人数',
status: '状态',
joinTime: '报名时间',
buy: '购买',
kanjiaLogs: '砍价记录',
helped: '您已砍过',
helphe: '帮TA砍',
buyUseCurPrice: '用当前价购买',
storeing: '补货中',
kanjiaBtn: '发起砍价|邀请好友助力',
saveImage: '保存到相册',
},
index: {
pingtuanNoOpen: '拼团功能未开启',
pickup: '自取',
Delivery: '外卖',
shopDetail: '查看门店信息',
minPrice: '到手价',
noStart: '即将开抢',
miaoshaEnd: '秒杀结束',
pingtuan: '一起拼',
selectSku: '选规格',
submit: '选好了',
selectShop: '获取门店',
noBusiness: '未营业',
p_persion: '人成单',
p_numsuc: '已拼',
remain: '差',
remainToSuccess: '人,即可拼单成功',
pingSuccess: '已拼单成功',
originalPriceBuy: '原价购买',
openNewPingtuan: '重新开团',
pingtuanProcess: '拼单流程',
step1: '支付开拼',
step2: '好友参与',
step3: '成功取餐',
step4: '失败退款',
order: '点餐',
PickingUp: '取餐',
ordered: '已点',
home: '首页',
},
queue: {
t: '取号',
success: '取号成功',
myNumber: '我的号子',
ExpectedWaiting: '预计等待',
minutes: '分钟',
},
my: {
title: '我的',
nickEdit: '修改昵称',
nickSet: '点击设置昵称',
nickRequired: '请填写昵称',
uid: '用户ID',
userCode: '会员码',
score: '积分',
signDaily: '每日签到',
scanHx: '扫码核销',
youhuimaidan: '优惠买单',
aboutUs: '关于我们',
Contact: '联系客服',
clearStorage: '清除缓存',
},
vip: {
title: '会员',
consumption: '累计消费',
notVIP: '非会员',
tip: '消费达到金额可自动成为会员',
growth: '会员成长体系',
growthName: '级别名称',
growthDiscount: '购物折扣',
growthConsumption: '消费标准(元)',
profile: '注:当购物消费达指定标准自动成为该级别会员',
},
feedback: {
title: '意见反馈',
name: '姓名',
namePlaceholder: '如何称呼您',
nameRequired: '请填写您的姓名',
mobile: '联系电话',
mobilePlaceholder: '方便我们与您联系',
contentRequired: '请填写反馈信息',
imageOrVideo: '图片/视频',
contentPlaceholder: '请留下您的宝贵建议或意见~',
btn: '提交反馈',
},
notice: {
title: '公告',
},
PickingUp: {
qudanhao: '取餐号',
Deliverying: '正在为您配送',
total: '合计',
goodsInfo: '商品信息',
DeliveryMethod: '配送方式',
sf: '顺丰快递',
remark: '留言',
remarkPlaceholder: '如需留言请输入',
goodsAmount: '商品金额',
freight: '运费',
realAmount: '应付总额',
ConfirmVerification: '确认核销',
},
pay: {
title: '确认订单',
choose: '请选择使用优惠券',
chooseCard: '选择会员卡',
inputphoneNO: '请输入手机号码',
select: '请选择自取/配送时间',
address: '当前地址超出配送范围',
servicesclosed: '堂食和外卖服务已关闭',
setaddress: '请设置配送地址',
Receivingaddress: '请设置收货地址',
information: '无法获取用户资金信息',
login: '请先登陆',
fetchsuccessful: '读取成功',
memberinformation: '用于完善会员资料',
Loginsuccessful: '登陆成功',
Fullconsumption: '消费满',
RMBreduced: '元可减',
reduce: '减',
Mealtime: '取餐时间',
Deliverytime: '送达时间',
Addaddress: '新增配送地址',
Productdetails: '商品明细',
Total: '共计',
piecegoods: '件商品',
Subtotal: '小计',
Insulationbag: '保温袋',
Needbag: '需要',
UNneedbag: '不需要',
reBind: '重新获取',
DeliveryFee: '配送费',
remark: '备注',
remarkPlaceholder: '如需备注请输入',
qisong: '起送',
login: '授权登陆',
},
scoreLogs: {
title: '积分明细',
},
shop: {
characteristic: '本店特色',
openingHours: '营业时间',
contactUs: '联系我们',
viewMap: '查看地图',
Navigation: '导航到店',
join: '商家入驻',
name: '姓名',
namePlaceholder: '如何称呼您',
nameRequired: '请填写您的姓名',
mobile: '联系电话',
mobilePlaceholder: '方便我们与您联系',
mobileRequired: '请填写您的联系电话',
joinBtn: '申请入驻',
contentPlaceholder: '如有更多信息请填写~',
contentRequired: '请填写反馈信息',
select: '选择门店',
},
sign: {
signed: '已签到',
signSuccess: '签到成功',
signBtn: '点击签到',
},
youhuipay: {
amountRequired: '请填写正确的消费金额',
curAmount: '您本次消费',
youhui: '优惠',
askAmount: '请询问服务员后输入',
btn: '确认付款',
youhuiList: '优惠信息',
},
goodsList: {
t: '商品列表',
sort: {
zh: '综合',
xp: '新品',
xl: '销量',
jg: '价格',
}
},
payment: {
order: '支付订单',
maidan: '优惠买单',
recharge: '在线充值',
select: '选择支付方式',
wx: '微信支付',
alipay: '支付宝支付',
alipayQrcodeText: '长按图片保存,然后使用支付宝扫一扫付款',
notSupport: '暂不支持该支付方式',
},
home: {
huiyuan: '普通会员',
zq: '到店自取',
ps: '骑手配送',
sc: '食材透明',
lpk: '礼品好卡',
tg: '超值团购',
bh: '精选百货',
},
card: {
title: '礼品卡',
buy: '购买礼品卡',
my: '我的礼品卡',
empty: '暂无礼品卡',
buy2: '立即购买',
excharge: '兑换礼品卡',
times: '杯',
logs: '消费明细',
pleaseInputNumber: '请输入兑换码',
xieyi: '同意《礼品卡使用协议》',
xieyi0: '请先阅读并同意《礼品卡使用协议》',
cardShareOpen: '送给好友',
cardShareClose: '取消赠送',
shareplaceholder: '请你喝杯奶茶~',
sending: '赠送中',
receiveEmpty: '当前礼品卡不存在或已被领取',
friend: '好友',
cardShareFetch: '收下心意',
fetchSuccess: '礼品卡已存入卡包',
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/action-sheet/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/action-sheet/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var button_1 = require("../mixins/button");
(0, component_1.VantComponent)({
classes: ['list-class'],
mixins: [button_1.button],
props: {
show: Boolean,
title: String,
cancelText: String,
description: String,
round: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 100,
},
actions: {
type: Array,
value: [],
},
overlay: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
closeOnClickAction: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onSelect: function (event) {
var _this = this;
var index = event.currentTarget.dataset.index;
var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile;
var item = actions[index];
if (item) {
this.$emit('select', item);
if (closeOnClickAction) {
this.onClose();
}
if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({
desc: item.getUserProfileDesc || ' ',
complete: function (userProfile) {
_this.$emit('getuserinfo', userProfile);
},
});
}
}
},
onCancel: function () {
this.$emit('cancel');
},
onClose: function () {
this.$emit('close');
},
onClickOverlay: function () {
this.$emit('click-overlay');
this.onClose();
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/action-sheet/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-popup": "../popup/index",
"van-loading": "../loading/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/action-sheet/index.wxml
================================================
{{ description }}
{{ cancelText }}
================================================
FILE: miniprogram_npm/@vant/weapp/action-sheet/index.wxss
================================================
@import '../common/index.wxss';.van-action-sheet{color:var(--action-sheet-item-text-color,#323233);max-height:var(--action-sheet-max-height,90%)!important}.van-action-sheet__cancel,.van-action-sheet__item{background-color:var(--action-sheet-item-background,#fff);font-size:var(--action-sheet-item-font-size,16px);line-height:var(--action-sheet-item-line-height,22px);padding:14px 16px;text-align:center}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{background-color:var(--action-sheet-cancel-padding-color,#f7f8fa);display:block;height:var(--action-sheet-cancel-padding-top,8px)}.van-action-sheet__item--disabled{color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{color:var(--action-sheet-subname-color,#969799);font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.van-action-sheet__header{font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--font-weight-bold,500);line-height:var(--action-sheet-header-height,48px);text-align:center}.van-action-sheet__description{color:var(--action-sheet-description-color,#969799);font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.van-action-sheet__close{color:var(--action-sheet-close-icon-color,#c8c9cc);font-size:var(--action-sheet-close-icon-size,22px)!important;line-height:inherit!important;padding:var(--action-sheet-close-icon-padding,0 16px);position:absolute!important;right:0;top:0}.van-action-sheet__loading{display:flex!important}
================================================
FILE: miniprogram_npm/@vant/weapp/area/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/area/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var shared_1 = require("../picker/shared");
var utils_1 = require("../common/utils");
var EMPTY_CODE = '000000';
(0, component_1.VantComponent)({
classes: ['active-class', 'toolbar-class', 'column-class'],
props: __assign(__assign({}, shared_1.pickerProps), { showToolbar: {
type: Boolean,
value: true,
}, value: {
type: String,
observer: function (value) {
this.code = value;
this.setValues();
},
}, areaList: {
type: Object,
value: {},
observer: 'setValues',
}, columnsNum: {
type: null,
value: 3,
}, columnsPlaceholder: {
type: Array,
observer: function (val) {
this.setData({
typeToColumnsPlaceholder: {
province: val[0] || '',
city: val[1] || '',
county: val[2] || '',
},
});
},
} }),
data: {
columns: [{ values: [] }, { values: [] }, { values: [] }],
typeToColumnsPlaceholder: {},
},
mounted: function () {
var _this = this;
(0, utils_1.requestAnimationFrame)(function () {
_this.setValues();
});
},
methods: {
getPicker: function () {
if (this.picker == null) {
this.picker = this.selectComponent('.van-area__picker');
}
return this.picker;
},
onCancel: function (event) {
this.emit('cancel', event.detail);
},
onConfirm: function (event) {
var index = event.detail.index;
var value = event.detail.value;
value = this.parseValues(value);
this.emit('confirm', { value: value, index: index });
},
emit: function (type, detail) {
detail.values = detail.value;
delete detail.value;
this.$emit(type, detail);
},
parseValues: function (values) {
var columnsPlaceholder = this.data.columnsPlaceholder;
return values.map(function (value, index) {
if (value &&
(!value.code || value.name === columnsPlaceholder[index])) {
return __assign(__assign({}, value), { code: '', name: '' });
}
return value;
});
},
onChange: function (event) {
var _this = this;
var _a;
var _b = event.detail, index = _b.index, picker = _b.picker, value = _b.value;
this.code = value[index].code;
(_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(function () {
_this.$emit('change', {
picker: picker,
values: _this.parseValues(picker.getValues()),
index: index,
});
});
},
getConfig: function (type) {
var areaList = this.data.areaList;
return (areaList && areaList["".concat(type, "_list")]) || {};
},
getList: function (type, code) {
if (type !== 'province' && !code) {
return [];
}
var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder;
var list = this.getConfig(type);
var result = Object.keys(list).map(function (code) { return ({
code: code,
name: list[code],
}); });
if (code != null) {
// oversea code
if (code[0] === '9' && type === 'city') {
code = '9';
}
result = result.filter(function (item) { return item.code.indexOf(code) === 0; });
}
if (typeToColumnsPlaceholder[type] && result.length) {
// set columns placeholder
var codeFill = type === 'province'
? ''
: type === 'city'
? EMPTY_CODE.slice(2, 4)
: EMPTY_CODE.slice(4, 6);
result.unshift({
code: "".concat(code).concat(codeFill),
name: typeToColumnsPlaceholder[type],
});
}
return result;
},
getIndex: function (type, code) {
var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
var list = this.getList(type, code.slice(0, compareNum - 2));
// oversea code
if (code[0] === '9' && type === 'province') {
compareNum = 1;
}
code = code.slice(0, compareNum);
for (var i = 0; i < list.length; i++) {
if (list[i].code.slice(0, compareNum) === code) {
return i;
}
}
return 0;
},
setValues: function () {
var picker = this.getPicker();
if (!picker) {
return;
}
var code = this.code || this.getDefaultCode();
var provinceList = this.getList('province');
var cityList = this.getList('city', code.slice(0, 2));
var stack = [];
var indexes = [];
var columnsNum = this.data.columnsNum;
if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, provinceList, false));
indexes.push(this.getIndex('province', code));
}
if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, cityList, false));
indexes.push(this.getIndex('city', code));
if (cityList.length && code.slice(2, 4) === '00') {
code = cityList[0].code;
}
}
if (columnsNum === 3) {
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
indexes.push(this.getIndex('county', code));
}
return Promise.all(stack)
.catch(function () { })
.then(function () { return picker.setIndexes(indexes); })
.catch(function () { });
},
getDefaultCode: function () {
var columnsPlaceholder = this.data.columnsPlaceholder;
if (columnsPlaceholder.length) {
return EMPTY_CODE;
}
var countyCodes = Object.keys(this.getConfig('county'));
if (countyCodes[0]) {
return countyCodes[0];
}
var cityCodes = Object.keys(this.getConfig('city'));
if (cityCodes[0]) {
return cityCodes[0];
}
return '';
},
getValues: function () {
var picker = this.getPicker();
if (!picker) {
return [];
}
return this.parseValues(picker.getValues().filter(function (value) { return !!value; }));
},
getDetail: function () {
var values = this.getValues();
var area = {
code: '',
country: '',
province: '',
city: '',
county: '',
};
if (!values.length) {
return area;
}
var names = values.map(function (item) { return item.name; });
area.code = values[values.length - 1].code;
if (area.code[0] === '9') {
area.country = names[1] || '';
area.province = names[2] || '';
}
else {
area.province = names[0] || '';
area.city = names[1] || '';
area.county = names[2] || '';
}
return area;
},
reset: function (code) {
this.code = code || '';
return this.setValues();
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/area/index.json
================================================
{
"component": true,
"usingComponents": {
"van-picker": "../picker/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/area/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/area/index.wxs
================================================
/* eslint-disable */
function displayColumns(columns, columnsNum) {
return columns.slice(0, +columnsNum);
}
module.exports = {
displayColumns: displayColumns,
};
================================================
FILE: miniprogram_npm/@vant/weapp/area/index.wxss
================================================
@import '../common/index.wxss';
================================================
FILE: miniprogram_npm/@vant/weapp/button/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/button/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var button_1 = require("../mixins/button");
var version_1 = require("../common/version");
var mixins = [button_1.button];
if ((0, version_1.canIUseFormFieldButton)()) {
mixins.push('wx://form-field-button');
}
(0, component_1.VantComponent)({
mixins: mixins,
classes: ['hover-class', 'loading-class'],
data: {
baseStyle: '',
},
props: {
formType: String,
icon: String,
classPrefix: {
type: String,
value: 'van-icon',
},
plain: Boolean,
block: Boolean,
round: Boolean,
square: Boolean,
loading: Boolean,
hairline: Boolean,
disabled: Boolean,
loadingText: String,
customStyle: String,
loadingType: {
type: String,
value: 'circular',
},
type: {
type: String,
value: 'default',
},
dataset: null,
size: {
type: String,
value: 'normal',
},
loadingSize: {
type: String,
value: '20px',
},
color: String,
},
methods: {
onClick: function (event) {
var _this = this;
this.$emit('click', event);
var _a = this.data, canIUseGetUserProfile = _a.canIUseGetUserProfile, openType = _a.openType, getUserProfileDesc = _a.getUserProfileDesc, lang = _a.lang;
if (openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({
desc: getUserProfileDesc || ' ',
lang: lang || 'en',
complete: function (userProfile) {
_this.$emit('getuserinfo', userProfile);
},
});
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/button/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/button/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/button/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
function rootStyle(data) {
if (!data.color) {
return data.customStyle;
}
var properties = {
color: data.plain ? data.color : '#fff',
background: data.plain ? null : data.color,
};
// hide border when color is linear-gradient
if (data.color.indexOf('gradient') !== -1) {
properties.border = 0;
} else {
properties['border-color'] = data.color;
}
return style([properties, data.customStyle]);
}
function loadingColor(data) {
if (data.plain) {
return data.color ? data.color : '#c9c9c9';
}
if (data.type === 'default') {
return '#c9c9c9';
}
return '#fff';
}
module.exports = {
rootStyle: rootStyle,
loadingColor: loadingColor,
};
================================================
FILE: miniprogram_npm/@vant/weapp/button/index.wxss
================================================
@import '../common/index.wxss';.van-button{-webkit-text-size-adjust:100%;align-items:center;-webkit-appearance:none;border-radius:var(--button-border-radius,2px);box-sizing:border-box;display:inline-flex;font-size:var(--button-default-font-size,16px);height:var(--button-default-height,44px);justify-content:center;line-height:var(--button-line-height,20px);padding:0;position:relative;text-align:center;transition:opacity .2s;vertical-align:middle}.van-button:before{background-color:#000;border:inherit;border-color:#000;border-radius:inherit;content:" ";height:100%;left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);width:100%}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{background:var(--button-default-background-color,#fff);border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0);color:var(--button-default-color,#323233)}.van-button--primary{background:var(--button-primary-background-color,#07c160);border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160);color:var(--button-primary-color,#fff)}.van-button--info{background:var(--button-info-background-color,#1989fa);border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa);color:var(--button-info-color,#fff)}.van-button--danger{background:var(--button-danger-background-color,#ee0a24);border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24);color:var(--button-danger-color,#fff)}.van-button--warning{background:var(--button-warning-background-color,#ff976a);border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a);color:var(--button-warning-color,#fff)}.van-button--plain{background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:var(--button-warning-background-color,#ff976a)}.van-button--large{height:var(--button-large-height,50px);width:100%}.van-button--normal{font-size:var(--button-normal-font-size,14px);padding:0 15px}.van-button--small{font-size:var(--button-small-font-size,12px);height:var(--button-small-height,30px);min-width:var(--button-small-min-width,60px);padding:0 var(--padding-xs,8px)}.van-button--mini{display:inline-block;font-size:var(--button-mini-font-size,10px);height:var(--button-mini-height,22px);min-width:var(--button-mini-min-width,50px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:flex;width:100%}.van-button--round{border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{line-height:inherit!important;min-width:1em;vertical-align:top}.van-button--hairline{border-width:0;padding-top:1px}.van-button--hairline:after{border-color:inherit;border-radius:calc(var(--button-border-radius, 2px)*2);border-width:1px}.van-button--hairline.van-button--round:after{border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/calendar.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/header/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/header/index.js
================================================
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../../../common/component");
(0, component_1.VantComponent)({
props: {
title: {
type: String,
value: '日期选择',
},
subtitle: String,
showTitle: Boolean,
showSubtitle: Boolean,
firstDayOfWeek: {
type: Number,
observer: 'initWeekDay',
},
},
data: {
weekdays: [],
},
created: function () {
this.initWeekDay();
},
methods: {
initWeekDay: function () {
var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六'];
var firstDayOfWeek = this.data.firstDayOfWeek || 0;
this.setData({
weekdays: __spreadArray(__spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7), true), defaultWeeks.slice(0, firstDayOfWeek), true),
});
},
onClickSubtitle: function (event) {
this.$emit('click-subtitle', event);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/header/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss
================================================
@import '../../../common/index.wxss';.van-calendar__header{box-shadow:var(--calendar-header-box-shadow,0 2px 10px hsla(220,1%,50%,.16));flex-shrink:0}.van-calendar__header-subtitle,.van-calendar__header-title{font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:flex}.van-calendar__weekday{flex:1;font-size:var(--calendar-weekdays-font-size,12px);line-height:var(--calendar-weekdays-height,30px);text-align:center}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/month/index.d.ts
================================================
export interface Day {
date: Date;
type: string;
text: number;
bottomInfo?: string;
}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/month/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../../../common/component");
var utils_1 = require("../../utils");
(0, component_1.VantComponent)({
props: {
date: {
type: null,
observer: 'setDays',
},
type: {
type: String,
observer: 'setDays',
},
color: String,
minDate: {
type: null,
observer: 'setDays',
},
maxDate: {
type: null,
observer: 'setDays',
},
showMark: Boolean,
rowHeight: null,
formatter: {
type: null,
observer: 'setDays',
},
currentDate: {
type: null,
observer: 'setDays',
},
firstDayOfWeek: {
type: Number,
observer: 'setDays',
},
allowSameDay: Boolean,
showSubtitle: Boolean,
showMonthTitle: Boolean,
},
data: {
visible: true,
days: [],
},
methods: {
onClick: function (event) {
var index = event.currentTarget.dataset.index;
var item = this.data.days[index];
if (item.type !== 'disabled') {
this.$emit('click', item);
}
},
setDays: function () {
var days = [];
var startDate = new Date(this.data.date);
var year = startDate.getFullYear();
var month = startDate.getMonth();
var totalDay = (0, utils_1.getMonthEndDay)(startDate.getFullYear(), startDate.getMonth() + 1);
for (var day = 1; day <= totalDay; day++) {
var date = new Date(year, month, day);
var type = this.getDayType(date);
var config = {
date: date,
type: type,
text: day,
bottomInfo: this.getBottomInfo(type),
};
if (this.data.formatter) {
config = this.data.formatter(config);
}
days.push(config);
}
this.setData({ days: days });
},
getMultipleDayType: function (day) {
var currentDate = this.data.currentDate;
if (!Array.isArray(currentDate)) {
return '';
}
var isSelected = function (date) {
return currentDate.some(function (item) { return (0, utils_1.compareDay)(item, date) === 0; });
};
if (isSelected(day)) {
var prevDay = (0, utils_1.getPrevDay)(day);
var nextDay = (0, utils_1.getNextDay)(day);
var prevSelected = isSelected(prevDay);
var nextSelected = isSelected(nextDay);
if (prevSelected && nextSelected) {
return 'multiple-middle';
}
if (prevSelected) {
return 'end';
}
return nextSelected ? 'start' : 'multiple-selected';
}
return '';
},
getRangeDayType: function (day) {
var _a = this.data, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay;
if (!Array.isArray(currentDate)) {
return '';
}
var startDay = currentDate[0], endDay = currentDate[1];
if (!startDay) {
return '';
}
var compareToStart = (0, utils_1.compareDay)(day, startDay);
if (!endDay) {
return compareToStart === 0 ? 'start' : '';
}
var compareToEnd = (0, utils_1.compareDay)(day, endDay);
if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) {
return 'start-end';
}
if (compareToStart === 0) {
return 'start';
}
if (compareToEnd === 0) {
return 'end';
}
if (compareToStart > 0 && compareToEnd < 0) {
return 'middle';
}
return '';
},
getDayType: function (day) {
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, currentDate = _a.currentDate;
if ((0, utils_1.compareDay)(day, minDate) < 0 || (0, utils_1.compareDay)(day, maxDate) > 0) {
return 'disabled';
}
if (type === 'single') {
return (0, utils_1.compareDay)(day, currentDate) === 0 ? 'selected' : '';
}
if (type === 'multiple') {
return this.getMultipleDayType(day);
}
/* istanbul ignore else */
if (type === 'range') {
return this.getRangeDayType(day);
}
return '';
},
getBottomInfo: function (type) {
if (this.data.type === 'range') {
if (type === 'start') {
return '开始';
}
if (type === 'end') {
return '结束';
}
if (type === 'start-end') {
return '开始/结束';
}
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/month/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml
================================================
{{ computed.formatMonthTitle(date) }}
{{ computed.getMark(date) }}
{{ item.topInfo }}
{{ item.text }}
{{ item.bottomInfo }}
{{ item.topInfo }}
{{ item.text }}
{{ item.bottomInfo }}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs
================================================
/* eslint-disable */
var utils = require('../../utils.wxs');
function getMark(date) {
return getDate(date).getMonth() + 1;
}
var ROW_HEIGHT = 64;
function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
var style = [];
var current = getDate(date).getDay() || 7;
var offset = current < firstDayOfWeek ? (7 - firstDayOfWeek + current) :
current === 7 && firstDayOfWeek === 0 ? 0 :
(current - firstDayOfWeek);
if (index === 0) {
style.push(['margin-left', (100 * offset) / 7 + '%']);
}
if (rowHeight !== ROW_HEIGHT) {
style.push(['height', rowHeight + 'px']);
}
if (color) {
if (
type === 'start' ||
type === 'end' ||
type === 'start-end' ||
type === 'multiple-selected' ||
type === 'multiple-middle'
) {
style.push(['background', color]);
} else if (type === 'middle') {
style.push(['color', color]);
}
}
return style
.map(function(item) {
return item.join(':');
})
.join(';');
}
function formatMonthTitle(date) {
date = getDate(date);
return date.getFullYear() + '年' + (date.getMonth() + 1) + '月';
}
function getMonthStyle(visible, date, rowHeight) {
if (!visible) {
date = getDate(date);
var totalDay = utils.getMonthEndDay(
date.getFullYear(),
date.getMonth() + 1
);
var offset = getDate(date).getDay();
var padding = Math.ceil((totalDay + offset) / 7) * rowHeight;
return 'padding-bottom:' + padding + 'px';
}
}
module.exports = {
getMark: getMark,
getDayStyle: getDayStyle,
formatMonthTitle: formatMonthTitle,
getMonthStyle: getMonthStyle
};
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss
================================================
@import '../../../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:100%}.van-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.van-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.van-calendar__day,.van-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.van-calendar__day{font-size:var(--calendar-day-font-size,16px);height:var(--calendar-day-height,64px);position:relative;width:14.285%}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#ee0a24);color:var(--calendar-range-edge-color,#fff)}.van-calendar__day--start{border-radius:4px 0 0 4px}.van-calendar__day--end{border-radius:0 4px 4px 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px}.van-calendar__day--middle{color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{background-color:currentColor;bottom:0;content:"";left:0;opacity:var(--calendar-range-middle-background-opacity,.1);position:absolute;right:0;top:0}.van-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.van-calendar__bottom-info,.van-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,54px);width:var(--calendar-selected-day-size,54px)}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/index.js
================================================
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("./utils");
var toast_1 = __importDefault(require("../toast/toast"));
var utils_2 = require("../common/utils");
var initialMinDate = (0, utils_1.getToday)().getTime();
var initialMaxDate = (function () {
var now = (0, utils_1.getToday)();
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
})();
var getTime = function (date) {
return date instanceof Date ? date.getTime() : date;
};
(0, component_1.VantComponent)({
props: {
title: {
type: String,
value: '日期选择',
},
color: String,
show: {
type: Boolean,
observer: function (val) {
if (val) {
this.initRect();
this.scrollIntoView();
}
},
},
formatter: null,
confirmText: {
type: String,
value: '确定',
},
confirmDisabledText: {
type: String,
value: '确定',
},
rangePrompt: String,
showRangePrompt: {
type: Boolean,
value: true,
},
defaultDate: {
type: null,
value: (0, utils_1.getToday)().getTime(),
observer: function (val) {
this.setData({ currentDate: val });
this.scrollIntoView();
},
},
allowSameDay: Boolean,
type: {
type: String,
value: 'single',
observer: 'reset',
},
minDate: {
type: Number,
value: initialMinDate,
},
maxDate: {
type: Number,
value: initialMaxDate,
},
position: {
type: String,
value: 'bottom',
},
rowHeight: {
type: null,
value: utils_1.ROW_HEIGHT,
},
round: {
type: Boolean,
value: true,
},
poppable: {
type: Boolean,
value: true,
},
showMark: {
type: Boolean,
value: true,
},
showTitle: {
type: Boolean,
value: true,
},
showConfirm: {
type: Boolean,
value: true,
},
showSubtitle: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
maxRange: {
type: null,
value: null,
},
minRange: {
type: Number,
value: 1,
},
firstDayOfWeek: {
type: Number,
value: 0,
},
readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
subtitle: '',
currentDate: null,
scrollIntoView: '',
},
watch: {
minDate: function () {
this.initRect();
},
maxDate: function () {
this.initRect();
},
},
created: function () {
this.setData({
currentDate: this.getInitialDate(this.data.defaultDate),
});
},
mounted: function () {
if (this.data.show || !this.data.poppable) {
this.initRect();
this.scrollIntoView();
}
},
methods: {
reset: function () {
this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
this.scrollIntoView();
},
initRect: function () {
var _this = this;
if (this.contentObserver != null) {
this.contentObserver.disconnect();
}
var contentObserver = this.createIntersectionObserver({
thresholds: [0, 0.1, 0.9, 1],
observeAll: true,
});
this.contentObserver = contentObserver;
contentObserver.relativeTo('.van-calendar__body');
contentObserver.observe('.month', function (res) {
if (res.boundingClientRect.top <= res.relativeRect.top) {
// @ts-ignore
_this.setData({ subtitle: (0, utils_1.formatMonthTitle)(res.dataset.date) });
}
});
},
limitDateRange: function (date, minDate, maxDate) {
if (minDate === void 0) { minDate = null; }
if (maxDate === void 0) { maxDate = null; }
minDate = minDate || this.data.minDate;
maxDate = maxDate || this.data.maxDate;
if ((0, utils_1.compareDay)(date, minDate) === -1) {
return minDate;
}
if ((0, utils_1.compareDay)(date, maxDate) === 1) {
return maxDate;
}
return date;
},
getInitialDate: function (defaultDate) {
var _this = this;
if (defaultDate === void 0) { defaultDate = null; }
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay;
if (!defaultDate)
return [];
var now = (0, utils_1.getToday)().getTime();
if (type === 'range') {
if (!Array.isArray(defaultDate)) {
defaultDate = [];
}
var _b = defaultDate || [], startDay = _b[0], endDay = _b[1];
var startDate = getTime(startDay || now);
var start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
var date = getTime(endDay || now);
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
return [start, end];
}
if (type === 'multiple') {
if (Array.isArray(defaultDate)) {
return defaultDate.map(function (date) { return _this.limitDateRange(date); });
}
return [this.limitDateRange(now)];
}
if (!defaultDate || Array.isArray(defaultDate)) {
defaultDate = now;
}
return this.limitDateRange(defaultDate);
},
scrollIntoView: function () {
var _this = this;
(0, utils_2.requestAnimationFrame)(function () {
var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate;
if (!currentDate)
return;
// @ts-ignore
var targetDate = type === 'single' ? currentDate : currentDate[0];
var displayed = show || !poppable;
if (!targetDate || !displayed) {
return;
}
var months = (0, utils_1.getMonths)(minDate, maxDate);
months.some(function (month, index) {
if ((0, utils_1.compareMonth)(month, targetDate) === 0) {
_this.setData({ scrollIntoView: "month".concat(index) });
return true;
}
return false;
});
});
},
onOpen: function () {
this.$emit('open');
},
onOpened: function () {
this.$emit('opened');
},
onClose: function () {
this.$emit('close');
},
onClosed: function () {
this.$emit('closed');
},
onClickDay: function (event) {
if (this.data.readonly) {
return;
}
var date = event.detail.date;
var _a = this.data, type = _a.type, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay;
if (type === 'range') {
// @ts-ignore
var startDay_1 = currentDate[0], endDay = currentDate[1];
if (startDay_1 && !endDay) {
var compareToStart = (0, utils_1.compareDay)(date, startDay_1);
if (compareToStart === 1) {
var days_1 = this.selectComponent('.month').data.days;
days_1.some(function (day, index) {
var isDisabled = day.type === 'disabled' &&
getTime(startDay_1) < getTime(day.date) &&
getTime(day.date) < getTime(date);
if (isDisabled) {
(date = days_1[index - 1].date);
}
return isDisabled;
});
this.select([startDay_1, date], true);
}
else if (compareToStart === -1) {
this.select([date, null]);
}
else if (allowSameDay) {
this.select([date, date], true);
}
}
else {
this.select([date, null]);
}
}
else if (type === 'multiple') {
var selectedIndex_1;
// @ts-ignore
var selected = currentDate.some(function (dateItem, index) {
var equal = (0, utils_1.compareDay)(dateItem, date) === 0;
if (equal) {
selectedIndex_1 = index;
}
return equal;
});
if (selected) {
// @ts-ignore
var cancelDate = currentDate.splice(selectedIndex_1, 1);
this.setData({ currentDate: currentDate });
this.unselect(cancelDate);
}
else {
// @ts-ignore
this.select(__spreadArray(__spreadArray([], currentDate, true), [date], false));
}
}
else {
this.select(date, true);
}
},
unselect: function (dateArray) {
var date = dateArray[0];
if (date) {
this.$emit('unselect', (0, utils_1.copyDates)(date));
}
},
select: function (date, complete) {
if (complete && this.data.type === 'range') {
var valid = this.checkRange(date);
if (!valid) {
// auto selected to max range if showConfirm
if (this.data.showConfirm) {
this.emit([
date[0],
(0, utils_1.getDayByOffset)(date[0], this.data.maxRange - 1),
]);
}
else {
this.emit(date);
}
return;
}
}
this.emit(date);
if (complete && !this.data.showConfirm) {
this.onConfirm();
}
},
emit: function (date) {
this.setData({
currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date),
});
this.$emit('select', (0, utils_1.copyDates)(date));
},
checkRange: function (date) {
var _a = this.data, maxRange = _a.maxRange, rangePrompt = _a.rangePrompt, showRangePrompt = _a.showRangePrompt;
if (maxRange && (0, utils_1.calcDateNum)(date) > maxRange) {
if (showRangePrompt) {
(0, toast_1.default)({
context: this,
message: rangePrompt || "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ".concat(maxRange, " \u5929"),
});
}
this.$emit('over-range');
return false;
}
return true;
},
onConfirm: function () {
var _this = this;
if (this.data.type === 'range' &&
!this.checkRange(this.data.currentDate)) {
return;
}
wx.nextTick(function () {
// @ts-ignore
_this.$emit('confirm', (0, utils_1.copyDates)(_this.data.currentDate));
});
},
onClickSubtitle: function (event) {
this.$emit('click-subtitle', event);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/index.json
================================================
{
"component": true,
"usingComponents": {
"header": "./components/header/index",
"month": "./components/month/index",
"van-button": "../button/index",
"van-popup": "../popup/index",
"van-toast": "../toast/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/index.wxs
================================================
/* eslint-disable */
var utils = require('./utils.wxs');
function getMonths(minDate, maxDate) {
var months = [];
var cursor = getDate(minDate);
cursor.setDate(1);
do {
months.push(cursor.getTime());
cursor.setMonth(cursor.getMonth() + 1);
} while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);
return months;
}
function getButtonDisabled(type, currentDate, minRange) {
if (currentDate == null) {
return true;
}
if (type === 'range') {
return !currentDate[0] || !currentDate[1];
}
if (type === 'multiple') {
return currentDate.length < minRange;
}
return !currentDate;
}
module.exports = {
getMonths: getMonths,
getButtonDisabled: getButtonDisabled
};
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/index.wxss
================================================
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/utils.d.ts
================================================
export declare const ROW_HEIGHT = 64;
export declare function formatMonthTitle(date: Date): string;
export declare function compareMonth(date1: Date | number, date2: Date | number): 0 | 1 | -1;
export declare function compareDay(day1: Date | number, day2: Date | number): 0 | 1 | -1;
export declare function getDayByOffset(date: Date, offset: number): Date;
export declare function getPrevDay(date: Date): Date;
export declare function getNextDay(date: Date): Date;
export declare function getToday(): Date;
export declare function calcDateNum(date: [Date, Date]): number;
export declare function copyDates(dates: Date | Date[]): Date | Date[];
export declare function getMonthEndDay(year: number, month: number): number;
export declare function getMonths(minDate: number, maxDate: number): number[];
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/utils.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
exports.ROW_HEIGHT = 64;
function formatMonthTitle(date) {
if (!(date instanceof Date)) {
date = new Date(date);
}
return "".concat(date.getFullYear(), "\u5E74").concat(date.getMonth() + 1, "\u6708");
}
exports.formatMonthTitle = formatMonthTitle;
function compareMonth(date1, date2) {
if (!(date1 instanceof Date)) {
date1 = new Date(date1);
}
if (!(date2 instanceof Date)) {
date2 = new Date(date2);
}
var year1 = date1.getFullYear();
var year2 = date2.getFullYear();
var month1 = date1.getMonth();
var month2 = date2.getMonth();
if (year1 === year2) {
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
}
return year1 > year2 ? 1 : -1;
}
exports.compareMonth = compareMonth;
function compareDay(day1, day2) {
if (!(day1 instanceof Date)) {
day1 = new Date(day1);
}
if (!(day2 instanceof Date)) {
day2 = new Date(day2);
}
var compareMonthResult = compareMonth(day1, day2);
if (compareMonthResult === 0) {
var date1 = day1.getDate();
var date2 = day2.getDate();
return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
}
return compareMonthResult;
}
exports.compareDay = compareDay;
function getDayByOffset(date, offset) {
date = new Date(date);
date.setDate(date.getDate() + offset);
return date;
}
exports.getDayByOffset = getDayByOffset;
function getPrevDay(date) {
return getDayByOffset(date, -1);
}
exports.getPrevDay = getPrevDay;
function getNextDay(date) {
return getDayByOffset(date, 1);
}
exports.getNextDay = getNextDay;
function getToday() {
var today = new Date();
today.setHours(0, 0, 0, 0);
return today;
}
exports.getToday = getToday;
function calcDateNum(date) {
var day1 = new Date(date[0]).getTime();
var day2 = new Date(date[1]).getTime();
return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
}
exports.calcDateNum = calcDateNum;
function copyDates(dates) {
if (Array.isArray(dates)) {
return dates.map(function (date) {
if (date === null) {
return date;
}
return new Date(date);
});
}
return new Date(dates);
}
exports.copyDates = copyDates;
function getMonthEndDay(year, month) {
return 32 - new Date(year, month - 1, 32).getDate();
}
exports.getMonthEndDay = getMonthEndDay;
function getMonths(minDate, maxDate) {
var months = [];
var cursor = new Date(minDate);
cursor.setDate(1);
do {
months.push(cursor.getTime());
cursor.setMonth(cursor.getMonth() + 1);
} while (compareMonth(cursor, maxDate) !== 1);
return months;
}
exports.getMonths = getMonths;
================================================
FILE: miniprogram_npm/@vant/weapp/calendar/utils.wxs
================================================
/* eslint-disable */
function getMonthEndDay(year, month) {
return 32 - getDate(year, month - 1, 32).getDate();
}
function compareMonth(date1, date2) {
date1 = getDate(date1);
date2 = getDate(date2);
var year1 = date1.getFullYear();
var year2 = date2.getFullYear();
var month1 = date1.getMonth();
var month2 = date2.getMonth();
if (year1 === year2) {
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
}
return year1 > year2 ? 1 : -1;
}
module.exports = {
getMonthEndDay: getMonthEndDay,
compareMonth: compareMonth
};
================================================
FILE: miniprogram_npm/@vant/weapp/card/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/card/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var link_1 = require("../mixins/link");
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: [
'num-class',
'desc-class',
'thumb-class',
'title-class',
'price-class',
'origin-price-class',
],
mixins: [link_1.link],
props: {
tag: String,
num: String,
desc: String,
thumb: String,
title: String,
price: {
type: String,
observer: 'updatePrice',
},
centered: Boolean,
lazyLoad: Boolean,
thumbLink: String,
originPrice: String,
thumbMode: {
type: String,
value: 'aspectFit',
},
currency: {
type: String,
value: '¥',
},
},
methods: {
updatePrice: function () {
var price = this.data.price;
var priceArr = price.toString().split('.');
this.setData({
integerStr: priceArr[0],
decimalStr: priceArr[1] ? ".".concat(priceArr[1]) : '',
});
},
onClickThumb: function () {
this.jumpLink('thumbLink');
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/card/index.json
================================================
{
"component": true,
"usingComponents": {
"van-tag": "../tag/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/card/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/card/index.wxss
================================================
@import '../common/index.wxss';.van-card{background-color:var(--card-background-color,#fafafa);box-sizing:border-box;color:var(--card-text-color,#323233);font-size:var(--card-font-size,12px);padding:var(--card-padding,8px 16px);position:relative}.van-card__header{display:flex}.van-card__header--center{align-items:center;justify-content:center}.van-card__thumb{flex:none;height:var(--card-thumb-size,88px);margin-right:var(--padding-xs,8px);position:relative;width:var(--card-thumb-size,88px)}.van-card__thumb:empty{display:none}.van-card__img{border-radius:8px;height:100%;width:100%}.van-card__content{display:flex;flex:1;flex-direction:column;justify-content:space-between;min-height:var(--card-thumb-size,88px);min-width:0;position:relative}.van-card__content--center{justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:var(--card-title-line-height,16px)}.van-card__desc{color:var(--card-desc-color,#646566);line-height:var(--card-desc-line-height,20px)}.van-card__bottom{line-height:20px}.van-card__price{color:var(--card-price-color,#ee0a24);display:inline-block;font-size:var(--card-price-font-size,12px);font-weight:700}.van-card__price-integer{font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{color:var(--card-origin-price-color,#646566);display:inline-block;font-size:var(--card-origin-price-font-size,10px);margin-left:5px;text-decoration:line-through}.van-card__num{float:right}.van-card__tag{left:0;position:absolute!important;top:2px}.van-card__footer{flex:none;text-align:right;width:100%}
================================================
FILE: miniprogram_npm/@vant/weapp/cascader/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/cascader/index.js
================================================
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var FieldName;
(function (FieldName) {
FieldName["TEXT"] = "text";
FieldName["VALUE"] = "value";
FieldName["CHILDREN"] = "children";
})(FieldName || (FieldName = {}));
var defaultFieldNames = {
text: FieldName.TEXT,
value: FieldName.VALUE,
children: FieldName.CHILDREN,
};
(0, component_1.VantComponent)({
props: {
title: String,
value: {
type: String,
},
placeholder: {
type: String,
value: '请选择',
},
activeColor: {
type: String,
value: '#1989fa',
},
options: {
type: Array,
value: [],
},
swipeable: {
type: Boolean,
value: false,
},
closeable: {
type: Boolean,
value: true,
},
ellipsis: {
type: Boolean,
value: true,
},
showHeader: {
type: Boolean,
value: true,
},
closeIcon: {
type: String,
value: 'cross',
},
fieldNames: {
type: Object,
value: defaultFieldNames,
observer: 'updateFieldNames',
},
useTitleSlot: Boolean,
},
data: {
tabs: [],
activeTab: 0,
textKey: FieldName.TEXT,
valueKey: FieldName.VALUE,
childrenKey: FieldName.CHILDREN,
innerValue: '',
},
watch: {
options: function () {
this.updateTabs();
},
value: function (newVal) {
this.updateValue(newVal);
},
},
created: function () {
this.updateTabs();
},
methods: {
updateValue: function (val) {
var _this = this;
if (val !== undefined) {
var values = this.data.tabs.map(function (tab) { return tab.selected && tab.selected[_this.data.valueKey]; });
if (values.indexOf(val) > -1) {
return;
}
}
this.innerValue = val;
this.updateTabs();
},
updateFieldNames: function () {
var _a = this.data.fieldNames || defaultFieldNames, _b = _a.text, text = _b === void 0 ? 'text' : _b, _c = _a.value, value = _c === void 0 ? 'value' : _c, _d = _a.children, children = _d === void 0 ? 'children' : _d;
this.setData({
textKey: text,
valueKey: value,
childrenKey: children,
});
},
getSelectedOptionsByValue: function (options, value) {
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option[this.data.valueKey] === value) {
return [option];
}
if (option[this.data.childrenKey]) {
var selectedOptions = this.getSelectedOptionsByValue(option[this.data.childrenKey], value);
if (selectedOptions) {
return __spreadArray([option], selectedOptions, true);
}
}
}
},
updateTabs: function () {
var _this = this;
var options = this.data.options;
var innerValue = this.innerValue;
if (!options.length) {
return;
}
if (innerValue !== undefined) {
var selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
if (selectedOptions) {
var optionsCursor_1 = options;
var tabs_1 = selectedOptions.map(function (option) {
var tab = {
options: optionsCursor_1,
selected: option,
};
var next = optionsCursor_1.find(function (item) { return item[_this.data.valueKey] === option[_this.data.valueKey]; });
if (next) {
optionsCursor_1 = next[_this.data.childrenKey];
}
return tab;
});
if (optionsCursor_1) {
tabs_1.push({
options: optionsCursor_1,
selected: null,
});
}
this.setData({
tabs: tabs_1,
});
wx.nextTick(function () {
_this.setData({
activeTab: tabs_1.length - 1,
});
});
return;
}
}
this.setData({
tabs: [
{
options: options,
selected: null,
},
],
activeTab: 0,
});
},
onClose: function () {
this.$emit('close');
},
onClickTab: function (e) {
var _a = e.detail, tabIndex = _a.index, title = _a.title;
this.$emit('click-tab', { title: title, tabIndex: tabIndex });
this.setData({
activeTab: tabIndex,
});
},
// 选中
onSelect: function (e) {
var _this = this;
var _a = e.currentTarget.dataset, option = _a.option, tabIndex = _a.tabIndex;
if (option && option.disabled) {
return;
}
var _b = this.data, valueKey = _b.valueKey, childrenKey = _b.childrenKey;
var tabs = this.data.tabs;
tabs[tabIndex].selected = option;
if (tabs.length > tabIndex + 1) {
tabs = tabs.slice(0, tabIndex + 1);
}
if (option[childrenKey]) {
var nextTab = {
options: option[childrenKey],
selected: null,
};
if (tabs[tabIndex + 1]) {
tabs[tabIndex + 1] = nextTab;
}
else {
tabs.push(nextTab);
}
wx.nextTick(function () {
_this.setData({
activeTab: tabIndex + 1,
});
});
}
this.setData({
tabs: tabs,
});
var selectedOptions = tabs.map(function (tab) { return tab.selected; }).filter(Boolean);
var value = option[valueKey];
var params = {
value: value,
tabIndex: tabIndex,
selectedOptions: selectedOptions,
};
this.innerValue = value;
this.$emit('change', params);
if (!option[childrenKey]) {
this.$emit('finish', params);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/cascader/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-tab": "../tab/index",
"van-tabs": "../tabs/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/cascader/index.wxml
================================================
{{ option[textKey] }}
================================================
FILE: miniprogram_npm/@vant/weapp/cascader/index.wxs
================================================
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function isSelected(tab, valueKey, option) {
return tab.selected && tab.selected[valueKey] === option[valueKey]
}
function optionClass(tab, valueKey, option) {
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
}
function optionStyle(data) {
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
return style({
color
});
}
module.exports = {
isSelected: isSelected,
optionClass: optionClass,
optionStyle: optionStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/cascader/index.wxss
================================================
@import '../common/index.wxss';.van-cascader__header{align-items:center;display:flex;height:48px;justify-content:space-between;padding:0 16px}.van-cascader__title{font-size:16px;font-weight:600;line-height:20px}.van-cascader__close-icon{color:#c8c9cc;font-size:22px;height:22px}.van-cascader__tabs-wrap{height:48px!important;padding:0 8px}.van-cascader__tab{color:#323233!important;flex:none!important;font-weight:600!important;padding:0 8px!important}.van-cascader__tab--unselected{color:#969799!important;font-weight:400!important}.van-cascader__option{align-items:center;cursor:pointer;display:flex;font-size:14px;justify-content:space-between;line-height:20px;padding:10px 16px}.van-cascader__option:active{background-color:#f2f3f5}.van-cascader__option--selected{color:#1989fa;font-weight:600}.van-cascader__option--disabled{color:#c8c9cc;cursor:not-allowed}.van-cascader__option--disabled:active{background-color:initial}.van-cascader__options{-webkit-overflow-scrolling:touch;box-sizing:border-box;height:384px;overflow-y:auto;padding-top:6px}
================================================
FILE: miniprogram_npm/@vant/weapp/cell/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/cell/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var link_1 = require("../mixins/link");
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: [
'title-class',
'label-class',
'value-class',
'right-icon-class',
'hover-class',
],
mixins: [link_1.link],
props: {
title: null,
value: null,
icon: String,
size: String,
label: String,
center: Boolean,
isLink: Boolean,
required: Boolean,
clickable: Boolean,
titleWidth: String,
customStyle: String,
arrowDirection: String,
useLabelSlot: Boolean,
border: {
type: Boolean,
value: true,
},
titleStyle: String,
},
methods: {
onClick: function (event) {
this.$emit('click', event.detail);
this.jumpLink();
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/cell/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/cell/index.wxml
================================================
{{ title }}
{{ label }}
{{ value }}
================================================
FILE: miniprogram_npm/@vant/weapp/cell/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function titleStyle(data) {
return style([
{
'max-width': addUnit(data.titleWidth),
'min-width': addUnit(data.titleWidth),
},
data.titleStyle,
]);
}
module.exports = {
titleStyle: titleStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/cell/index.wxss
================================================
@import '../common/index.wxss';.van-cell{background-color:var(--cell-background-color,#fff);box-sizing:border-box;color:var(--cell-text-color,#323233);display:flex;font-size:var(--cell-font-size,14px);line-height:var(--cell-line-height,24px);padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);position:relative;width:100%}.van-cell:after{border-bottom:1px solid #ebedf0;bottom:0;box-sizing:border-box;content:" ";left:16px;pointer-events:none;position:absolute;right:16px;transform:scaleY(.5);transform-origin:center}.van-cell--borderless:after{display:none}.van-cell-group{background-color:var(--cell-background-color,#fff)}.van-cell__label{color:var(--cell-label-color,#969799);font-size:var(--cell-label-font-size,12px);line-height:var(--cell-label-line-height,18px);margin-top:var(--cell-label-margin-top,3px)}.van-cell__value{color:var(--cell-value-color,#969799);overflow:hidden;text-align:right;vertical-align:middle}.van-cell__title,.van-cell__value{flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{align-items:center;display:flex;font-size:var(--cell-icon-size,16px);height:var(--cell-line-height,24px)}.van-cell__left-icon-wrap{margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{color:var(--cell-right-icon-color,#969799);margin-left:var(--padding-base,4px)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{color:var(--cell-required-color,#ee0a24);content:"*";font-size:var(--cell-font-size,14px);left:var(--padding-xs,8px);position:absolute}.van-cell--center{align-items:center}.van-cell--large{padding-bottom:var(--cell-large-vertical-padding,12px);padding-top:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:var(--cell-large-label-font-size,14px)}
================================================
FILE: miniprogram_npm/@vant/weapp/cell-group/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/cell-group/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
title: String,
border: {
type: Boolean,
value: true,
},
inset: Boolean,
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/cell-group/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/cell-group/index.wxml
================================================
{{ title }}
================================================
FILE: miniprogram_npm/@vant/weapp/cell-group/index.wxss
================================================
@import '../common/index.wxss';.van-cell-group--inset{border-radius:var(--cell-group-inset-border-radius,8px);margin:var(--cell-group-inset-padding,0 16px);overflow:hidden}.van-cell-group__title{color:var(--cell-group-title-color,#969799);font-size:var(--cell-group-title-font-size,14px);line-height:var(--cell-group-title-line-height,16px);padding:var(--cell-group-title-padding,16px 16px 8px)}.van-cell-group__title--inset{padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)}
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var relation_1 = require("../common/relation");
var component_1 = require("../common/component");
function emit(target, value) {
target.$emit('input', value);
target.$emit('change', value);
}
(0, component_1.VantComponent)({
field: true,
relation: (0, relation_1.useParent)('checkbox-group'),
classes: ['icon-class', 'label-class'],
props: {
value: Boolean,
disabled: Boolean,
useIconSlot: Boolean,
checkedColor: String,
labelPosition: {
type: String,
value: 'right',
},
labelDisabled: Boolean,
shape: {
type: String,
value: 'round',
},
iconSize: {
type: null,
value: 20,
},
},
data: {
parentDisabled: false,
direction: 'vertical',
},
methods: {
emitChange: function (value) {
if (this.parent) {
this.setParentValue(this.parent, value);
}
else {
emit(this, value);
}
},
toggle: function () {
var _a = this.data, parentDisabled = _a.parentDisabled, disabled = _a.disabled, value = _a.value;
if (!disabled && !parentDisabled) {
this.emitChange(!value);
}
},
onClickLabel: function () {
var _a = this.data, labelDisabled = _a.labelDisabled, parentDisabled = _a.parentDisabled, disabled = _a.disabled, value = _a.value;
if (!disabled && !labelDisabled && !parentDisabled) {
this.emitChange(!value);
}
},
setParentValue: function (parent, value) {
var parentValue = parent.data.value.slice();
var name = this.data.name;
var max = parent.data.max;
if (value) {
if (max && parentValue.length >= max) {
return;
}
if (parentValue.indexOf(name) === -1) {
parentValue.push(name);
emit(parent, parentValue);
}
}
else {
var index = parentValue.indexOf(name);
if (index !== -1) {
parentValue.splice(index, 1);
emit(parent, parentValue);
}
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) {
var styles = {
'font-size': addUnit(iconSize),
};
if (checkedColor && value && !disabled && !parentDisabled) {
styles['border-color'] = checkedColor;
styles['background-color'] = checkedColor;
}
return style(styles);
}
module.exports = {
iconStyle: iconStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox/index.wxss
================================================
@import '../common/index.wxss';.van-checkbox{align-items:center;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{align-items:center;border:1px solid var(--checkbox-border-color,#c8c9cc);box-sizing:border-box;color:transparent;display:flex;font-size:var(--checkbox-size,20px);height:1em;justify-content:center;text-align:center;transition-duration:var(--checkbox-transition-duration,.2s);transition-property:color,border-color,background-color;width:1em}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:var(--checkbox-checked-icon-color,#1989fa);color:#fff}.van-checkbox__icon--disabled{background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;color:var(--checkbox-label-color,#323233);padding-left:var(--checkbox-label-margin,10px)}.van-checkbox__label--left{float:left;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0}
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox-group/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox-group/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var relation_1 = require("../common/relation");
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
field: true,
relation: (0, relation_1.useChildren)('checkbox', function (target) {
this.updateChild(target);
}),
props: {
max: Number,
value: {
type: Array,
observer: 'updateChildren',
},
disabled: {
type: Boolean,
observer: 'updateChildren',
},
direction: {
type: String,
value: 'vertical',
},
},
methods: {
updateChildren: function () {
var _this = this;
this.children.forEach(function (child) { return _this.updateChild(child); });
},
updateChild: function (child) {
var _a = this.data, value = _a.value, disabled = _a.disabled, direction = _a.direction;
child.setData({
value: value.indexOf(child.data.name) !== -1,
parentDisabled: disabled,
direction: direction,
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox-group/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox-group/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/checkbox-group/index.wxss
================================================
@import '../common/index.wxss';.van-checkbox-group--horizontal{display:flex;flex-wrap:wrap}
================================================
FILE: miniprogram_npm/@vant/weapp/circle/canvas.d.ts
================================================
///
type CanvasContext = WechatMiniprogram.CanvasContext;
export declare function adaptor(ctx: CanvasContext & Record): CanvasContext;
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/circle/canvas.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.adaptor = void 0;
function adaptor(ctx) {
// @ts-ignore
return Object.assign(ctx, {
setStrokeStyle: function (val) {
ctx.strokeStyle = val;
},
setLineWidth: function (val) {
ctx.lineWidth = val;
},
setLineCap: function (val) {
ctx.lineCap = val;
},
setFillStyle: function (val) {
ctx.fillStyle = val;
},
setFontSize: function (val) {
ctx.font = String(val);
},
setGlobalAlpha: function (val) {
ctx.globalAlpha = val;
},
setLineJoin: function (val) {
ctx.lineJoin = val;
},
setTextAlign: function (val) {
ctx.textAlign = val;
},
setMiterLimit: function (val) {
ctx.miterLimit = val;
},
setShadow: function (offsetX, offsetY, blur, color) {
ctx.shadowOffsetX = offsetX;
ctx.shadowOffsetY = offsetY;
ctx.shadowBlur = blur;
ctx.shadowColor = color;
},
setTextBaseline: function (val) {
ctx.textBaseline = val;
},
createCircularGradient: function () { },
draw: function () { },
});
}
exports.adaptor = adaptor;
================================================
FILE: miniprogram_npm/@vant/weapp/circle/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/circle/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var color_1 = require("../common/color");
var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
var validator_1 = require("../common/validator");
var version_1 = require("../common/version");
var canvas_1 = require("./canvas");
function format(rate) {
return Math.min(Math.max(rate, 0), 100);
}
var PERIMETER = 2 * Math.PI;
var BEGIN_ANGLE = -Math.PI / 2;
var STEP = 1;
(0, component_1.VantComponent)({
props: {
text: String,
lineCap: {
type: String,
value: 'round',
},
value: {
type: Number,
value: 0,
observer: 'reRender',
},
speed: {
type: Number,
value: 50,
},
size: {
type: Number,
value: 100,
observer: function () {
this.drawCircle(this.currentValue);
},
},
fill: String,
layerColor: {
type: String,
value: color_1.WHITE,
},
color: {
type: null,
value: color_1.BLUE,
observer: function () {
var _this = this;
this.setHoverColor().then(function () {
_this.drawCircle(_this.currentValue);
});
},
},
type: {
type: String,
value: '',
},
strokeWidth: {
type: Number,
value: 4,
},
clockwise: {
type: Boolean,
value: true,
},
},
data: {
hoverColor: color_1.BLUE,
},
methods: {
getContext: function () {
var _this = this;
var _a = this.data, type = _a.type, size = _a.size;
if (type === '' || !(0, version_1.canIUseCanvas2d)()) {
var ctx = wx.createCanvasContext('van-circle', this);
return Promise.resolve(ctx);
}
var dpr = (0, utils_1.getSystemInfoSync)().pixelRatio;
return new Promise(function (resolve) {
wx.createSelectorQuery()
.in(_this)
.select('#van-circle')
.node()
.exec(function (res) {
var canvas = res[0].node;
var ctx = canvas.getContext(type);
if (!_this.inited) {
_this.inited = true;
canvas.width = size * dpr;
canvas.height = size * dpr;
ctx.scale(dpr, dpr);
}
resolve((0, canvas_1.adaptor)(ctx));
});
});
},
setHoverColor: function () {
var _this = this;
var _a = this.data, color = _a.color, size = _a.size;
if ((0, validator_1.isObj)(color)) {
return this.getContext().then(function (context) {
if (!context)
return;
var LinearColor = context.createLinearGradient(size, 0, 0, 0);
Object.keys(color)
.sort(function (a, b) { return parseFloat(a) - parseFloat(b); })
.map(function (key) {
return LinearColor.addColorStop(parseFloat(key) / 100, color[key]);
});
_this.hoverColor = LinearColor;
});
}
this.hoverColor = color;
return Promise.resolve();
},
presetCanvas: function (context, strokeStyle, beginAngle, endAngle, fill) {
var _a = this.data, strokeWidth = _a.strokeWidth, lineCap = _a.lineCap, clockwise = _a.clockwise, size = _a.size;
var position = size / 2;
var radius = position - strokeWidth / 2;
context.setStrokeStyle(strokeStyle);
context.setLineWidth(strokeWidth);
context.setLineCap(lineCap);
context.beginPath();
context.arc(position, position, radius, beginAngle, endAngle, !clockwise);
context.stroke();
if (fill) {
context.setFillStyle(fill);
context.fill();
}
},
renderLayerCircle: function (context) {
var _a = this.data, layerColor = _a.layerColor, fill = _a.fill;
this.presetCanvas(context, layerColor, 0, PERIMETER, fill);
},
renderHoverCircle: function (context, formatValue) {
var clockwise = this.data.clockwise;
// 结束角度
var progress = PERIMETER * (formatValue / 100);
var endAngle = clockwise
? BEGIN_ANGLE + progress
: 3 * Math.PI - (BEGIN_ANGLE + progress);
this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle);
},
drawCircle: function (currentValue) {
var _this = this;
var size = this.data.size;
this.getContext().then(function (context) {
if (!context)
return;
context.clearRect(0, 0, size, size);
_this.renderLayerCircle(context);
var formatValue = format(currentValue);
if (formatValue !== 0) {
_this.renderHoverCircle(context, formatValue);
}
context.draw();
});
},
reRender: function () {
var _this = this;
// tofector 动画暂时没有想到好的解决方案
var _a = this.data, value = _a.value, speed = _a.speed;
if (speed <= 0 || speed > 1000) {
this.drawCircle(value);
return;
}
this.clearMockInterval();
this.currentValue = this.currentValue || 0;
var run = function () {
_this.interval = setTimeout(function () {
if (_this.currentValue !== value) {
if (Math.abs(_this.currentValue - value) < STEP) {
_this.currentValue = value;
}
else if (_this.currentValue < value) {
_this.currentValue += STEP;
}
else {
_this.currentValue -= STEP;
}
_this.drawCircle(_this.currentValue);
run();
}
else {
_this.clearMockInterval();
}
}, 1000 / speed);
};
run();
},
clearMockInterval: function () {
if (this.interval) {
clearTimeout(this.interval);
this.interval = null;
}
},
},
mounted: function () {
var _this = this;
this.currentValue = this.data.value;
this.setHoverColor().then(function () {
_this.drawCircle(_this.currentValue);
});
},
destroyed: function () {
this.clearMockInterval();
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/circle/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/circle/index.wxml
================================================
{{ text }}
================================================
FILE: miniprogram_npm/@vant/weapp/circle/index.wxss
================================================
@import '../common/index.wxss';.van-circle{display:inline-block;position:relative;text-align:center}.van-circle__text{color:var(--circle-text-color,#323233);left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%}
================================================
FILE: miniprogram_npm/@vant/weapp/col/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/col/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var relation_1 = require("../common/relation");
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
relation: (0, relation_1.useParent)('row'),
props: {
span: Number,
offset: Number,
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/col/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/col/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/col/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
if (!data.gutter) {
return '';
}
return style({
'padding-right': addUnit(data.gutter / 2),
'padding-left': addUnit(data.gutter / 2),
});
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/col/index.wxss
================================================
@import '../common/index.wxss';.van-col{box-sizing:border-box;float:left}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%}
================================================
FILE: miniprogram_npm/@vant/weapp/collapse/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/collapse/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('collapse-item'),
props: {
value: {
type: null,
observer: 'updateExpanded',
},
accordion: {
type: Boolean,
observer: 'updateExpanded',
},
border: {
type: Boolean,
value: true,
},
},
methods: {
updateExpanded: function () {
this.children.forEach(function (child) {
child.updateExpanded();
});
},
switch: function (name, expanded) {
var _a = this.data, accordion = _a.accordion, value = _a.value;
var changeItem = name;
if (!accordion) {
name = expanded
? (value || []).concat(name)
: (value || []).filter(function (activeName) { return activeName !== name; });
}
else {
name = expanded ? name : '';
}
if (expanded) {
this.$emit('open', changeItem);
}
else {
this.$emit('close', changeItem);
}
this.$emit('change', name);
this.$emit('input', name);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/collapse/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/collapse/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/collapse/index.wxss
================================================
@import '../common/index.wxss';
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/animate.d.ts
================================================
///
export declare function setContentAnimate(context: WechatMiniprogram.Component.TrivialInstance, expanded: boolean, mounted: boolean): void;
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/animate.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setContentAnimate = void 0;
var utils_1 = require("../common/utils");
function useAnimation(context, expanded, mounted, height) {
var animation = wx.createAnimation({
duration: 0,
timingFunction: 'ease-in-out',
});
if (expanded) {
if (height === 0) {
animation.height('auto').top(1).step();
}
else {
animation
.height(height)
.top(1)
.step({
duration: mounted ? 300 : 1,
})
.height('auto')
.step();
}
context.setData({
animation: animation.export(),
});
return;
}
animation.height(height).top(0).step({ duration: 1 }).height(0).step({
duration: 300,
});
context.setData({
animation: animation.export(),
});
}
function setContentAnimate(context, expanded, mounted) {
(0, utils_1.getRect)(context, '.van-collapse-item__content')
.then(function (rect) { return rect.height; })
.then(function (height) {
useAnimation(context, expanded, mounted, height);
});
}
exports.setContentAnimate = setContentAnimate;
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
var animate_1 = require("./animate");
(0, component_1.VantComponent)({
classes: ['title-class', 'content-class'],
relation: (0, relation_1.useParent)('collapse'),
props: {
size: String,
name: null,
title: null,
value: null,
icon: String,
label: String,
disabled: Boolean,
clickable: Boolean,
border: {
type: Boolean,
value: true,
},
isLink: {
type: Boolean,
value: true,
},
},
data: {
expanded: false,
parentBorder: true,
},
mounted: function () {
this.updateExpanded();
this.mounted = true;
},
methods: {
updateExpanded: function () {
if (!this.parent) {
return;
}
var _a = this.parent.data, value = _a.value, accordion = _a.accordion, border = _a.border;
var _b = this.parent.children, children = _b === void 0 ? [] : _b;
var name = this.data.name;
var index = children.indexOf(this);
var currentName = name == null ? index : name;
var expanded = accordion
? value === currentName
: (value || []).some(function (name) { return name === currentName; });
if (expanded !== this.data.expanded) {
(0, animate_1.setContentAnimate)(this, expanded, this.mounted);
}
this.setData({ index: index, expanded: expanded, parentBorder: border });
},
onClick: function () {
if (this.data.disabled) {
return;
}
var _a = this.data, name = _a.name, expanded = _a.expanded;
var index = this.parent.children.indexOf(this);
var currentName = name == null ? index : name;
this.parent.switch(currentName, !expanded);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/index.json
================================================
{
"component": true,
"usingComponents": {
"van-cell": "../cell/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/collapse-item/index.wxss
================================================
@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{transform:rotate(90deg);transition:transform var(--collapse-item-transition-duration,.3s)}.van-collapse-item__title--expanded .van-cell__right-icon{transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:var(--collapse-item-title-disabled-color,#c8c9cc)!important}.van-collapse-item__title--disabled .van-cell--hover{background-color:#fff!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{background-color:var(--collapse-item-content-background-color,#fff);color:var(--collapse-item-content-text-color,#969799);font-size:var(--collapse-item-content-font-size,13px);line-height:var(--collapse-item-content-line-height,1.5);padding:var(--collapse-item-content-padding,15px)}
================================================
FILE: miniprogram_npm/@vant/weapp/common/color.d.ts
================================================
export declare const RED = "#ee0a24";
export declare const BLUE = "#1989fa";
export declare const WHITE = "#fff";
export declare const GREEN = "#07c160";
export declare const ORANGE = "#ff976a";
export declare const GRAY = "#323233";
export declare const GRAY_DARK = "#969799";
================================================
FILE: miniprogram_npm/@vant/weapp/common/color.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GRAY_DARK = exports.GRAY = exports.ORANGE = exports.GREEN = exports.WHITE = exports.BLUE = exports.RED = void 0;
exports.RED = '#ee0a24';
exports.BLUE = '#1989fa';
exports.WHITE = '#fff';
exports.GREEN = '#07c160';
exports.ORANGE = '#ff976a';
exports.GRAY = '#323233';
exports.GRAY_DARK = '#969799';
================================================
FILE: miniprogram_npm/@vant/weapp/common/component.d.ts
================================================
///
import { VantComponentOptions } from 'definitions/index';
declare function VantComponent(vantOptions: VantComponentOptions): void;
export { VantComponent };
================================================
FILE: miniprogram_npm/@vant/weapp/common/component.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VantComponent = void 0;
var basic_1 = require("../mixins/basic");
function mapKeys(source, target, map) {
Object.keys(map).forEach(function (key) {
if (source[key]) {
target[map[key]] = source[key];
}
});
}
function VantComponent(vantOptions) {
var options = {};
mapKeys(vantOptions, options, {
data: 'data',
props: 'properties',
watch: 'observers',
mixins: 'behaviors',
methods: 'methods',
beforeCreate: 'created',
created: 'attached',
mounted: 'ready',
destroyed: 'detached',
classes: 'externalClasses',
});
// add default externalClasses
options.externalClasses = options.externalClasses || [];
options.externalClasses.push('custom-class');
// add default behaviors
options.behaviors = options.behaviors || [];
options.behaviors.push(basic_1.basic);
// add relations
var relation = vantOptions.relation;
if (relation) {
options.relations = relation.relations;
options.behaviors.push(relation.mixin);
}
// map field to form-field behavior
if (vantOptions.field) {
options.behaviors.push('wx://form-field');
}
// add default options
options.options = {
multipleSlots: true,
addGlobalClass: true,
};
Component(options);
}
exports.VantComponent = VantComponent;
================================================
FILE: miniprogram_npm/@vant/weapp/common/index.wxss
================================================
.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{clear:both;content:"";display:table}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
================================================
FILE: miniprogram_npm/@vant/weapp/common/relation.d.ts
================================================
///
type TrivialInstance = WechatMiniprogram.Component.TrivialInstance;
export declare function useParent(name: string, onEffect?: (this: TrivialInstance) => void): {
relations: {
[x: string]: WechatMiniprogram.Component.RelationOption;
};
mixin: string;
};
export declare function useChildren(name: string, onEffect?: (this: TrivialInstance, target: TrivialInstance) => void): {
relations: {
[x: string]: WechatMiniprogram.Component.RelationOption;
};
mixin: string;
};
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/common/relation.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useChildren = exports.useParent = void 0;
function useParent(name, onEffect) {
var _a;
var path = "../".concat(name, "/index");
return {
relations: (_a = {},
_a[path] = {
type: 'ancestor',
linked: function () {
onEffect && onEffect.call(this);
},
linkChanged: function () {
onEffect && onEffect.call(this);
},
unlinked: function () {
onEffect && onEffect.call(this);
},
},
_a),
mixin: Behavior({
created: function () {
var _this = this;
Object.defineProperty(this, 'parent', {
get: function () { return _this.getRelationNodes(path)[0]; },
});
Object.defineProperty(this, 'index', {
// @ts-ignore
get: function () { var _a, _b; return (_b = (_a = _this.parent) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.indexOf(_this); },
});
},
}),
};
}
exports.useParent = useParent;
function useChildren(name, onEffect) {
var _a;
var path = "../".concat(name, "/index");
return {
relations: (_a = {},
_a[path] = {
type: 'descendant',
linked: function (target) {
onEffect && onEffect.call(this, target);
},
linkChanged: function (target) {
onEffect && onEffect.call(this, target);
},
unlinked: function (target) {
onEffect && onEffect.call(this, target);
},
},
_a),
mixin: Behavior({
created: function () {
var _this = this;
Object.defineProperty(this, 'children', {
get: function () { return _this.getRelationNodes(path) || []; },
});
},
}),
};
}
exports.useChildren = useChildren;
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/clearfix.wxss
================================================
.van-clearfix:after{clear:both;content:"";display:table}
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss
================================================
.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3}
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/hairline.wxss
================================================
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/common/style/var.wxss
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/common/utils.d.ts
================================================
///
///
///
///
///
export { isDef } from './validator';
export { getSystemInfoSync } from './version';
export declare function range(num: number, min: number, max: number): number;
export declare function nextTick(cb: (...args: any[]) => void): void;
export declare function addUnit(value?: string | number): string | undefined;
export declare function requestAnimationFrame(cb: () => void): NodeJS.Timeout;
export declare function pickExclude(obj: unknown, keys: string[]): {};
export declare function getRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise;
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise;
export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
export declare function toPromise(promiseLike: Promise | unknown): Promise;
export declare function addNumber(num1: any, num2: any): number;
export declare const clamp: (num: any, min: any, max: any) => number;
export declare function getCurrentPage(): T & WechatMiniprogram.OptionalInterface & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods & WechatMiniprogram.Page.Data & WechatMiniprogram.IAnyObject;
export declare const isPC: boolean;
export declare const isWxWork: boolean;
================================================
FILE: miniprogram_npm/@vant/weapp/common/utils.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWxWork = exports.isPC = exports.getCurrentPage = exports.clamp = exports.addNumber = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0;
var validator_1 = require("./validator");
var version_1 = require("./version");
var validator_2 = require("./validator");
Object.defineProperty(exports, "isDef", { enumerable: true, get: function () { return validator_2.isDef; } });
var version_2 = require("./version");
Object.defineProperty(exports, "getSystemInfoSync", { enumerable: true, get: function () { return version_2.getSystemInfoSync; } });
function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
exports.range = range;
function nextTick(cb) {
if ((0, version_1.canIUseNextTick)()) {
wx.nextTick(cb);
}
else {
setTimeout(function () {
cb();
}, 1000 / 30);
}
}
exports.nextTick = nextTick;
function addUnit(value) {
if (!(0, validator_1.isDef)(value)) {
return undefined;
}
value = String(value);
return (0, validator_1.isNumber)(value) ? "".concat(value, "px") : value;
}
exports.addUnit = addUnit;
function requestAnimationFrame(cb) {
return setTimeout(function () {
cb();
}, 1000 / 30);
}
exports.requestAnimationFrame = requestAnimationFrame;
function pickExclude(obj, keys) {
if (!(0, validator_1.isPlainObject)(obj)) {
return {};
}
return Object.keys(obj).reduce(function (prev, key) {
if (!keys.includes(key)) {
prev[key] = obj[key];
}
return prev;
}, {});
}
exports.pickExclude = pickExclude;
function getRect(context, selector) {
return new Promise(function (resolve) {
wx.createSelectorQuery()
.in(context)
.select(selector)
.boundingClientRect()
.exec(function (rect) {
if (rect === void 0) { rect = []; }
return resolve(rect[0]);
});
});
}
exports.getRect = getRect;
function getAllRect(context, selector) {
return new Promise(function (resolve) {
wx.createSelectorQuery()
.in(context)
.selectAll(selector)
.boundingClientRect()
.exec(function (rect) {
if (rect === void 0) { rect = []; }
return resolve(rect[0]);
});
});
}
exports.getAllRect = getAllRect;
function groupSetData(context, cb) {
if ((0, version_1.canIUseGroupSetData)()) {
context.groupSetData(cb);
}
else {
cb();
}
}
exports.groupSetData = groupSetData;
function toPromise(promiseLike) {
if ((0, validator_1.isPromise)(promiseLike)) {
return promiseLike;
}
return Promise.resolve(promiseLike);
}
exports.toPromise = toPromise;
// 浮点数精度处理
function addNumber(num1, num2) {
var cardinal = Math.pow(10, 10);
return Math.round((num1 + num2) * cardinal) / cardinal;
}
exports.addNumber = addNumber;
// 限制value在[min, max]之间
var clamp = function (num, min, max) { return Math.min(Math.max(num, min), max); };
exports.clamp = clamp;
function getCurrentPage() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
exports.getCurrentPage = getCurrentPage;
exports.isPC = ['mac', 'windows'].includes((0, version_1.getSystemInfoSync)().platform);
// 是否企业微信
exports.isWxWork = (0, version_1.getSystemInfoSync)().environment === 'wxwork';
================================================
FILE: miniprogram_npm/@vant/weapp/common/validator.d.ts
================================================
export declare function isFunction(val: unknown): val is Function;
export declare function isPlainObject(val: unknown): val is Record;
export declare function isPromise(val: unknown): val is Promise;
export declare function isDef(value: unknown): boolean;
export declare function isObj(x: unknown): x is Record;
export declare function isNumber(value: string): boolean;
export declare function isBoolean(value: unknown): value is boolean;
export declare function isImageUrl(url: string): boolean;
export declare function isVideoUrl(url: string): boolean;
================================================
FILE: miniprogram_npm/@vant/weapp/common/validator.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isVideoUrl = exports.isImageUrl = exports.isBoolean = exports.isNumber = exports.isObj = exports.isDef = exports.isPromise = exports.isPlainObject = exports.isFunction = void 0;
// eslint-disable-next-line @typescript-eslint/ban-types
function isFunction(val) {
return typeof val === 'function';
}
exports.isFunction = isFunction;
function isPlainObject(val) {
return val !== null && typeof val === 'object' && !Array.isArray(val);
}
exports.isPlainObject = isPlainObject;
function isPromise(val) {
return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
}
exports.isPromise = isPromise;
function isDef(value) {
return value !== undefined && value !== null;
}
exports.isDef = isDef;
function isObj(x) {
var type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
exports.isObj = isObj;
function isNumber(value) {
return /^\d+(\.\d+)?$/.test(value);
}
exports.isNumber = isNumber;
function isBoolean(value) {
return typeof value === 'boolean';
}
exports.isBoolean = isBoolean;
var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
function isImageUrl(url) {
return IMAGE_REGEXP.test(url);
}
exports.isImageUrl = isImageUrl;
function isVideoUrl(url) {
return VIDEO_REGEXP.test(url);
}
exports.isVideoUrl = isVideoUrl;
================================================
FILE: miniprogram_npm/@vant/weapp/common/version.d.ts
================================================
///
interface WxWorkSystemInfo extends WechatMiniprogram.SystemInfo {
environment?: 'wxwork';
}
interface SystemInfo extends WxWorkSystemInfo, WechatMiniprogram.SystemInfo {
}
export declare function getSystemInfoSync(): SystemInfo;
export declare function canIUseModel(): boolean;
export declare function canIUseFormFieldButton(): boolean;
export declare function canIUseAnimate(): boolean;
export declare function canIUseGroupSetData(): boolean;
export declare function canIUseNextTick(): boolean;
export declare function canIUseCanvas2d(): boolean;
export declare function canIUseGetUserProfile(): boolean;
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/common/version.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.canIUseGetUserProfile = exports.canIUseCanvas2d = exports.canIUseNextTick = exports.canIUseGroupSetData = exports.canIUseAnimate = exports.canIUseFormFieldButton = exports.canIUseModel = exports.getSystemInfoSync = void 0;
var systemInfo;
function getSystemInfoSync() {
if (systemInfo == null) {
systemInfo = wx.getSystemInfoSync();
}
return systemInfo;
}
exports.getSystemInfoSync = getSystemInfoSync;
function compareVersion(v1, v2) {
v1 = v1.split('.');
v2 = v2.split('.');
var len = Math.max(v1.length, v2.length);
while (v1.length < len) {
v1.push('0');
}
while (v2.length < len) {
v2.push('0');
}
for (var i = 0; i < len; i++) {
var num1 = parseInt(v1[i], 10);
var num2 = parseInt(v2[i], 10);
if (num1 > num2) {
return 1;
}
if (num1 < num2) {
return -1;
}
}
return 0;
}
function gte(version) {
var system = getSystemInfoSync();
return compareVersion(system.SDKVersion, version) >= 0;
}
function canIUseModel() {
return gte('2.9.3');
}
exports.canIUseModel = canIUseModel;
function canIUseFormFieldButton() {
return gte('2.10.3');
}
exports.canIUseFormFieldButton = canIUseFormFieldButton;
function canIUseAnimate() {
return gte('2.9.0');
}
exports.canIUseAnimate = canIUseAnimate;
function canIUseGroupSetData() {
return gte('2.4.0');
}
exports.canIUseGroupSetData = canIUseGroupSetData;
function canIUseNextTick() {
try {
return wx.canIUse('nextTick');
}
catch (e) {
return gte('2.7.1');
}
}
exports.canIUseNextTick = canIUseNextTick;
function canIUseCanvas2d() {
return gte('2.9.0');
}
exports.canIUseCanvas2d = canIUseCanvas2d;
function canIUseGetUserProfile() {
return !!wx.getUserProfile;
}
exports.canIUseGetUserProfile = canIUseGetUserProfile;
================================================
FILE: miniprogram_npm/@vant/weapp/config-provider/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/config-provider/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
themeVars: {
type: Object,
value: {},
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/config-provider/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/config-provider/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/config-provider/index.wxs
================================================
/* eslint-disable */
var object = require('../wxs/object.wxs');
var style = require('../wxs/style.wxs');
function kebabCase(word) {
var newWord = word
.replace(getRegExp("[A-Z]", 'g'), function (i) {
return '-' + i;
})
.toLowerCase()
.replace(getRegExp("^-"), '');
return newWord;
}
function mapThemeVarsToCSSVars(themeVars) {
var cssVars = {};
object.keys(themeVars).forEach(function (key) {
var cssVarsKey = '--' + kebabCase(key);
cssVars[cssVarsKey] = themeVars[key];
});
return style(cssVars);
}
module.exports = {
kebabCase: kebabCase,
mapThemeVarsToCSSVars: mapThemeVarsToCSSVars,
};
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("./utils");
function simpleTick(fn) {
return setTimeout(fn, 30);
}
(0, component_1.VantComponent)({
props: {
useSlot: Boolean,
millisecond: Boolean,
time: {
type: Number,
observer: 'reset',
},
format: {
type: String,
value: 'HH:mm:ss',
},
autoStart: {
type: Boolean,
value: true,
},
},
data: {
timeData: (0, utils_1.parseTimeData)(0),
formattedTime: '0',
},
destroyed: function () {
clearTimeout(this.tid);
this.tid = null;
},
methods: {
// 开始
start: function () {
if (this.counting) {
return;
}
this.counting = true;
this.endTime = Date.now() + this.remain;
this.tick();
},
// 暂停
pause: function () {
this.counting = false;
clearTimeout(this.tid);
},
// 重置
reset: function () {
this.pause();
this.remain = this.data.time;
this.setRemain(this.remain);
if (this.data.autoStart) {
this.start();
}
},
tick: function () {
if (this.data.millisecond) {
this.microTick();
}
else {
this.macroTick();
}
},
microTick: function () {
var _this = this;
this.tid = simpleTick(function () {
_this.setRemain(_this.getRemain());
if (_this.remain !== 0) {
_this.microTick();
}
});
},
macroTick: function () {
var _this = this;
this.tid = simpleTick(function () {
var remain = _this.getRemain();
if (!(0, utils_1.isSameSecond)(remain, _this.remain) || remain === 0) {
_this.setRemain(remain);
}
if (_this.remain !== 0) {
_this.macroTick();
}
});
},
getRemain: function () {
return Math.max(this.endTime - Date.now(), 0);
},
setRemain: function (remain) {
this.remain = remain;
var timeData = (0, utils_1.parseTimeData)(remain);
if (this.data.useSlot) {
this.$emit('change', timeData);
}
this.setData({
formattedTime: (0, utils_1.parseFormat)(this.data.format, timeData),
});
if (remain === 0) {
this.pause();
this.$emit('finish');
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/index.wxml
================================================
{{ formattedTime }}
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/index.wxss
================================================
@import '../common/index.wxss';.van-count-down{color:var(--count-down-text-color,#323233);font-size:var(--count-down-font-size,14px);line-height:var(--count-down-line-height,20px)}
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/utils.d.ts
================================================
export type TimeData = {
days: number;
hours: number;
minutes: number;
seconds: number;
milliseconds: number;
};
export declare function parseTimeData(time: number): TimeData;
export declare function parseFormat(format: string, timeData: TimeData): string;
export declare function isSameSecond(time1: number, time2: number): boolean;
================================================
FILE: miniprogram_npm/@vant/weapp/count-down/utils.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSameSecond = exports.parseFormat = exports.parseTimeData = void 0;
function padZero(num, targetLength) {
if (targetLength === void 0) { targetLength = 2; }
var str = num + '';
while (str.length < targetLength) {
str = '0' + str;
}
return str;
}
var SECOND = 1000;
var MINUTE = 60 * SECOND;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
function parseTimeData(time) {
var days = Math.floor(time / DAY);
var hours = Math.floor((time % DAY) / HOUR);
var minutes = Math.floor((time % HOUR) / MINUTE);
var seconds = Math.floor((time % MINUTE) / SECOND);
var milliseconds = Math.floor(time % SECOND);
return {
days: days,
hours: hours,
minutes: minutes,
seconds: seconds,
milliseconds: milliseconds,
};
}
exports.parseTimeData = parseTimeData;
function parseFormat(format, timeData) {
var days = timeData.days;
var hours = timeData.hours, minutes = timeData.minutes, seconds = timeData.seconds, milliseconds = timeData.milliseconds;
if (format.indexOf('DD') === -1) {
hours += days * 24;
}
else {
format = format.replace('DD', padZero(days));
}
if (format.indexOf('HH') === -1) {
minutes += hours * 60;
}
else {
format = format.replace('HH', padZero(hours));
}
if (format.indexOf('mm') === -1) {
seconds += minutes * 60;
}
else {
format = format.replace('mm', padZero(minutes));
}
if (format.indexOf('ss') === -1) {
milliseconds += seconds * 1000;
}
else {
format = format.replace('ss', padZero(seconds));
}
return format.replace('SSS', padZero(milliseconds, 3));
}
exports.parseFormat = parseFormat;
function isSameSecond(time1, time2) {
return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
}
exports.isSameSecond = isSameSecond;
================================================
FILE: miniprogram_npm/@vant/weapp/datetime-picker/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/datetime-picker/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var validator_1 = require("../common/validator");
var shared_1 = require("../picker/shared");
var currentYear = new Date().getFullYear();
function isValidDate(date) {
return (0, validator_1.isDef)(date) && !isNaN(new Date(date).getTime());
}
function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
function padZero(val) {
return "00".concat(val).slice(-2);
}
function times(n, iteratee) {
var index = -1;
var result = Array(n < 0 ? 0 : n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
function getTrueValue(formattedValue) {
if (formattedValue === undefined) {
formattedValue = '1';
}
while (isNaN(parseInt(formattedValue, 10))) {
formattedValue = formattedValue.slice(1);
}
return parseInt(formattedValue, 10);
}
function getMonthEndDay(year, month) {
return 32 - new Date(year, month - 1, 32).getDate();
}
var defaultFormatter = function (type, value) { return value; };
(0, component_1.VantComponent)({
classes: ['active-class', 'toolbar-class', 'column-class'],
props: __assign(__assign({}, shared_1.pickerProps), { value: {
type: null,
observer: 'updateValue',
}, filter: null, type: {
type: String,
value: 'datetime',
observer: 'updateValue',
}, showToolbar: {
type: Boolean,
value: true,
}, formatter: {
type: null,
value: defaultFormatter,
}, minDate: {
type: Number,
value: new Date(currentYear - 10, 0, 1).getTime(),
observer: 'updateValue',
}, maxDate: {
type: Number,
value: new Date(currentYear + 10, 11, 31).getTime(),
observer: 'updateValue',
}, minHour: {
type: Number,
value: 0,
observer: 'updateValue',
}, maxHour: {
type: Number,
value: 23,
observer: 'updateValue',
}, minMinute: {
type: Number,
value: 0,
observer: 'updateValue',
}, maxMinute: {
type: Number,
value: 59,
observer: 'updateValue',
} }),
data: {
innerValue: Date.now(),
columns: [],
},
methods: {
updateValue: function () {
var _this = this;
var data = this.data;
var val = this.correctValue(data.value);
var isEqual = val === data.innerValue;
this.updateColumnValue(val).then(function () {
if (!isEqual) {
_this.$emit('input', val);
}
});
},
getPicker: function () {
if (this.picker == null) {
this.picker = this.selectComponent('.van-datetime-picker');
var picker_1 = this.picker;
var setColumnValues_1 = picker_1.setColumnValues;
picker_1.setColumnValues = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return setColumnValues_1.apply(picker_1, __spreadArray(__spreadArray([], args, true), [false], false));
};
}
return this.picker;
},
updateColumns: function () {
var _a = this.data.formatter, formatter = _a === void 0 ? defaultFormatter : _a;
var results = this.getOriginColumns().map(function (column) { return ({
values: column.values.map(function (value) { return formatter(column.type, value); }),
}); });
return this.set({ columns: results });
},
getOriginColumns: function () {
var filter = this.data.filter;
var results = this.getRanges().map(function (_a) {
var type = _a.type, range = _a.range;
var values = times(range[1] - range[0] + 1, function (index) {
var value = range[0] + index;
return type === 'year' ? "".concat(value) : padZero(value);
});
if (filter) {
values = filter(type, values);
}
return { type: type, values: values };
});
return results;
},
getRanges: function () {
var data = this.data;
if (data.type === 'time') {
return [
{
type: 'hour',
range: [data.minHour, data.maxHour],
},
{
type: 'minute',
range: [data.minMinute, data.maxMinute],
},
];
}
var _a = this.getBoundary('max', data.innerValue), maxYear = _a.maxYear, maxDate = _a.maxDate, maxMonth = _a.maxMonth, maxHour = _a.maxHour, maxMinute = _a.maxMinute;
var _b = this.getBoundary('min', data.innerValue), minYear = _b.minYear, minDate = _b.minDate, minMonth = _b.minMonth, minHour = _b.minHour, minMinute = _b.minMinute;
var result = [
{
type: 'year',
range: [minYear, maxYear],
},
{
type: 'month',
range: [minMonth, maxMonth],
},
{
type: 'day',
range: [minDate, maxDate],
},
{
type: 'hour',
range: [minHour, maxHour],
},
{
type: 'minute',
range: [minMinute, maxMinute],
},
];
if (data.type === 'date')
result.splice(3, 2);
if (data.type === 'year-month')
result.splice(2, 3);
return result;
},
correctValue: function (value) {
var data = this.data;
// validate value
var isDateType = data.type !== 'time';
if (isDateType && !isValidDate(value)) {
value = data.minDate;
}
else if (!isDateType && !value) {
var minHour = data.minHour;
value = "".concat(padZero(minHour), ":00");
}
// time type
if (!isDateType) {
var _a = value.split(':'), hour = _a[0], minute = _a[1];
hour = padZero(range(hour, data.minHour, data.maxHour));
minute = padZero(range(minute, data.minMinute, data.maxMinute));
return "".concat(hour, ":").concat(minute);
}
// date type
value = Math.max(value, data.minDate);
value = Math.min(value, data.maxDate);
return value;
},
getBoundary: function (type, innerValue) {
var _a;
var value = new Date(innerValue);
var boundary = new Date(this.data["".concat(type, "Date")]);
var year = boundary.getFullYear();
var month = 1;
var date = 1;
var hour = 0;
var minute = 0;
if (type === 'max') {
month = 12;
date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
hour = 23;
minute = 59;
}
if (value.getFullYear() === year) {
month = boundary.getMonth() + 1;
if (value.getMonth() + 1 === month) {
date = boundary.getDate();
if (value.getDate() === date) {
hour = boundary.getHours();
if (value.getHours() === hour) {
minute = boundary.getMinutes();
}
}
}
}
return _a = {},
_a["".concat(type, "Year")] = year,
_a["".concat(type, "Month")] = month,
_a["".concat(type, "Date")] = date,
_a["".concat(type, "Hour")] = hour,
_a["".concat(type, "Minute")] = minute,
_a;
},
onCancel: function () {
this.$emit('cancel');
},
onConfirm: function () {
this.$emit('confirm', this.data.innerValue);
},
onChange: function () {
var _this = this;
var data = this.data;
var value;
var picker = this.getPicker();
var originColumns = this.getOriginColumns();
if (data.type === 'time') {
var indexes = picker.getIndexes();
value = "".concat(+originColumns[0].values[indexes[0]], ":").concat(+originColumns[1]
.values[indexes[1]]);
}
else {
var indexes = picker.getIndexes();
var values = indexes.map(function (value, index) { return originColumns[index].values[value]; });
var year = getTrueValue(values[0]);
var month = getTrueValue(values[1]);
var maxDate = getMonthEndDay(year, month);
var date = getTrueValue(values[2]);
if (data.type === 'year-month') {
date = 1;
}
date = date > maxDate ? maxDate : date;
var hour = 0;
var minute = 0;
if (data.type === 'datetime') {
hour = getTrueValue(values[3]);
minute = getTrueValue(values[4]);
}
value = new Date(year, month - 1, date, hour, minute);
}
value = this.correctValue(value);
this.updateColumnValue(value).then(function () {
_this.$emit('input', value);
_this.$emit('change', picker);
});
},
updateColumnValue: function (value) {
var _this = this;
var values = [];
var type = this.data.type;
var formatter = this.data.formatter || defaultFormatter;
var picker = this.getPicker();
if (type === 'time') {
var pair = value.split(':');
values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
}
else {
var date = new Date(value);
values = [
formatter('year', "".concat(date.getFullYear())),
formatter('month', padZero(date.getMonth() + 1)),
];
if (type === 'date') {
values.push(formatter('day', padZero(date.getDate())));
}
if (type === 'datetime') {
values.push(formatter('day', padZero(date.getDate())), formatter('hour', padZero(date.getHours())), formatter('minute', padZero(date.getMinutes())));
}
}
return this.set({ innerValue: value })
.then(function () { return _this.updateColumns(); })
.then(function () { return picker.setValues(values); });
},
},
created: function () {
var _this = this;
var innerValue = this.correctValue(this.data.value);
this.updateColumnValue(innerValue).then(function () {
_this.$emit('input', innerValue);
});
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/datetime-picker/index.json
================================================
{
"component": true,
"usingComponents": {
"van-picker": "../picker/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/datetime-picker/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/datetime-picker/index.wxss
================================================
@import '../common/index.wxss';
================================================
FILE: miniprogram_npm/@vant/weapp/definitions/index.d.ts
================================================
///
interface VantComponentInstance {
parent: WechatMiniprogram.Component.TrivialInstance;
children: WechatMiniprogram.Component.TrivialInstance[];
index: number;
$emit: (name: string, detail?: unknown, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
setView: (value: Record, callback?: () => void) => void;
}
export type VantComponentOptions = {
data?: Data;
field?: boolean;
classes?: string[];
mixins?: string[];
props?: Props;
relation?: {
relations: Record;
mixin: string;
};
watch?: Record any>;
methods?: Methods;
beforeCreate?: () => void;
created?: () => void;
mounted?: () => void;
destroyed?: () => void;
} & ThisType, Props, Methods> & Record>;
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/definitions/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/dialog.d.ts
================================================
///
///
export type Action = 'confirm' | 'cancel' | 'overlay';
type DialogContext = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
interface DialogOptions {
lang?: string;
show?: boolean;
title?: string;
width?: string | number | null;
zIndex?: number;
theme?: string;
context?: (() => DialogContext) | DialogContext;
message?: string;
overlay?: boolean;
selector?: string;
ariaLabel?: string;
/**
* @deprecated use custom-class instead
*/
className?: string;
customStyle?: string;
transition?: string;
/**
* @deprecated use beforeClose instead
*/
asyncClose?: boolean;
beforeClose?: null | ((action: Action) => Promise | void);
businessId?: number;
sessionFrom?: string;
overlayStyle?: string;
appParameter?: string;
messageAlign?: string;
sendMessageImg?: string;
showMessageCard?: boolean;
sendMessagePath?: string;
sendMessageTitle?: string;
confirmButtonText?: string;
cancelButtonText?: string;
showConfirmButton?: boolean;
showCancelButton?: boolean;
closeOnClickOverlay?: boolean;
confirmButtonOpenType?: string;
}
declare const Dialog: {
(options: DialogOptions): Promise;
alert(options: DialogOptions): Promise;
confirm(options: DialogOptions): Promise;
close(): void;
stopLoading(): void;
currentOptions: DialogOptions;
defaultOptions: DialogOptions;
setDefaultOptions(options: DialogOptions): void;
resetDefaultOptions(): void;
};
export default Dialog;
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/dialog.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var queue = [];
var defaultOptions = {
show: false,
title: '',
width: null,
theme: 'default',
message: '',
zIndex: 100,
overlay: true,
selector: '#van-dialog',
className: '',
asyncClose: false,
beforeClose: null,
transition: 'scale',
customStyle: '',
messageAlign: '',
overlayStyle: '',
confirmButtonText: '确认',
cancelButtonText: '取消',
showConfirmButton: true,
showCancelButton: false,
closeOnClickOverlay: false,
confirmButtonOpenType: '',
};
var currentOptions = __assign({}, defaultOptions);
function getContext() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
var Dialog = function (options) {
options = __assign(__assign({}, currentOptions), options);
return new Promise(function (resolve, reject) {
var context = (typeof options.context === 'function'
? options.context()
: options.context) || getContext();
var dialog = context.selectComponent(options.selector);
delete options.context;
delete options.selector;
if (dialog) {
dialog.setData(__assign({ callback: function (action, instance) {
action === 'confirm' ? resolve(instance) : reject(instance);
} }, options));
wx.nextTick(function () {
dialog.setData({ show: true });
});
queue.push(dialog);
}
else {
console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
}
});
};
Dialog.alert = function (options) { return Dialog(options); };
Dialog.confirm = function (options) {
return Dialog(__assign({ showCancelButton: true }, options));
};
Dialog.close = function () {
queue.forEach(function (dialog) {
dialog.close();
});
queue = [];
};
Dialog.stopLoading = function () {
queue.forEach(function (dialog) {
dialog.stopLoading();
});
};
Dialog.currentOptions = currentOptions;
Dialog.defaultOptions = defaultOptions;
Dialog.setDefaultOptions = function (options) {
currentOptions = __assign(__assign({}, currentOptions), options);
Dialog.currentOptions = currentOptions;
};
Dialog.resetDefaultOptions = function () {
currentOptions = __assign({}, defaultOptions);
Dialog.currentOptions = currentOptions;
};
Dialog.resetDefaultOptions();
exports.default = Dialog;
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var button_1 = require("../mixins/button");
var color_1 = require("../common/color");
var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({
mixins: [button_1.button],
classes: ['cancle-button-class', 'confirm-button-class'],
props: {
show: {
type: Boolean,
observer: function (show) {
!show && this.stopLoading();
},
},
title: String,
message: String,
theme: {
type: String,
value: 'default',
},
confirmButtonId: String,
className: String,
customStyle: String,
asyncClose: Boolean,
messageAlign: String,
beforeClose: null,
overlayStyle: String,
useSlot: Boolean,
useTitleSlot: Boolean,
useConfirmButtonSlot: Boolean,
useCancelButtonSlot: Boolean,
showCancelButton: Boolean,
closeOnClickOverlay: Boolean,
confirmButtonOpenType: String,
width: null,
zIndex: {
type: Number,
value: 2000,
},
confirmButtonText: {
type: String,
value: '确认',
},
cancelButtonText: {
type: String,
value: '取消',
},
confirmButtonColor: {
type: String,
value: color_1.RED,
},
cancelButtonColor: {
type: String,
value: color_1.GRAY,
},
showConfirmButton: {
type: Boolean,
value: true,
},
overlay: {
type: Boolean,
value: true,
},
transition: {
type: String,
value: 'scale',
},
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
loading: {
confirm: false,
cancel: false,
},
callback: (function () { }),
},
methods: {
onConfirm: function () {
this.handleAction('confirm');
},
onCancel: function () {
this.handleAction('cancel');
},
onClickOverlay: function () {
this.close('overlay');
},
close: function (action) {
this.setData({ show: false });
this.closeAction = action;
},
onAfterLeave: function () {
var action = this.closeAction;
this.$emit('close', action);
var callback = this.data.callback;
if (callback) {
callback(action, this);
}
},
stopLoading: function () {
this.setData({
loading: {
confirm: false,
cancel: false,
},
});
},
handleAction: function (action) {
var _a;
var _this = this;
this.$emit(action, { dialog: this });
var _b = this.data, asyncClose = _b.asyncClose, beforeClose = _b.beforeClose;
if (!asyncClose && !beforeClose) {
this.close(action);
return;
}
this.setData((_a = {},
_a["loading.".concat(action)] = true,
_a));
if (beforeClose) {
(0, utils_1.toPromise)(beforeClose(action)).then(function (value) {
if (value) {
_this.close(action);
}
else {
_this.stopLoading();
}
});
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/index.json
================================================
{
"component": true,
"usingComponents": {
"van-popup": "../popup/index",
"van-button": "../button/index",
"van-goods-action": "../goods-action/index",
"van-goods-action-button": "../goods-action-button/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/index.wxml
================================================
{{ message }}
{{ cancelButtonText }}
{{ confirmButtonText }}
================================================
FILE: miniprogram_npm/@vant/weapp/dialog/index.wxss
================================================
@import '../common/index.wxss';.van-dialog{background-color:var(--dialog-background-color,#fff);border-radius:var(--dialog-border-radius,16px);font-size:var(--dialog-font-size,16px);overflow:hidden;top:45%!important;width:var(--dialog-width,320px)}@media (max-width:321px){.van-dialog{width:var(--dialog-small-screen-width,90%)}}.van-dialog__header{font-weight:var(--dialog-header-font-weight,500);line-height:var(--dialog-header-line-height,24px);padding-top:var(--dialog-header-padding-top,24px);text-align:center}.van-dialog__header--isolated{padding:var(--dialog-header-isolated-padding,24px 0)}.van-dialog__message{-webkit-overflow-scrolling:touch;font-size:var(--dialog-message-font-size,14px);line-height:var(--dialog-message-line-height,20px);max-height:var(--dialog-message-max-height,60vh);overflow-y:auto;padding:var(--dialog-message-padding,24px);text-align:center}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--hasTitle{color:var(--dialog-has-title-message-text-color,#646566);padding-top:var(--dialog-has-title-message-padding-top,8px)}.van-dialog__message--round-button{color:#323233;padding-bottom:16px}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__message--justify{text-align:justify}.van-dialog__footer{display:flex}.van-dialog__footer--round-button{padding:8px 24px 16px!important;position:relative!important}.van-dialog__button{flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog-bounce-enter{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;transform:translate3d(-50%,-50%,0) scale(.9)}
================================================
FILE: miniprogram_npm/@vant/weapp/divider/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/divider/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
dashed: Boolean,
hairline: Boolean,
contentPosition: String,
fontSize: String,
borderColor: String,
textColor: String,
customStyle: String,
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/divider/index.json
================================================
{
"component": true,
"usingComponents": {}
}
================================================
FILE: miniprogram_npm/@vant/weapp/divider/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/divider/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
return style([
{
'border-color': data.borderColor,
color: data.textColor,
'font-size': addUnit(data.fontSize),
},
data.customStyle,
]);
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/divider/index.wxss
================================================
@import '../common/index.wxss';.van-divider{align-items:center;border:0 solid var(--divider-border-color,#ebedf0);color:var(--divider-text-color,#969799);display:flex;font-size:var(--divider-font-size,14px);line-height:var(--divider-line-height,24px);margin:var(--divider-margin,16px 0)}.van-divider:after,.van-divider:before{border-color:inherit;border-style:inherit;border-width:1px 0 0;box-sizing:border-box;display:block;flex:1;height:1px}.van-divider:before{content:""}.van-divider--hairline:after,.van-divider--hairline:before{transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--center:before,.van-divider--left:before,.van-divider--right:before{margin-right:var(--divider-content-padding,16px)}.van-divider--center:after,.van-divider--left:after,.van-divider--right:after{content:"";margin-left:var(--divider-content-padding,16px)}.van-divider--left:before{max-width:var(--divider-content-left-width,10%)}.van-divider--right:after{max-width:var(--divider-content-right-width,10%)}
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var relation_1 = require("../common/relation");
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: ['item-title-class'],
field: true,
relation: (0, relation_1.useParent)('dropdown-menu', function () {
this.updateDataFromParent();
}),
props: {
value: {
type: null,
observer: 'rerender',
},
title: {
type: String,
observer: 'rerender',
},
disabled: Boolean,
titleClass: {
type: String,
observer: 'rerender',
},
options: {
type: Array,
value: [],
observer: 'rerender',
},
popupStyle: String,
useBeforeToggle: {
type: Boolean,
value: false,
},
rootPortal: {
type: Boolean,
value: false,
},
},
data: {
transition: true,
showPopup: false,
showWrapper: false,
displayTitle: '',
safeAreaTabBar: false,
},
methods: {
rerender: function () {
var _this = this;
wx.nextTick(function () {
var _a;
(_a = _this.parent) === null || _a === void 0 ? void 0 : _a.updateItemListData();
});
},
updateDataFromParent: function () {
if (this.parent) {
var _a = this.parent.data, overlay = _a.overlay, duration = _a.duration, activeColor = _a.activeColor, closeOnClickOverlay = _a.closeOnClickOverlay, direction = _a.direction, safeAreaTabBar = _a.safeAreaTabBar;
this.setData({
overlay: overlay,
duration: duration,
activeColor: activeColor,
closeOnClickOverlay: closeOnClickOverlay,
direction: direction,
safeAreaTabBar: safeAreaTabBar,
});
}
},
onOpen: function () {
this.$emit('open');
},
onOpened: function () {
this.$emit('opened');
},
onClose: function () {
this.$emit('close');
},
onClosed: function () {
this.$emit('closed');
this.setData({ showWrapper: false });
},
onOptionTap: function (event) {
var option = event.currentTarget.dataset.option;
var value = option.value;
var shouldEmitChange = this.data.value !== value;
this.setData({ showPopup: false, value: value });
this.$emit('close');
this.rerender();
if (shouldEmitChange) {
this.$emit('change', value);
}
},
toggle: function (show, options) {
var _this = this;
if (options === void 0) { options = {}; }
var showPopup = this.data.showPopup;
if (typeof show !== 'boolean') {
show = !showPopup;
}
if (show === showPopup) {
return;
}
this.onBeforeToggle(show).then(function (status) {
var _a;
if (!status) {
return;
}
_this.setData({
transition: !options.immediate,
showPopup: show,
});
if (show) {
(_a = _this.parent) === null || _a === void 0 ? void 0 : _a.getChildWrapperStyle().then(function (wrapperStyle) {
_this.setData({ wrapperStyle: wrapperStyle, showWrapper: true });
_this.rerender();
});
}
else {
_this.rerender();
}
});
},
onBeforeToggle: function (status) {
var _this = this;
var useBeforeToggle = this.data.useBeforeToggle;
if (!useBeforeToggle) {
return Promise.resolve(true);
}
return new Promise(function (resolve) {
_this.$emit('before-toggle', {
status: status,
callback: function (value) { return resolve(value); },
});
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/index.json
================================================
{
"component": true,
"usingComponents": {
"van-popup": "../popup/index",
"van-cell": "../cell/index",
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/index.wxml
================================================
{{ item.text }}
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/index.wxss
================================================
@import '../common/index.wxss';.van-dropdown-item{left:0;overflow:hidden;position:fixed;right:0}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active .van-dropdown-item__icon,.van-dropdown-item__option--active .van-dropdown-item__title{color:var(--dropdown-menu-option-active-color,#ee0a24)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__icon{display:block;line-height:inherit}
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/shared.d.ts
================================================
export interface Option {
text: string;
value: string | number;
icon: string;
}
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-item/shared.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-menu/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-menu/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
var utils_1 = require("../common/utils");
var ARRAY = [];
(0, component_1.VantComponent)({
field: true,
classes: ['title-class'],
relation: (0, relation_1.useChildren)('dropdown-item', function () {
this.updateItemListData();
}),
props: {
activeColor: {
type: String,
observer: 'updateChildrenData',
},
overlay: {
type: Boolean,
value: true,
observer: 'updateChildrenData',
},
zIndex: {
type: Number,
value: 10,
},
duration: {
type: Number,
value: 200,
observer: 'updateChildrenData',
},
direction: {
type: String,
value: 'down',
observer: 'updateChildrenData',
},
safeAreaTabBar: {
type: Boolean,
value: false,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
observer: 'updateChildrenData',
},
closeOnClickOutside: {
type: Boolean,
value: true,
},
},
data: {
itemListData: [],
},
beforeCreate: function () {
var windowHeight = (0, utils_1.getSystemInfoSync)().windowHeight;
this.windowHeight = windowHeight;
ARRAY.push(this);
},
destroyed: function () {
var _this = this;
ARRAY = ARRAY.filter(function (item) { return item !== _this; });
},
methods: {
updateItemListData: function () {
this.setData({
itemListData: this.children.map(function (child) { return child.data; }),
});
},
updateChildrenData: function () {
this.children.forEach(function (child) {
child.updateDataFromParent();
});
},
toggleItem: function (active) {
this.children.forEach(function (item, index) {
var showPopup = item.data.showPopup;
if (index === active) {
item.toggle();
}
else if (showPopup) {
item.toggle(false, { immediate: true });
}
});
},
close: function () {
this.children.forEach(function (child) {
child.toggle(false, { immediate: true });
});
},
getChildWrapperStyle: function () {
var _this = this;
var _a = this.data, zIndex = _a.zIndex, direction = _a.direction;
return (0, utils_1.getRect)(this, '.van-dropdown-menu').then(function (rect) {
var _a = rect.top, top = _a === void 0 ? 0 : _a, _b = rect.bottom, bottom = _b === void 0 ? 0 : _b;
var offset = direction === 'down' ? bottom : _this.windowHeight - top;
var wrapperStyle = "z-index: ".concat(zIndex, ";");
if (direction === 'down') {
wrapperStyle += "top: ".concat((0, utils_1.addUnit)(offset), ";");
}
else {
wrapperStyle += "bottom: ".concat((0, utils_1.addUnit)(offset), ";");
}
return wrapperStyle;
});
},
onTitleTap: function (event) {
var _this = this;
var index = event.currentTarget.dataset.index;
var child = this.children[index];
if (!child.data.disabled) {
ARRAY.forEach(function (menuItem) {
if (menuItem &&
menuItem.data.closeOnClickOutside &&
menuItem !== _this) {
menuItem.close();
}
});
this.toggleItem(index);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-menu/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs
================================================
/* eslint-disable */
function displayTitle(item) {
if (item.title) {
return item.title;
}
var match = item.options.filter(function(option) {
return option.value === item.value;
});
var displayTitle = match.length ? match[0].text : '';
return displayTitle;
}
module.exports = {
displayTitle: displayTitle
};
================================================
FILE: miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss
================================================
@import '../common/index.wxss';.van-dropdown-menu{background-color:var(--dropdown-menu-background-color,#fff);box-shadow:var(--dropdown-menu-box-shadow,0 2px 12px hsla(210,1%,40%,.12));display:flex;height:var(--dropdown-menu-height,50px);-webkit-user-select:none;user-select:none}.van-dropdown-menu__item{align-items:center;display:flex;flex:1;justify-content:center;min-width:0}.van-dropdown-menu__item:active{opacity:.7}.van-dropdown-menu__item--disabled:active{opacity:1}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:var(--dropdown-menu-title-disabled-text-color,#969799)}.van-dropdown-menu__title{box-sizing:border-box;color:var(--dropdown-menu-title-text-color,#323233);font-size:var(--dropdown-menu-title-font-size,15px);line-height:var(--dropdown-menu-title-line-height,18px);max-width:100%;padding:var(--dropdown-menu-title-padding,0 24px 0 8px);position:relative}.van-dropdown-menu__title:after{border-color:transparent transparent currentcolor currentcolor;border-style:solid;border-width:3px;content:"";margin-top:-5px;opacity:.8;position:absolute;right:11px;top:50%;transform:rotate(-45deg)}.van-dropdown-menu__title--active{color:var(--dropdown-menu-title-active-text-color,#ee0a24)}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)}
================================================
FILE: miniprogram_npm/@vant/weapp/empty/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/empty/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
description: String,
image: {
type: String,
value: 'default',
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/empty/index.json
================================================
{
"component": true,
"usingComponents": {}
}
================================================
FILE: miniprogram_npm/@vant/weapp/empty/index.wxml
================================================
{{ description }}
================================================
FILE: miniprogram_npm/@vant/weapp/empty/index.wxs
================================================
/* eslint-disable */
var PRESETS = ['error', 'search', 'default', 'network'];
function imageUrl(image) {
if (PRESETS.indexOf(image) !== -1) {
return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png';
}
return image;
}
module.exports = {
imageUrl: imageUrl,
};
================================================
FILE: miniprogram_npm/@vant/weapp/empty/index.wxss
================================================
@import '../common/index.wxss';.van-empty{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding:32px 0}.van-empty__image{height:160px;width:160px}.van-empty__image:empty{display:none}.van-empty__image__img{height:100%;width:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{color:#969799;font-size:14px;line-height:20px;margin-top:16px;padding:0 60px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px}
================================================
FILE: miniprogram_npm/@vant/weapp/field/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/field/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../common/utils");
var component_1 = require("../common/component");
var props_1 = require("./props");
(0, component_1.VantComponent)({
field: true,
classes: ['input-class', 'right-icon-class', 'label-class'],
props: __assign(__assign(__assign(__assign({}, props_1.commonProps), props_1.inputProps), props_1.textareaProps), { size: String, icon: String, label: String, error: Boolean, center: Boolean, isLink: Boolean, leftIcon: String, rightIcon: String, autosize: null, required: Boolean, iconClass: String, clickable: Boolean, inputAlign: String, customStyle: String, errorMessage: String, arrowDirection: String, showWordLimit: Boolean, errorMessageAlign: String, readonly: {
type: Boolean,
observer: 'setShowClear',
}, clearable: {
type: Boolean,
observer: 'setShowClear',
}, clearTrigger: {
type: String,
value: 'focus',
}, border: {
type: Boolean,
value: true,
}, titleWidth: {
type: String,
value: '6.2em',
}, clearIcon: {
type: String,
value: 'clear',
}, extraEventParams: {
type: Boolean,
value: false,
} }),
data: {
focused: false,
innerValue: '',
showClear: false,
},
watch: {
value: function (value) {
if (value !== this.value) {
this.setData({ innerValue: value });
this.value = value;
this.setShowClear();
}
},
clearTrigger: function () {
this.setShowClear();
},
},
created: function () {
this.value = this.data.value;
this.setData({ innerValue: this.value });
},
methods: {
formatValue: function (value) {
var maxlength = this.data.maxlength;
if (maxlength !== -1 && value.length > maxlength) {
return value.slice(0, maxlength);
}
return value;
},
onInput: function (event) {
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
var formatValue = this.formatValue(value);
this.value = formatValue;
this.setShowClear();
return this.emitChange(__assign(__assign({}, event.detail), { value: formatValue }));
},
onFocus: function (event) {
this.focused = true;
this.setShowClear();
this.$emit('focus', event.detail);
},
onBlur: function (event) {
this.focused = false;
this.setShowClear();
this.$emit('blur', event.detail);
},
onClickIcon: function () {
this.$emit('click-icon');
},
onClickInput: function (event) {
this.$emit('click-input', event.detail);
},
onClear: function () {
var _this = this;
this.setData({ innerValue: '' });
this.value = '';
this.setShowClear();
(0, utils_1.nextTick)(function () {
_this.emitChange({ value: '' });
_this.$emit('clear', '');
});
},
onConfirm: function (event) {
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
this.value = value;
this.setShowClear();
this.$emit('confirm', value);
},
setValue: function (value) {
this.value = value;
this.setShowClear();
if (value === '') {
this.setData({ innerValue: '' });
}
this.emitChange({ value: value });
},
onLineChange: function (event) {
this.$emit('linechange', event.detail);
},
onKeyboardHeightChange: function (event) {
this.$emit('keyboardheightchange', event.detail);
},
onBindNicknameReview: function (event) {
this.$emit('nicknamereview', event.detail);
},
emitChange: function (detail) {
var extraEventParams = this.data.extraEventParams;
this.setData({ value: detail.value });
var result;
var data = extraEventParams
? __assign(__assign({}, detail), { callback: function (data) {
result = data;
} }) : detail.value;
this.$emit('input', data);
this.$emit('change', data);
return result;
},
setShowClear: function () {
var _a = this.data, clearable = _a.clearable, readonly = _a.readonly, clearTrigger = _a.clearTrigger;
var _b = this, focused = _b.focused, value = _b.value;
var showClear = false;
if (clearable && !readonly) {
var hasValue = !!value;
var trigger = clearTrigger === 'always' || (clearTrigger === 'focus' && focused);
showClear = hasValue && trigger;
}
this.setView({ showClear: showClear });
},
noop: function () { },
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/field/index.json
================================================
{
"component": true,
"usingComponents": {
"van-cell": "../cell/index",
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/field/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/field/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function inputStyle(autosize) {
if (autosize && autosize.constructor === 'Object') {
return style({
'min-height': addUnit(autosize.minHeight),
'max-height': addUnit(autosize.maxHeight),
});
}
return '';
}
module.exports = {
inputStyle: inputStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/field/index.wxss
================================================
@import '../common/index.wxss';.van-field{--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:var(--field-label-color,#646566)}.van-field__label--disabled{color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{align-items:center;display:flex}.van-field__body--textarea{box-sizing:border-box;line-height:1.2em;min-height:var(--cell-line-height,24px);padding:3.6px 0}.van-field__control:empty+.van-field__control{display:block}.van-field__control{background-color:initial;border:0;box-sizing:border-box;color:var(--field-input-text-color,#323233);display:none;height:var(--cell-line-height,24px);line-height:inherit;margin:0;min-height:var(--cell-line-height,24px);padding:0;position:relative;resize:none;text-align:left;width:100%}.van-field__control:empty{display:none}.van-field__control--textarea{height:var(--field-text-area-min-height,18px);min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;color:var(--field-input-disabled-text-color,#c8c9cc);opacity:1}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__placeholder{color:var(--field-placeholder-text-color,#c8c9cc);left:0;pointer-events:none;position:absolute;right:0;top:0}.van-field__placeholder--error{color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{align-items:center;display:flex;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;margin-right:calc(var(--padding-xs, 8px)*-1);padding:0 var(--padding-xs,8px);vertical-align:middle}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{color:var(--field-clear-icon-color,#c8c9cc);font-size:var(--field-clear-icon-size,16px)}.van-field__icon-container{color:var(--field-icon-container-color,#969799);font-size:var(--field-icon-size,16px)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{color:var(--field-error-message-color,#ee0a24);display:block;font-size:var(--field-error-message-text-font-size,12px);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{color:var(--field-word-limit-color,#646566);font-size:var(--field-word-limit-font-size,12px);line-height:var(--field-word-limit-line-height,16px);margin-top:var(--padding-base,4px);text-align:right}.van-field__word-num{display:inline}.van-field__word-num--full{color:var(--field-word-num-full-color,#ee0a24)}
================================================
FILE: miniprogram_npm/@vant/weapp/field/input.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/field/props.d.ts
================================================
///
export declare const commonProps: WechatMiniprogram.Component.PropertyOption;
export declare const inputProps: WechatMiniprogram.Component.PropertyOption;
export declare const textareaProps: WechatMiniprogram.Component.PropertyOption;
================================================
FILE: miniprogram_npm/@vant/weapp/field/props.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.textareaProps = exports.inputProps = exports.commonProps = void 0;
exports.commonProps = {
value: String,
placeholder: String,
placeholderStyle: String,
placeholderClass: String,
disabled: Boolean,
maxlength: {
type: Number,
value: -1,
},
cursorSpacing: {
type: Number,
value: 50,
},
autoFocus: Boolean,
focus: Boolean,
cursor: {
type: Number,
value: -1,
},
selectionStart: {
type: Number,
value: -1,
},
selectionEnd: {
type: Number,
value: -1,
},
adjustPosition: {
type: Boolean,
value: true,
},
holdKeyboard: Boolean,
};
exports.inputProps = {
type: {
type: String,
value: 'text',
},
password: Boolean,
confirmType: String,
confirmHold: Boolean,
alwaysEmbed: Boolean,
};
exports.textareaProps = {
autoHeight: Boolean,
fixed: Boolean,
showConfirmBar: {
type: Boolean,
value: true,
},
disableDefaultPadding: {
type: Boolean,
value: true,
},
};
================================================
FILE: miniprogram_npm/@vant/weapp/field/textarea.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/field/types.d.ts
================================================
export interface InputDetails {
/** 输入框内容 */
value: string;
/** 光标位置 */
cursor?: number;
/** keyCode 为键值 (目前工具还不支持返回keyCode参数) `2.1.0` 起支持 */
keyCode?: number;
}
================================================
FILE: miniprogram_npm/@vant/weapp/field/types.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('goods-action-button', function () {
this.children.forEach(function (item) {
item.updateStyle();
});
}),
props: {
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action/index.wxss
================================================
@import '../common/index.wxss';.van-goods-action{align-items:center;background-color:var(--goods-action-background-color,#fff);bottom:0;box-sizing:initial;display:flex;height:var(--goods-action-height,50px);left:0;position:fixed;right:0}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-button/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-button/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
var button_1 = require("../mixins/button");
var link_1 = require("../mixins/link");
(0, component_1.VantComponent)({
mixins: [link_1.link, button_1.button],
relation: (0, relation_1.useParent)('goods-action'),
props: {
text: String,
color: String,
size: {
type: String,
value: 'normal',
},
loading: Boolean,
disabled: Boolean,
plain: Boolean,
type: {
type: String,
value: 'danger',
},
customStyle: {
type: String,
value: '',
},
},
methods: {
onClick: function (event) {
this.$emit('click', event.detail);
this.jumpLink();
},
updateStyle: function () {
if (this.parent == null) {
return;
}
var index = this.index;
var _a = this.parent.children, children = _a === void 0 ? [] : _a;
this.setData({
isFirst: index === 0,
isLast: index === children.length - 1,
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-button/index.json
================================================
{
"component": true,
"usingComponents": {
"van-button": "../button/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-button/index.wxml
================================================
{{ text }}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-button/index.wxss
================================================
@import '../common/index.wxss';:host{flex:1}.van-goods-action-button{--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(to right,#ffd01e,#ff8917));--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(to right,#ff6034,#ee0a24));--button-default-height:var(--goods-action-button-height,40px);--button-line-height:var(--goods-action-button-line-height,20px);--button-plain-background-color:var(--goods-action-button-plain-color,#fff);--button-border-width:0;display:block}.van-goods-action-button--first{--button-border-radius:999px 0 0 var(--goods-action-button-border-radius,999px);margin-left:5px}.van-goods-action-button--last{--button-border-radius:0 999px var(--goods-action-button-border-radius,999px) 0;margin-right:5px}.van-goods-action-button--first.van-goods-action-button--last{--button-border-radius:var(--goods-action-button-border-radius,999px)}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{font-weight:var(--font-weight-bold,500)!important;width:100%}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-icon/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-icon/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var button_1 = require("../mixins/button");
var link_1 = require("../mixins/link");
(0, component_1.VantComponent)({
classes: ['icon-class', 'text-class', 'info-class'],
mixins: [link_1.link, button_1.button],
props: {
text: String,
dot: Boolean,
info: String,
icon: String,
size: String,
color: String,
classPrefix: {
type: String,
value: 'van-icon',
},
disabled: Boolean,
loading: Boolean,
},
methods: {
onClick: function (event) {
this.$emit('click', event.detail);
this.jumpLink();
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-icon/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-button": "../button/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-icon/index.wxml
================================================
{{ text }}
================================================
FILE: miniprogram_npm/@vant/weapp/goods-action-icon/index.wxss
================================================
@import '../common/index.wxss';.van-goods-action-icon{border:none!important;color:var(--goods-action-icon-text-color,#646566)!important;display:flex!important;flex-direction:column;font-size:var(--goods-action-icon-font-size,10px)!important;height:var(--goods-action-icon-height,50px)!important;justify-content:center!important;line-height:1!important;min-width:var(--goods-action-icon-width,48px)}.van-goods-action-icon__icon{color:var(--goods-action-icon-color,#323233);display:flex;font-size:var(--goods-action-icon-size,18px);margin:0 auto 5px}
================================================
FILE: miniprogram_npm/@vant/weapp/grid/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/grid/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('grid-item'),
props: {
square: {
type: Boolean,
observer: 'updateChildren',
},
gutter: {
type: null,
value: 0,
observer: 'updateChildren',
},
clickable: {
type: Boolean,
observer: 'updateChildren',
},
columnNum: {
type: Number,
value: 4,
observer: 'updateChildren',
},
center: {
type: Boolean,
value: true,
observer: 'updateChildren',
},
border: {
type: Boolean,
value: true,
observer: 'updateChildren',
},
direction: {
type: String,
observer: 'updateChildren',
},
iconSize: {
type: String,
observer: 'updateChildren',
},
reverse: {
type: Boolean,
value: false,
observer: 'updateChildren',
},
},
methods: {
updateChildren: function () {
this.children.forEach(function (child) {
child.updateStyle();
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/grid/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/grid/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/grid/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
return style({
'padding-left': addUnit(data.gutter),
});
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/grid/index.wxss
================================================
@import '../common/index.wxss';.van-grid{box-sizing:border-box;overflow:hidden;position:relative}
================================================
FILE: miniprogram_npm/@vant/weapp/grid-item/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/grid-item/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
var link_1 = require("../mixins/link");
(0, component_1.VantComponent)({
relation: (0, relation_1.useParent)('grid'),
classes: ['content-class', 'icon-class', 'text-class'],
mixins: [link_1.link],
props: {
icon: String,
iconColor: String,
iconPrefix: {
type: String,
value: 'van-icon',
},
dot: Boolean,
info: null,
badge: null,
text: String,
useSlot: Boolean,
},
data: {
viewStyle: '',
},
mounted: function () {
this.updateStyle();
},
methods: {
updateStyle: function () {
if (!this.parent) {
return;
}
var _a = this.parent, data = _a.data, children = _a.children;
var columnNum = data.columnNum, border = data.border, square = data.square, gutter = data.gutter, clickable = data.clickable, center = data.center, direction = data.direction, reverse = data.reverse, iconSize = data.iconSize;
this.setData({
center: center,
border: border,
square: square,
gutter: gutter,
clickable: clickable,
direction: direction,
reverse: reverse,
iconSize: iconSize,
index: children.indexOf(this),
columnNum: columnNum,
});
},
onClick: function () {
this.$emit('click');
this.jumpLink();
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/grid-item/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/grid-item/index.wxml
================================================
{{ text }}
================================================
FILE: miniprogram_npm/@vant/weapp/grid-item/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function wrapperStyle(data) {
var width = 100 / data.columnNum + '%';
return style({
width: width,
'padding-top': data.square ? width : null,
'padding-right': addUnit(data.gutter),
'margin-top':
data.index >= data.columnNum && !data.square
? addUnit(data.gutter)
: null,
});
}
function contentStyle(data) {
return data.square
? style({
right: addUnit(data.gutter),
bottom: addUnit(data.gutter),
height: 'auto',
})
: '';
}
module.exports = {
wrapperStyle: wrapperStyle,
contentStyle: contentStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/grid-item/index.wxss
================================================
@import '../common/index.wxss';.van-grid-item{box-sizing:border-box;float:left;position:relative}.van-grid-item--square{height:0}.van-grid-item__content{background-color:var(--grid-item-content-background-color,#fff);box-sizing:border-box;display:flex;flex-direction:column;height:100%;padding:var(--grid-item-content-padding,16px 8px)}.van-grid-item__content:after{border-width:0 1px 1px 0;z-index:1}.van-grid-item__content--surround:after{border-width:1px}.van-grid-item__content--center{align-items:center;justify-content:center}.van-grid-item__content--square{left:0;position:absolute;right:0;top:0}.van-grid-item__content--horizontal{flex-direction:row}.van-grid-item__content--horizontal .van-grid-item__text{margin:0 0 0 8px}.van-grid-item__content--reverse{flex-direction:column-reverse}.van-grid-item__content--reverse .van-grid-item__text{margin:0 0 8px}.van-grid-item__content--horizontal.van-grid-item__content--reverse{flex-direction:row-reverse}.van-grid-item__content--horizontal.van-grid-item__content--reverse .van-grid-item__text{margin:0 8px 0 0}.van-grid-item__content--clickable:active{background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{align-items:center;display:flex;font-size:var(--grid-item-icon-size,26px);height:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:var(--grid-item-text-color,#646566);font-size:var(--grid-item-text-font-size,12px)}.van-grid-item__icon+.van-grid-item__text{margin-top:8px}
================================================
FILE: miniprogram_npm/@vant/weapp/icon/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/icon/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: ['info-class'],
props: {
dot: Boolean,
info: null,
size: null,
color: String,
customStyle: String,
classPrefix: {
type: String,
value: 'van-icon',
},
name: String,
},
methods: {
onClick: function () {
this.$emit('click');
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/icon/index.json
================================================
{
"component": true,
"usingComponents": {
"van-info": "../info/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/icon/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/icon/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function isImage(name) {
return name.indexOf('/') !== -1;
}
function rootClass(data) {
var classes = ['custom-class'];
if (data.classPrefix !== 'van-icon') {
classes.push('van-icon--custom')
}
if (data.classPrefix != null) {
classes.push(data.classPrefix);
}
if (isImage(data.name)) {
classes.push('van-icon--image');
} else if (data.classPrefix != null) {
classes.push(data.classPrefix + '-' + data.name);
}
return classes.join(' ');
}
function rootStyle(data) {
return style([
{
color: data.color,
'font-size': addUnit(data.size),
},
data.customStyle,
]);
}
module.exports = {
isImage: isImage,
rootClass: rootClass,
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/icon/index.wxss
================================================
@import '../common/index.wxss';.van-icon{text-rendering:auto;-webkit-font-smoothing:antialiased;font:normal normal normal 14px/1 vant-icon;font:normal normal normal 14px/1 var(--van-icon-font-family,"vant-icon");font-size:inherit;position:relative}.van-icon,.van-icon:before{display:inline-block}.van-icon-contact:before{content:"\e753"}.van-icon-notes:before{content:"\e63c"}.van-icon-records:before{content:"\e63d"}.van-icon-cash-back-record:before{content:"\e63e"}.van-icon-newspaper:before{content:"\e63f"}.van-icon-discount:before{content:"\e640"}.van-icon-completed:before{content:"\e641"}.van-icon-user:before{content:"\e642"}.van-icon-description:before{content:"\e643"}.van-icon-list-switch:before{content:"\e6ad"}.van-icon-list-switching:before{content:"\e65a"}.van-icon-link-o:before{content:"\e751"}.van-icon-miniprogram-o:before{content:"\e752"}.van-icon-qq:before{content:"\e74e"}.van-icon-wechat-moments:before{content:"\e74f"}.van-icon-weibo:before{content:"\e750"}.van-icon-cash-o:before{content:"\e74d"}.van-icon-guide-o:before{content:"\e74c"}.van-icon-invitation:before{content:"\e6d6"}.van-icon-shield-o:before{content:"\e74b"}.van-icon-exchange:before{content:"\e6af"}.van-icon-eye:before{content:"\e6b0"}.van-icon-enlarge:before{content:"\e6b1"}.van-icon-expand-o:before{content:"\e6b2"}.van-icon-eye-o:before{content:"\e6b3"}.van-icon-expand:before{content:"\e6b4"}.van-icon-filter-o:before{content:"\e6b5"}.van-icon-fire:before{content:"\e6b6"}.van-icon-fail:before{content:"\e6b7"}.van-icon-failure:before{content:"\e6b8"}.van-icon-fire-o:before{content:"\e6b9"}.van-icon-flag-o:before{content:"\e6ba"}.van-icon-font:before{content:"\e6bb"}.van-icon-font-o:before{content:"\e6bc"}.van-icon-gem-o:before{content:"\e6bd"}.van-icon-flower-o:before{content:"\e6be"}.van-icon-gem:before{content:"\e6bf"}.van-icon-gift-card:before{content:"\e6c0"}.van-icon-friends:before{content:"\e6c1"}.van-icon-friends-o:before{content:"\e6c2"}.van-icon-gold-coin:before{content:"\e6c3"}.van-icon-gold-coin-o:before{content:"\e6c4"}.van-icon-good-job-o:before{content:"\e6c5"}.van-icon-gift:before{content:"\e6c6"}.van-icon-gift-o:before{content:"\e6c7"}.van-icon-gift-card-o:before{content:"\e6c8"}.van-icon-good-job:before{content:"\e6c9"}.van-icon-home-o:before{content:"\e6ca"}.van-icon-goods-collect:before{content:"\e6cb"}.van-icon-graphic:before{content:"\e6cc"}.van-icon-goods-collect-o:before{content:"\e6cd"}.van-icon-hot-o:before{content:"\e6ce"}.van-icon-info:before{content:"\e6cf"}.van-icon-hotel-o:before{content:"\e6d0"}.van-icon-info-o:before{content:"\e6d1"}.van-icon-hot-sale-o:before{content:"\e6d2"}.van-icon-hot:before{content:"\e6d3"}.van-icon-like:before{content:"\e6d4"}.van-icon-idcard:before{content:"\e6d5"}.van-icon-like-o:before{content:"\e6d7"}.van-icon-hot-sale:before{content:"\e6d8"}.van-icon-location-o:before{content:"\e6d9"}.van-icon-location:before{content:"\e6da"}.van-icon-label:before{content:"\e6db"}.van-icon-lock:before{content:"\e6dc"}.van-icon-label-o:before{content:"\e6dd"}.van-icon-map-marked:before{content:"\e6de"}.van-icon-logistics:before{content:"\e6df"}.van-icon-manager:before{content:"\e6e0"}.van-icon-more:before{content:"\e6e1"}.van-icon-live:before{content:"\e6e2"}.van-icon-manager-o:before{content:"\e6e3"}.van-icon-medal:before{content:"\e6e4"}.van-icon-more-o:before{content:"\e6e5"}.van-icon-music-o:before{content:"\e6e6"}.van-icon-music:before{content:"\e6e7"}.van-icon-new-arrival-o:before{content:"\e6e8"}.van-icon-medal-o:before{content:"\e6e9"}.van-icon-new-o:before{content:"\e6ea"}.van-icon-free-postage:before{content:"\e6eb"}.van-icon-newspaper-o:before{content:"\e6ec"}.van-icon-new-arrival:before{content:"\e6ed"}.van-icon-minus:before{content:"\e6ee"}.van-icon-orders-o:before{content:"\e6ef"}.van-icon-new:before{content:"\e6f0"}.van-icon-paid:before{content:"\e6f1"}.van-icon-notes-o:before{content:"\e6f2"}.van-icon-other-pay:before{content:"\e6f3"}.van-icon-pause-circle:before{content:"\e6f4"}.van-icon-pause:before{content:"\e6f5"}.van-icon-pause-circle-o:before{content:"\e6f6"}.van-icon-peer-pay:before{content:"\e6f7"}.van-icon-pending-payment:before{content:"\e6f8"}.van-icon-passed:before{content:"\e6f9"}.van-icon-plus:before{content:"\e6fa"}.van-icon-phone-circle-o:before{content:"\e6fb"}.van-icon-phone-o:before{content:"\e6fc"}.van-icon-printer:before{content:"\e6fd"}.van-icon-photo-fail:before{content:"\e6fe"}.van-icon-phone:before{content:"\e6ff"}.van-icon-photo-o:before{content:"\e700"}.van-icon-play-circle:before{content:"\e701"}.van-icon-play:before{content:"\e702"}.van-icon-phone-circle:before{content:"\e703"}.van-icon-point-gift-o:before{content:"\e704"}.van-icon-point-gift:before{content:"\e705"}.van-icon-play-circle-o:before{content:"\e706"}.van-icon-shrink:before{content:"\e707"}.van-icon-photo:before{content:"\e708"}.van-icon-qr:before{content:"\e709"}.van-icon-qr-invalid:before{content:"\e70a"}.van-icon-question-o:before{content:"\e70b"}.van-icon-revoke:before{content:"\e70c"}.van-icon-replay:before{content:"\e70d"}.van-icon-service:before{content:"\e70e"}.van-icon-question:before{content:"\e70f"}.van-icon-search:before{content:"\e710"}.van-icon-refund-o:before{content:"\e711"}.van-icon-service-o:before{content:"\e712"}.van-icon-scan:before{content:"\e713"}.van-icon-share:before{content:"\e714"}.van-icon-send-gift-o:before{content:"\e715"}.van-icon-share-o:before{content:"\e716"}.van-icon-setting:before{content:"\e717"}.van-icon-points:before{content:"\e718"}.van-icon-photograph:before{content:"\e719"}.van-icon-shop:before{content:"\e71a"}.van-icon-shop-o:before{content:"\e71b"}.van-icon-shop-collect-o:before{content:"\e71c"}.van-icon-shop-collect:before{content:"\e71d"}.van-icon-smile:before{content:"\e71e"}.van-icon-shopping-cart-o:before{content:"\e71f"}.van-icon-sign:before{content:"\e720"}.van-icon-sort:before{content:"\e721"}.van-icon-star-o:before{content:"\e722"}.van-icon-smile-comment-o:before{content:"\e723"}.van-icon-stop:before{content:"\e724"}.van-icon-stop-circle-o:before{content:"\e725"}.van-icon-smile-o:before{content:"\e726"}.van-icon-star:before{content:"\e727"}.van-icon-success:before{content:"\e728"}.van-icon-stop-circle:before{content:"\e729"}.van-icon-records-o:before{content:"\e72a"}.van-icon-shopping-cart:before{content:"\e72b"}.van-icon-tosend:before{content:"\e72c"}.van-icon-todo-list:before{content:"\e72d"}.van-icon-thumb-circle-o:before{content:"\e72e"}.van-icon-thumb-circle:before{content:"\e72f"}.van-icon-umbrella-circle:before{content:"\e730"}.van-icon-underway:before{content:"\e731"}.van-icon-upgrade:before{content:"\e732"}.van-icon-todo-list-o:before{content:"\e733"}.van-icon-tv-o:before{content:"\e734"}.van-icon-underway-o:before{content:"\e735"}.van-icon-user-o:before{content:"\e736"}.van-icon-vip-card-o:before{content:"\e737"}.van-icon-vip-card:before{content:"\e738"}.van-icon-send-gift:before{content:"\e739"}.van-icon-wap-home:before{content:"\e73a"}.van-icon-wap-nav:before{content:"\e73b"}.van-icon-volume-o:before{content:"\e73c"}.van-icon-video:before{content:"\e73d"}.van-icon-wap-home-o:before{content:"\e73e"}.van-icon-volume:before{content:"\e73f"}.van-icon-warning:before{content:"\e740"}.van-icon-weapp-nav:before{content:"\e741"}.van-icon-wechat-pay:before{content:"\e742"}.van-icon-warning-o:before{content:"\e743"}.van-icon-wechat:before{content:"\e744"}.van-icon-setting-o:before{content:"\e745"}.van-icon-youzan-shield:before{content:"\e746"}.van-icon-warn-o:before{content:"\e747"}.van-icon-smile-comment:before{content:"\e748"}.van-icon-user-circle-o:before{content:"\e749"}.van-icon-video-o:before{content:"\e74a"}.van-icon-add-square:before{content:"\e65c"}.van-icon-add:before{content:"\e65d"}.van-icon-arrow-down:before{content:"\e65e"}.van-icon-arrow-up:before{content:"\e65f"}.van-icon-arrow:before{content:"\e660"}.van-icon-after-sale:before{content:"\e661"}.van-icon-add-o:before{content:"\e662"}.van-icon-alipay:before{content:"\e663"}.van-icon-ascending:before{content:"\e664"}.van-icon-apps-o:before{content:"\e665"}.van-icon-aim:before{content:"\e666"}.van-icon-award:before{content:"\e667"}.van-icon-arrow-left:before{content:"\e668"}.van-icon-award-o:before{content:"\e669"}.van-icon-audio:before{content:"\e66a"}.van-icon-bag-o:before{content:"\e66b"}.van-icon-balance-list:before{content:"\e66c"}.van-icon-back-top:before{content:"\e66d"}.van-icon-bag:before{content:"\e66e"}.van-icon-balance-pay:before{content:"\e66f"}.van-icon-balance-o:before{content:"\e670"}.van-icon-bar-chart-o:before{content:"\e671"}.van-icon-bars:before{content:"\e672"}.van-icon-balance-list-o:before{content:"\e673"}.van-icon-birthday-cake-o:before{content:"\e674"}.van-icon-bookmark:before{content:"\e675"}.van-icon-bill:before{content:"\e676"}.van-icon-bell:before{content:"\e677"}.van-icon-browsing-history-o:before{content:"\e678"}.van-icon-browsing-history:before{content:"\e679"}.van-icon-bookmark-o:before{content:"\e67a"}.van-icon-bulb-o:before{content:"\e67b"}.van-icon-bullhorn-o:before{content:"\e67c"}.van-icon-bill-o:before{content:"\e67d"}.van-icon-calendar-o:before{content:"\e67e"}.van-icon-brush-o:before{content:"\e67f"}.van-icon-card:before{content:"\e680"}.van-icon-cart-o:before{content:"\e681"}.van-icon-cart-circle:before{content:"\e682"}.van-icon-cart-circle-o:before{content:"\e683"}.van-icon-cart:before{content:"\e684"}.van-icon-cash-on-deliver:before{content:"\e685"}.van-icon-cash-back-record-o:before{content:"\e686"}.van-icon-cashier-o:before{content:"\e687"}.van-icon-chart-trending-o:before{content:"\e688"}.van-icon-certificate:before{content:"\e689"}.van-icon-chat:before{content:"\e68a"}.van-icon-clear:before{content:"\e68b"}.van-icon-chat-o:before{content:"\e68c"}.van-icon-checked:before{content:"\e68d"}.van-icon-clock:before{content:"\e68e"}.van-icon-clock-o:before{content:"\e68f"}.van-icon-close:before{content:"\e690"}.van-icon-closed-eye:before{content:"\e691"}.van-icon-circle:before{content:"\e692"}.van-icon-cluster-o:before{content:"\e693"}.van-icon-column:before{content:"\e694"}.van-icon-comment-circle-o:before{content:"\e695"}.van-icon-cluster:before{content:"\e696"}.van-icon-comment:before{content:"\e697"}.van-icon-comment-o:before{content:"\e698"}.van-icon-comment-circle:before{content:"\e699"}.van-icon-completed-o:before{content:"\e69a"}.van-icon-credit-pay:before{content:"\e69b"}.van-icon-coupon:before{content:"\e69c"}.van-icon-debit-pay:before{content:"\e69d"}.van-icon-coupon-o:before{content:"\e69e"}.van-icon-contact-o:before{content:"\e69f"}.van-icon-descending:before{content:"\e6a0"}.van-icon-desktop-o:before{content:"\e6a1"}.van-icon-diamond-o:before{content:"\e6a2"}.van-icon-description-o:before{content:"\e6a3"}.van-icon-delete:before{content:"\e6a4"}.van-icon-diamond:before{content:"\e6a5"}.van-icon-delete-o:before{content:"\e6a6"}.van-icon-cross:before{content:"\e6a7"}.van-icon-edit:before{content:"\e6a8"}.van-icon-ellipsis:before{content:"\e6a9"}.van-icon-down:before{content:"\e6aa"}.van-icon-discount-o:before{content:"\e6ab"}.van-icon-ecard-pay:before{content:"\e6ac"}.van-icon-envelop-o:before{content:"\e6ae"}@font-face{font-display:auto;font-family:vant-icon;font-style:normal;font-weight:400;src:url(//at.alicdn.com/t/c/font_2553510_kfwma2yq1rs.woff2?t=1694918397022) format("woff2"),url(//at.alicdn.com/t/c/font_2553510_kfwma2yq1rs.woff?t=1694918397022) format("woff")}:host{align-items:center;display:inline-flex;justify-content:center}.van-icon--custom{position:relative}.van-icon--image{height:1em;width:1em}.van-icon__image{height:100%;width:100%}.van-icon__info{z-index:1}
================================================
FILE: miniprogram_npm/@vant/weapp/image/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/image/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var button_1 = require("../mixins/button");
(0, component_1.VantComponent)({
mixins: [button_1.button],
classes: ['custom-class', 'loading-class', 'error-class', 'image-class'],
props: {
src: {
type: String,
observer: function () {
this.setData({
error: false,
loading: true,
});
},
},
round: Boolean,
width: null,
height: null,
radius: null,
lazyLoad: Boolean,
useErrorSlot: Boolean,
useLoadingSlot: Boolean,
showMenuByLongpress: Boolean,
fit: {
type: String,
value: 'fill',
},
webp: {
type: Boolean,
value: false,
},
showError: {
type: Boolean,
value: true,
},
showLoading: {
type: Boolean,
value: true,
},
},
data: {
error: false,
loading: true,
viewStyle: '',
},
methods: {
onLoad: function (event) {
this.setData({
loading: false,
});
this.$emit('load', event.detail);
},
onError: function (event) {
this.setData({
loading: false,
error: true,
});
this.$emit('error', event.detail);
},
onClick: function (event) {
this.$emit('click', event.detail);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/image/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/image/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/image/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
return style([
{
width: addUnit(data.width),
height: addUnit(data.height),
'border-radius': addUnit(data.radius),
},
data.radius ? 'overflow: hidden' : null,
]);
}
var FIT_MODE_MAP = {
none: 'center',
fill: 'scaleToFill',
cover: 'aspectFill',
contain: 'aspectFit',
widthFix: 'widthFix',
heightFix: 'heightFix',
};
function mode(fit) {
return FIT_MODE_MAP[fit];
}
module.exports = {
rootStyle: rootStyle,
mode: mode,
};
================================================
FILE: miniprogram_npm/@vant/weapp/image/index.wxss
================================================
@import '../common/index.wxss';.van-image{display:inline-block;position:relative;vertical-align:top}.van-image--round{border-radius:50%;overflow:hidden}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;height:100%;width:100%}.van-image__error,.van-image__loading{align-items:center;background-color:var(--image-placeholder-background-color,#f7f8fa);color:var(--image-placeholder-text-color,#969799);display:flex;flex-direction:column;font-size:var(--image-placeholder-font-size,14px);justify-content:center;left:0;position:absolute;top:0}.van-image__loading-icon{color:var(--image-loading-icon-color,#dcdee0);font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:var(--image-error-icon-color,#dcdee0);font-size:var(--image-error-icon-size,32px)!important}
================================================
FILE: miniprogram_npm/@vant/weapp/index-anchor/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/index-anchor/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../common/utils");
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
relation: (0, relation_1.useParent)('index-bar'),
props: {
useSlot: Boolean,
index: null,
},
data: {
active: false,
wrapperStyle: '',
anchorStyle: '',
},
methods: {
scrollIntoView: function (scrollTop) {
var _this = this;
(0, utils_1.getRect)(this, '.van-index-anchor-wrapper').then(function (rect) {
wx.pageScrollTo({
duration: 0,
scrollTop: scrollTop + rect.top - _this.parent.data.stickyOffsetTop,
});
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/index-anchor/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/index-anchor/index.wxml
================================================
{{ index }}
================================================
FILE: miniprogram_npm/@vant/weapp/index-anchor/index.wxss
================================================
@import '../common/index.wxss';.van-index-anchor{background-color:var(--index-anchor-background-color,transparent);color:var(--index-anchor-text-color,#323233);font-size:var(--index-anchor-font-size,14px);font-weight:var(--index-anchor-font-weight,500);line-height:var(--index-anchor-line-height,32px);padding:var(--index-anchor-padding,0 16px)}.van-index-anchor--active{background-color:var(--index-anchor-active-background-color,#fff);color:var(--index-anchor-active-text-color,#07c160);left:0;right:0}
================================================
FILE: miniprogram_npm/@vant/weapp/index-bar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/index-bar/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var color_1 = require("../common/color");
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
var utils_1 = require("../common/utils");
var page_scroll_1 = require("../mixins/page-scroll");
var indexList = function () {
var indexList = [];
var charCodeOfA = 'A'.charCodeAt(0);
for (var i = 0; i < 26; i++) {
indexList.push(String.fromCharCode(charCodeOfA + i));
}
return indexList;
};
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('index-anchor', function () {
this.updateData();
}),
props: {
sticky: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 1,
},
highlightColor: {
type: String,
value: color_1.GREEN,
},
stickyOffsetTop: {
type: Number,
value: 0,
},
indexList: {
type: Array,
value: indexList(),
},
},
mixins: [
(0, page_scroll_1.pageScrollMixin)(function (event) {
this.scrollTop = (event === null || event === void 0 ? void 0 : event.scrollTop) || 0;
this.onScroll();
}),
],
data: {
activeAnchorIndex: null,
showSidebar: false,
},
created: function () {
this.scrollTop = 0;
},
methods: {
updateData: function () {
var _this = this;
wx.nextTick(function () {
if (_this.timer != null) {
clearTimeout(_this.timer);
}
_this.timer = setTimeout(function () {
_this.setData({
showSidebar: !!_this.children.length,
});
_this.setRect().then(function () {
_this.onScroll();
});
}, 0);
});
},
setRect: function () {
return Promise.all([
this.setAnchorsRect(),
this.setListRect(),
this.setSiderbarRect(),
]);
},
setAnchorsRect: function () {
var _this = this;
return Promise.all(this.children.map(function (anchor) {
return (0, utils_1.getRect)(anchor, '.van-index-anchor-wrapper').then(function (rect) {
Object.assign(anchor, {
height: rect.height,
top: rect.top + _this.scrollTop,
});
});
}));
},
setListRect: function () {
var _this = this;
return (0, utils_1.getRect)(this, '.van-index-bar').then(function (rect) {
if (!(0, utils_1.isDef)(rect)) {
return;
}
Object.assign(_this, {
height: rect.height,
top: rect.top + _this.scrollTop,
});
});
},
setSiderbarRect: function () {
var _this = this;
return (0, utils_1.getRect)(this, '.van-index-bar__sidebar').then(function (res) {
if (!(0, utils_1.isDef)(res)) {
return;
}
_this.sidebar = {
height: res.height,
top: res.top,
};
});
},
setDiffData: function (_a) {
var target = _a.target, data = _a.data;
var diffData = {};
Object.keys(data).forEach(function (key) {
if (target.data[key] !== data[key]) {
diffData[key] = data[key];
}
});
if (Object.keys(diffData).length) {
target.setData(diffData);
}
},
getAnchorRect: function (anchor) {
return (0, utils_1.getRect)(anchor, '.van-index-anchor-wrapper').then(function (rect) { return ({
height: rect.height,
top: rect.top,
}); });
},
getActiveAnchorIndex: function () {
var _a = this, children = _a.children, scrollTop = _a.scrollTop;
var _b = this.data, sticky = _b.sticky, stickyOffsetTop = _b.stickyOffsetTop;
for (var i = this.children.length - 1; i >= 0; i--) {
var preAnchorHeight = i > 0 ? children[i - 1].height : 0;
var reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0;
if (reachTop + scrollTop >= children[i].top) {
return i;
}
}
return -1;
},
onScroll: function () {
var _this = this;
var _a = this, _b = _a.children, children = _b === void 0 ? [] : _b, scrollTop = _a.scrollTop;
if (!children.length) {
return;
}
var _c = this.data, sticky = _c.sticky, stickyOffsetTop = _c.stickyOffsetTop, zIndex = _c.zIndex, highlightColor = _c.highlightColor;
var active = this.getActiveAnchorIndex();
this.setDiffData({
target: this,
data: {
activeAnchorIndex: active,
},
});
if (sticky) {
var isActiveAnchorSticky_1 = false;
if (active !== -1) {
isActiveAnchorSticky_1 =
children[active].top <= stickyOffsetTop + scrollTop;
}
children.forEach(function (item, index) {
if (index === active) {
var wrapperStyle = '';
var anchorStyle = "\n color: ".concat(highlightColor, ";\n ");
if (isActiveAnchorSticky_1) {
wrapperStyle = "\n height: ".concat(children[index].height, "px;\n ");
anchorStyle = "\n position: fixed;\n top: ".concat(stickyOffsetTop, "px;\n z-index: ").concat(zIndex, ";\n color: ").concat(highlightColor, ";\n ");
}
_this.setDiffData({
target: item,
data: {
active: true,
anchorStyle: anchorStyle,
wrapperStyle: wrapperStyle,
},
});
}
else if (index === active - 1) {
var currentAnchor = children[index];
var currentOffsetTop = currentAnchor.top;
var targetOffsetTop = index === children.length - 1
? _this.top
: children[index + 1].top;
var parentOffsetHeight = targetOffsetTop - currentOffsetTop;
var translateY = parentOffsetHeight - currentAnchor.height;
var anchorStyle = "\n position: relative;\n transform: translate3d(0, ".concat(translateY, "px, 0);\n z-index: ").concat(zIndex, ";\n color: ").concat(highlightColor, ";\n ");
_this.setDiffData({
target: item,
data: {
active: true,
anchorStyle: anchorStyle,
},
});
}
else {
_this.setDiffData({
target: item,
data: {
active: false,
anchorStyle: '',
wrapperStyle: '',
},
});
}
});
}
},
onClick: function (event) {
this.scrollToAnchor(event.target.dataset.index);
},
onTouchMove: function (event) {
var sidebarLength = this.children.length;
var touch = event.touches[0];
var itemHeight = this.sidebar.height / sidebarLength;
var index = Math.floor((touch.clientY - this.sidebar.top) / itemHeight);
if (index < 0) {
index = 0;
}
else if (index > sidebarLength - 1) {
index = sidebarLength - 1;
}
this.scrollToAnchor(index);
},
onTouchStop: function () {
this.scrollToAnchorIndex = null;
},
scrollToAnchor: function (index) {
var _this = this;
if (typeof index !== 'number' || this.scrollToAnchorIndex === index) {
return;
}
this.scrollToAnchorIndex = index;
var anchor = this.children.find(function (item) { return item.data.index === _this.data.indexList[index]; });
if (anchor) {
anchor.scrollIntoView(this.scrollTop);
this.$emit('select', anchor.data.index);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/index-bar/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/index-bar/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/index-bar/index.wxss
================================================
@import '../common/index.wxss';.van-index-bar{position:relative}.van-index-bar__sidebar{display:flex;flex-direction:column;position:fixed;right:0;text-align:center;top:50%;transform:translateY(-50%);-webkit-user-select:none;user-select:none}.van-index-bar__index{font-size:var(--index-bar-index-font-size,10px);font-weight:500;line-height:var(--index-bar-index-line-height,14px);padding:0 var(--padding-base,4px) 0 var(--padding-md,16px)}
================================================
FILE: miniprogram_npm/@vant/weapp/info/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/info/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
dot: Boolean,
info: null,
customStyle: String,
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/info/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/info/index.wxml
================================================
{{ dot ? '' : info }}
================================================
FILE: miniprogram_npm/@vant/weapp/info/index.wxss
================================================
@import '../common/index.wxss';.van-info{align-items:center;background-color:var(--info-background-color,#ee0a24);border:var(--info-border-width,1px) solid #fff;border-radius:var(--info-size,16px);box-sizing:border-box;color:var(--info-color,#fff);display:inline-flex;font-family:var(--info-font-family,-apple-system-font,Helvetica Neue,Arial,sans-serif);font-size:var(--info-font-size,12px);font-weight:var(--info-font-weight,500);height:var(--info-size,16px);justify-content:center;min-width:var(--info-size,16px);padding:var(--info-padding,0 3px);position:absolute;right:0;top:0;transform:translate(50%,-50%);transform-origin:100%;white-space:nowrap}.van-info--dot{background-color:var(--info-dot-color,#ee0a24);border-radius:100%;height:var(--info-dot-size,8px);min-width:0;width:var(--info-dot-size,8px)}
================================================
FILE: miniprogram_npm/@vant/weapp/loading/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/loading/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
color: String,
vertical: Boolean,
type: {
type: String,
value: 'circular',
},
size: String,
textSize: String,
},
data: {
array12: Array.from({ length: 12 }),
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/loading/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/loading/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/loading/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function spinnerStyle(data) {
return style({
color: data.color,
width: addUnit(data.size),
height: addUnit(data.size),
});
}
function textStyle(data) {
return style({
'font-size': addUnit(data.textSize),
});
}
module.exports = {
spinnerStyle: spinnerStyle,
textStyle: textStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/loading/index.wxss
================================================
@import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{align-items:center;color:var(--loading-spinner-color,#c8c9cc);display:inline-flex;justify-content:center}.van-loading__spinner{animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;box-sizing:border-box;height:var(--loading-spinner-size,30px);max-height:100%;max-width:100%;position:relative;width:var(--loading-spinner-size,30px)}.van-loading__spinner--spinner{animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-radius:100%;border-top-color:initial}.van-loading__text{color:var(--loading-text-color,#969799);font-size:var(--loading-text-font-size,14px);line-height:var(--loading-text-line-height,20px);margin-left:var(--padding-xs,8px)}.van-loading__text:empty{display:none}.van-loading--vertical{flex-direction:column}.van-loading--vertical .van-loading__text{margin:var(--padding-xs,8px) 0 0}.van-loading__dot{height:100%;left:0;position:absolute;top:0;width:100%}.van-loading__dot:before{background-color:currentColor;border-radius:40%;content:" ";display:block;height:25%;margin:0 auto;width:2px}.van-loading__dot:first-of-type{opacity:1;transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;transform:rotate(1turn)}@keyframes van-rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/basic.d.ts
================================================
export declare const basic: string;
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/basic.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.basic = void 0;
exports.basic = Behavior({
methods: {
$emit: function (name, detail, options) {
this.triggerEvent(name, detail, options);
},
set: function (data) {
this.setData(data);
return new Promise(function (resolve) { return wx.nextTick(resolve); });
},
// high performance setData
setView: function (data, callback) {
var _this = this;
var target = {};
var hasChange = false;
Object.keys(data).forEach(function (key) {
if (data[key] !== _this.data[key]) {
target[key] = data[key];
hasChange = true;
}
});
if (hasChange) {
return this.setData(target, callback);
}
return callback && callback();
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/button.d.ts
================================================
export declare const button: string;
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/button.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.button = void 0;
var version_1 = require("../common/version");
exports.button = Behavior({
externalClasses: ['hover-class'],
properties: {
id: String,
buttonId: String,
lang: String,
businessId: Number,
sessionFrom: String,
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: Boolean,
appParameter: String,
ariaLabel: String,
openType: String,
getUserProfileDesc: String,
},
data: {
canIUseGetUserProfile: (0, version_1.canIUseGetUserProfile)(),
},
methods: {
onGetUserInfo: function (event) {
this.triggerEvent('getuserinfo', event.detail);
},
onContact: function (event) {
this.triggerEvent('contact', event.detail);
},
onGetPhoneNumber: function (event) {
this.triggerEvent('getphonenumber', event.detail);
},
onGetRealTimePhoneNumber: function (event) {
this.triggerEvent('getrealtimephonenumber', event.detail);
},
onError: function (event) {
this.triggerEvent('error', event.detail);
},
onLaunchApp: function (event) {
this.triggerEvent('launchapp', event.detail);
},
onOpenSetting: function (event) {
this.triggerEvent('opensetting', event.detail);
},
onAgreePrivacyAuthorization: function (event) {
this.triggerEvent('agreeprivacyauthorization', event.detail);
},
onChooseAvatar: function (event) {
this.triggerEvent('chooseavatar', event.detail);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/link.d.ts
================================================
export declare const link: string;
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/link.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.link = void 0;
exports.link = Behavior({
properties: {
url: String,
linkType: {
type: String,
value: 'navigateTo',
},
},
methods: {
jumpLink: function (urlKey) {
if (urlKey === void 0) { urlKey = 'url'; }
var url = this.data[urlKey];
if (url) {
if (this.data.linkType === 'navigateTo' &&
getCurrentPages().length > 9) {
wx.redirectTo({ url: url });
}
else {
wx[this.data.linkType]({ url: url });
}
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/page-scroll.d.ts
================================================
///
///
type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void;
export declare function pageScrollMixin(scroller: Scroller): string;
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/page-scroll.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pageScrollMixin = void 0;
var validator_1 = require("../common/validator");
var utils_1 = require("../common/utils");
function onPageScroll(event) {
var _a = (0, utils_1.getCurrentPage)().vanPageScroller, vanPageScroller = _a === void 0 ? [] : _a;
vanPageScroller.forEach(function (scroller) {
if (typeof scroller === 'function') {
// @ts-ignore
scroller(event);
}
});
}
function pageScrollMixin(scroller) {
return Behavior({
attached: function () {
var page = (0, utils_1.getCurrentPage)();
if (!(0, utils_1.isDef)(page)) {
return;
}
var _scroller = scroller.bind(this);
var _a = page.vanPageScroller, vanPageScroller = _a === void 0 ? [] : _a;
if ((0, validator_1.isFunction)(page.onPageScroll) && page.onPageScroll !== onPageScroll) {
vanPageScroller.push(page.onPageScroll.bind(page));
}
vanPageScroller.push(_scroller);
page.vanPageScroller = vanPageScroller;
page.onPageScroll = onPageScroll;
this._scroller = _scroller;
},
detached: function () {
var _this = this;
var page = (0, utils_1.getCurrentPage)();
if (!(0, utils_1.isDef)(page) || !(0, utils_1.isDef)(page.vanPageScroller)) {
return;
}
var vanPageScroller = page.vanPageScroller;
var index = vanPageScroller.findIndex(function (v) { return v === _this._scroller; });
if (index > -1) {
page.vanPageScroller.splice(index, 1);
}
this._scroller = undefined;
},
});
}
exports.pageScrollMixin = pageScrollMixin;
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/touch.d.ts
================================================
export declare const touch: string;
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/touch.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.touch = void 0;
// @ts-nocheck
var MIN_DISTANCE = 10;
function getDirection(x, y) {
if (x > y && x > MIN_DISTANCE) {
return 'horizontal';
}
if (y > x && y > MIN_DISTANCE) {
return 'vertical';
}
return '';
}
exports.touch = Behavior({
methods: {
resetTouchStatus: function () {
this.direction = '';
this.deltaX = 0;
this.deltaY = 0;
this.offsetX = 0;
this.offsetY = 0;
},
touchStart: function (event) {
this.resetTouchStatus();
var touch = event.touches[0];
this.startX = touch.clientX;
this.startY = touch.clientY;
},
touchMove: function (event) {
var touch = event.touches[0];
this.deltaX = touch.clientX - this.startX;
this.deltaY = touch.clientY - this.startY;
this.offsetX = Math.abs(this.deltaX);
this.offsetY = Math.abs(this.deltaY);
this.direction =
this.direction || getDirection(this.offsetX, this.offsetY);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/transition.d.ts
================================================
export declare function transition(showDefaultValue: boolean): string;
================================================
FILE: miniprogram_npm/@vant/weapp/mixins/transition.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transition = void 0;
// @ts-nocheck
var utils_1 = require("../common/utils");
var validator_1 = require("../common/validator");
var getClassNames = function (name) { return ({
enter: "van-".concat(name, "-enter van-").concat(name, "-enter-active enter-class enter-active-class"),
'enter-to': "van-".concat(name, "-enter-to van-").concat(name, "-enter-active enter-to-class enter-active-class"),
leave: "van-".concat(name, "-leave van-").concat(name, "-leave-active leave-class leave-active-class"),
'leave-to': "van-".concat(name, "-leave-to van-").concat(name, "-leave-active leave-to-class leave-active-class"),
}); };
function transition(showDefaultValue) {
return Behavior({
properties: {
customStyle: String,
// @ts-ignore
show: {
type: Boolean,
value: showDefaultValue,
observer: 'observeShow',
},
// @ts-ignore
duration: {
type: null,
value: 300,
},
name: {
type: String,
value: 'fade',
},
},
data: {
type: '',
inited: false,
display: false,
},
ready: function () {
if (this.data.show === true) {
this.observeShow(true, false);
}
},
methods: {
observeShow: function (value, old) {
if (value === old) {
return;
}
value ? this.enureEnter() : this.enureLeave();
},
enureEnter: function () {
var _this = this;
if (this.enterPromise)
return;
this.enterPromise = new Promise(function (resolve) { return _this.enter(resolve); });
},
enureLeave: function () {
var _this = this;
var enterPromise = this.enterPromise;
if (!enterPromise)
return;
enterPromise
.then(function () { return new Promise(function (resolve) { return _this.leave(resolve); }); })
.then(function () {
_this.enterPromise = null;
});
},
enter: function (resolve) {
var _this = this;
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.$emit('enter');
_this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'enter') {
return;
}
_this.transitionEnded = false;
_this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
},
leave: function (resolve) {
var _this = this;
if (!this.data.display) {
return;
}
var _a = this.data, duration = _a.duration, name = _a.name;
var classNames = getClassNames(name);
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.$emit('leave');
_this.setData({
classes: classNames.leave,
currentDuration: currentDuration,
});
(0, utils_1.requestAnimationFrame)(function () {
if (_this.status !== 'leave') {
return;
}
_this.transitionEnded = false;
setTimeout(function () {
_this.onTransitionEnd();
resolve();
}, currentDuration);
_this.setData({ classes: classNames['leave-to'] });
});
});
},
onTransitionEnd: function () {
if (this.transitionEnded) {
return;
}
this.transitionEnded = true;
this.$emit("after-".concat(this.status));
var _a = this.data, show = _a.show, display = _a.display;
if (!show && display) {
this.setData({ display: false });
}
},
},
});
}
exports.transition = transition;
================================================
FILE: miniprogram_npm/@vant/weapp/nav-bar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/nav-bar/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({
classes: ['title-class'],
props: {
title: String,
fixed: {
type: Boolean,
observer: 'setHeight',
},
placeholder: {
type: Boolean,
observer: 'setHeight',
},
leftText: String,
rightText: String,
customStyle: String,
leftArrow: Boolean,
border: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 1,
},
safeAreaInsetTop: {
type: Boolean,
value: true,
},
},
data: {
height: 46,
},
created: function () {
var statusBarHeight = (0, utils_1.getSystemInfoSync)().statusBarHeight;
this.setData({
statusBarHeight: statusBarHeight,
height: 46 + statusBarHeight,
});
},
mounted: function () {
this.setHeight();
},
methods: {
onClickLeft: function () {
this.$emit('click-left');
},
onClickRight: function () {
this.$emit('click-right');
},
setHeight: function () {
var _this = this;
if (!this.data.fixed || !this.data.placeholder) {
return;
}
wx.nextTick(function () {
(0, utils_1.getRect)(_this, '.van-nav-bar').then(function (res) {
if (res && 'height' in res) {
_this.setData({ height: res.height });
}
});
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/nav-bar/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/nav-bar/index.wxml
================================================
{{ leftText }}
{{ title }}
{{ rightText }}
================================================
FILE: miniprogram_npm/@vant/weapp/nav-bar/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
function barStyle(data) {
return style({
'z-index': data.zIndex,
'padding-top': data.safeAreaInsetTop ? data.statusBarHeight + 'px' : 0,
});
}
module.exports = {
barStyle: barStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/nav-bar/index.wxss
================================================
@import '../common/index.wxss';.van-nav-bar{background-color:var(--nav-bar-background-color,#fff);box-sizing:initial;height:var(--nav-bar-height,46px);line-height:var(--nav-bar-height,46px);position:relative;text-align:center;-webkit-user-select:none;user-select:none}.van-nav-bar__content{height:100%;position:relative}.van-nav-bar__text{color:var(--nav-bar-text-color,#1989fa);display:inline-block;margin:0 calc(var(--padding-md, 16px)*-1);padding:0 var(--padding-md,16px);vertical-align:middle}.van-nav-bar__text--hover{background-color:#f2f3f5}.van-nav-bar__arrow{color:var(--nav-bar-icon-color,#1989fa)!important;font-size:var(--nav-bar-arrow-size,16px)!important;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{left:0;position:fixed;top:0;width:100%}.van-nav-bar__title{color:var(--nav-bar-title-text-color,#323233);font-size:var(--nav-bar-title-font-size,16px);font-weight:var(--font-weight-bold,500);margin:0 auto;max-width:60%}.van-nav-bar__left,.van-nav-bar__right{align-items:center;bottom:0;display:flex;font-size:var(--font-size-md,14px);position:absolute;top:0}.van-nav-bar__left{left:var(--padding-md,16px)}.van-nav-bar__right{right:var(--padding-md,16px)}
================================================
FILE: miniprogram_npm/@vant/weapp/notice-bar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/notice-bar/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({
props: {
text: {
type: String,
value: '',
observer: 'init',
},
mode: {
type: String,
value: '',
},
url: {
type: String,
value: '',
},
openType: {
type: String,
value: 'navigate',
},
delay: {
type: Number,
value: 1,
},
speed: {
type: Number,
value: 60,
observer: 'init',
},
scrollable: null,
leftIcon: {
type: String,
value: '',
},
color: String,
backgroundColor: String,
background: String,
wrapable: Boolean,
},
data: {
show: true,
},
created: function () {
this.resetAnimation = wx.createAnimation({
duration: 0,
timingFunction: 'linear',
});
},
destroyed: function () {
this.timer && clearTimeout(this.timer);
},
mounted: function () {
this.init();
},
methods: {
init: function () {
var _this = this;
(0, utils_1.requestAnimationFrame)(function () {
Promise.all([
(0, utils_1.getRect)(_this, '.van-notice-bar__content'),
(0, utils_1.getRect)(_this, '.van-notice-bar__wrap'),
]).then(function (rects) {
var contentRect = rects[0], wrapRect = rects[1];
var scrollable = _this.data.scrollable;
if (contentRect == null ||
wrapRect == null ||
!contentRect.width ||
!wrapRect.width ||
scrollable === false) {
return;
}
if (scrollable || wrapRect.width < contentRect.width) {
_this.initAnimation(wrapRect.width, contentRect.width);
_this.scroll(true);
}
});
});
},
initAnimation: function (warpWidth, contentWidth) {
var _a = this.data, speed = _a.speed, delay = _a.delay;
this.wrapWidth = warpWidth;
this.contentWidth = contentWidth;
// begin 0
this.contentDuration = (contentWidth / speed) * 1000;
// begin -wrapWidth
this.duration = ((warpWidth + contentWidth) / speed) * 1000;
this.animation = wx.createAnimation({
duration: this.contentDuration,
timingFunction: 'linear',
delay: delay,
});
},
scroll: function (isInit) {
var _this = this;
if (isInit === void 0) { isInit = false; }
this.timer && clearTimeout(this.timer);
this.timer = null;
this.setData({
animationData: this.resetAnimation
.translateX(isInit ? 0 : this.wrapWidth)
.step()
.export(),
});
var duration = isInit ? this.contentDuration : this.duration;
(0, utils_1.requestAnimationFrame)(function () {
_this.setData({
animationData: _this.animation
.translateX(-_this.contentWidth)
.step({ duration: duration })
.export(),
});
});
this.timer = setTimeout(function () {
_this.scroll();
}, duration + this.data.delay);
},
onClickIcon: function (event) {
if (this.data.mode === 'closeable') {
this.timer && clearTimeout(this.timer);
this.timer = null;
this.setData({ show: false });
this.$emit('close', event.detail);
}
},
onClick: function (event) {
this.$emit('click', event);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/notice-bar/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/notice-bar/index.wxml
================================================
{{ text }}
================================================
FILE: miniprogram_npm/@vant/weapp/notice-bar/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
return style({
color: data.color,
'background-color': data.backgroundColor,
background: data.background,
});
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/notice-bar/index.wxss
================================================
@import '../common/index.wxss';.van-notice-bar{align-items:center;background-color:var(--notice-bar-background-color,#fffbe8);color:var(--notice-bar-text-color,#ed6a0c);display:flex;font-size:var(--notice-bar-font-size,14px);height:var(--notice-bar-height,40px);line-height:var(--notice-bar-line-height,24px);padding:var(--notice-bar-padding,0 16px)}.van-notice-bar--withicon{padding-right:40px;position:relative}.van-notice-bar--wrapable{height:auto;padding:var(--notice-bar-wrapable-padding,8px 16px)}.van-notice-bar--wrapable .van-notice-bar__wrap{height:auto}.van-notice-bar--wrapable .van-notice-bar__content{position:relative;white-space:normal}.van-notice-bar__left-icon{align-items:center;display:flex;margin-right:4px;vertical-align:middle}.van-notice-bar__left-icon,.van-notice-bar__right-icon{font-size:var(--notice-bar-icon-size,16px);min-width:var(--notice-bar-icon-min-width,22px)}.van-notice-bar__right-icon{position:absolute;right:15px;top:10px}.van-notice-bar__wrap{flex:1;height:var(--notice-bar-line-height,24px);overflow:hidden;position:relative}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%}
================================================
FILE: miniprogram_npm/@vant/weapp/notify/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/notify/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var color_1 = require("../common/color");
var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({
props: {
message: String,
background: String,
type: {
type: String,
value: 'danger',
},
color: {
type: String,
value: color_1.WHITE,
},
duration: {
type: Number,
value: 3000,
},
zIndex: {
type: Number,
value: 110,
},
safeAreaInsetTop: {
type: Boolean,
value: false,
},
top: null,
},
data: {
show: false,
onOpened: null,
onClose: null,
onClick: null,
},
created: function () {
var statusBarHeight = (0, utils_1.getSystemInfoSync)().statusBarHeight;
this.setData({ statusBarHeight: statusBarHeight });
},
methods: {
show: function () {
var _this = this;
var _a = this.data, duration = _a.duration, onOpened = _a.onOpened;
clearTimeout(this.timer);
this.setData({ show: true });
wx.nextTick(onOpened);
if (duration > 0 && duration !== Infinity) {
this.timer = setTimeout(function () {
_this.hide();
}, duration);
}
},
hide: function () {
var onClose = this.data.onClose;
clearTimeout(this.timer);
this.setData({ show: false });
wx.nextTick(onClose);
},
onTap: function (event) {
var onClick = this.data.onClick;
if (onClick) {
onClick(event.detail);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/notify/index.json
================================================
{
"component": true,
"usingComponents": {
"van-transition": "../transition/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/notify/index.wxml
================================================
{{ message }}
================================================
FILE: miniprogram_npm/@vant/weapp/notify/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
return style({
'z-index': data.zIndex,
top: addUnit(data.top),
});
}
function notifyStyle(data) {
return style({
background: data.background,
color: data.color,
});
}
module.exports = {
rootStyle: rootStyle,
notifyStyle: notifyStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/notify/index.wxss
================================================
@import '../common/index.wxss';.van-notify{word-wrap:break-word;font-size:var(--notify-font-size,14px);line-height:var(--notify-line-height,20px);padding:var(--notify-padding,6px 15px);text-align:center}.van-notify__container{box-sizing:border-box;left:0;position:fixed;top:0;width:100%}.van-notify--primary{background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:var(--notify-warning-background-color,#ff976a)}
================================================
FILE: miniprogram_npm/@vant/weapp/notify/notify.d.ts
================================================
interface NotifyOptions {
type?: 'primary' | 'success' | 'danger' | 'warning';
color?: string;
zIndex?: number;
top?: number;
message: string;
context?: any;
duration?: number;
selector?: string;
background?: string;
safeAreaInsetTop?: boolean;
onClick?: () => void;
onOpened?: () => void;
onClose?: () => void;
}
declare function Notify(options: NotifyOptions | string): any;
declare namespace Notify {
var clear: (options?: NotifyOptions | undefined) => void;
var setDefaultOptions: (options: NotifyOptions) => void;
var resetDefaultOptions: () => void;
}
export default Notify;
================================================
FILE: miniprogram_npm/@vant/weapp/notify/notify.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var color_1 = require("../common/color");
var defaultOptions = {
selector: '#van-notify',
type: 'danger',
message: '',
background: '',
duration: 3000,
zIndex: 110,
top: 0,
color: color_1.WHITE,
safeAreaInsetTop: false,
onClick: function () { },
onOpened: function () { },
onClose: function () { },
};
var currentOptions = __assign({}, defaultOptions);
function parseOptions(message) {
if (message == null) {
return {};
}
return typeof message === 'string' ? { message: message } : message;
}
function getContext() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
function Notify(options) {
options = __assign(__assign({}, currentOptions), parseOptions(options));
var context = options.context || getContext();
var notify = context.selectComponent(options.selector);
delete options.context;
delete options.selector;
if (notify) {
notify.setData(options);
notify.show();
return notify;
}
console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
}
exports.default = Notify;
Notify.clear = function (options) {
options = __assign(__assign({}, defaultOptions), parseOptions(options));
var context = options.context || getContext();
var notify = context.selectComponent(options.selector);
if (notify) {
notify.hide();
}
};
Notify.setDefaultOptions = function (options) {
Object.assign(currentOptions, options);
};
Notify.resetDefaultOptions = function () {
currentOptions = __assign({}, defaultOptions);
};
================================================
FILE: miniprogram_npm/@vant/weapp/overlay/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/overlay/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
show: Boolean,
customStyle: String,
duration: {
type: null,
value: 300,
},
zIndex: {
type: Number,
value: 1,
},
lockScroll: {
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onClick: function () {
this.$emit('click');
},
// for prevent touchmove
noop: function () { },
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/overlay/index.json
================================================
{
"component": true,
"usingComponents": {
"van-transition": "../transition/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/overlay/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/overlay/index.wxss
================================================
@import '../common/index.wxss';.van-overlay{background-color:var(--overlay-background-color,rgba(0,0,0,.7));height:100%;left:0;position:fixed;top:0;width:100%}
================================================
FILE: miniprogram_npm/@vant/weapp/overlay/overlay.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/panel/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/panel/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: ['header-class', 'footer-class'],
props: {
desc: String,
title: String,
status: String,
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/panel/index.json
================================================
{
"component": true,
"usingComponents": {
"van-cell": "../cell/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/panel/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/panel/index.wxss
================================================
@import '../common/index.wxss';.van-panel{background:var(--panel-background-color,#fff)}.van-panel__header-value{color:var(--panel-header-value-color,#ee0a24)}.van-panel__footer{padding:var(--panel-footer-padding,8px 16px)}.van-panel__footer:empty{display:none}
================================================
FILE: miniprogram_npm/@vant/weapp/picker/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/picker/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var shared_1 = require("./shared");
(0, component_1.VantComponent)({
classes: ['active-class', 'toolbar-class', 'column-class'],
props: __assign(__assign({}, shared_1.pickerProps), { valueKey: {
type: String,
value: 'text',
}, toolbarPosition: {
type: String,
value: 'top',
}, defaultIndex: {
type: Number,
value: 0,
}, columns: {
type: Array,
value: [],
observer: function (columns) {
if (columns === void 0) { columns = []; }
this.simple = columns.length && !columns[0].values;
if (Array.isArray(this.children) && this.children.length) {
this.setColumns().catch(function () { });
}
},
} }),
beforeCreate: function () {
var _this = this;
Object.defineProperty(this, 'children', {
get: function () { return _this.selectAllComponents('.van-picker__column') || []; },
});
},
methods: {
noop: function () { },
setColumns: function () {
var _this = this;
var data = this.data;
var columns = this.simple ? [{ values: data.columns }] : data.columns;
var stack = columns.map(function (column, index) {
return _this.setColumnValues(index, column.values);
});
return Promise.all(stack);
},
emit: function (event) {
var type = event.currentTarget.dataset.type;
if (this.simple) {
this.$emit(type, {
value: this.getColumnValue(0),
index: this.getColumnIndex(0),
});
}
else {
this.$emit(type, {
value: this.getValues(),
index: this.getIndexes(),
});
}
},
onChange: function (event) {
if (this.simple) {
this.$emit('change', {
picker: this,
value: this.getColumnValue(0),
index: this.getColumnIndex(0),
});
}
else {
this.$emit('change', {
picker: this,
value: this.getValues(),
index: event.currentTarget.dataset.index,
});
}
},
// get column instance by index
getColumn: function (index) {
return this.children[index];
},
// get column value by index
getColumnValue: function (index) {
var column = this.getColumn(index);
return column && column.getValue();
},
// set column value by index
setColumnValue: function (index, value) {
var column = this.getColumn(index);
if (column == null) {
return Promise.reject(new Error('setColumnValue: 对应列不存在'));
}
return column.setValue(value);
},
// get column option index by column index
getColumnIndex: function (columnIndex) {
return (this.getColumn(columnIndex) || {}).data.currentIndex;
},
// set column option index by column index
setColumnIndex: function (columnIndex, optionIndex) {
var column = this.getColumn(columnIndex);
if (column == null) {
return Promise.reject(new Error('setColumnIndex: 对应列不存在'));
}
return column.setIndex(optionIndex);
},
// get options of column by index
getColumnValues: function (index) {
return (this.children[index] || {}).data.options;
},
// set options of column by index
setColumnValues: function (index, options, needReset) {
if (needReset === void 0) { needReset = true; }
var column = this.children[index];
if (column == null) {
return Promise.reject(new Error('setColumnValues: 对应列不存在'));
}
var isSame = JSON.stringify(column.data.options) === JSON.stringify(options);
if (isSame) {
return Promise.resolve();
}
return column.set({ options: options }).then(function () {
if (needReset) {
column.setIndex(0);
}
});
},
// get values of all columns
getValues: function () {
return this.children.map(function (child) { return child.getValue(); });
},
// set values of all columns
setValues: function (values) {
var _this = this;
var stack = values.map(function (value, index) {
return _this.setColumnValue(index, value);
});
return Promise.all(stack);
},
// get indexes of all columns
getIndexes: function () {
return this.children.map(function (child) { return child.data.currentIndex; });
},
// set indexes of all columns
setIndexes: function (indexes) {
var _this = this;
var stack = indexes.map(function (optionIndex, columnIndex) {
return _this.setColumnIndex(columnIndex, optionIndex);
});
return Promise.all(stack);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/picker/index.json
================================================
{
"component": true,
"usingComponents": {
"picker-column": "../picker-column/index",
"loading": "../loading/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/picker/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/picker/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
var array = require('../wxs/array.wxs');
function columnsStyle(data) {
return style({
height: addUnit(data.itemHeight * data.visibleItemCount),
});
}
function maskStyle(data) {
return style({
'background-size':
'100% ' + addUnit((data.itemHeight * (data.visibleItemCount - 1)) / 2),
});
}
function frameStyle(data) {
return style({
height: addUnit(data.itemHeight),
});
}
function columns(columns) {
if (!array.isArray(columns)) {
return [];
}
if (columns.length && !columns[0].values) {
return [{ values: columns }];
}
return columns;
}
module.exports = {
columnsStyle: columnsStyle,
frameStyle: frameStyle,
maskStyle: maskStyle,
columns: columns,
};
================================================
FILE: miniprogram_npm/@vant/weapp/picker/index.wxss
================================================
@import '../common/index.wxss';.van-picker{-webkit-text-size-adjust:100%;background-color:var(--picker-background-color,#fff);overflow:hidden;position:relative;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:flex;height:var(--picker-toolbar-height,44px);justify-content:space-between;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{font-size:var(--picker-action-font-size,14px);padding:var(--picker-action-padding,0 16px)}.van-picker__cancel--hover,.van-picker__confirm--hover{opacity:.7}.van-picker__confirm{color:var(--picker-confirm-action-color,#576b95)}.van-picker__cancel{color:var(--picker-cancel-action-color,#969799)}.van-picker__title{font-size:var(--picker-option-font-size,16px);font-weight:var(--font-weight-bold,500);max-width:50%;text-align:center}.van-picker__columns{display:flex;position:relative}.van-picker__column{flex:1 1;width:0}.van-picker__loading{align-items:center;background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9));bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:4}.van-picker__mask{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-position:top,bottom;background-repeat:no-repeat;height:100%;left:0;top:0;width:100%;z-index:2}.van-picker__frame,.van-picker__mask{pointer-events:none;position:absolute}.van-picker__frame{left:16px;right:16px;top:50%;transform:translateY(-50%);z-index:1}
================================================
FILE: miniprogram_npm/@vant/weapp/picker/shared.d.ts
================================================
export declare const pickerProps: {
title: StringConstructor;
loading: BooleanConstructor;
showToolbar: BooleanConstructor;
cancelButtonText: {
type: StringConstructor;
value: string;
};
confirmButtonText: {
type: StringConstructor;
value: string;
};
visibleItemCount: {
type: NumberConstructor;
value: number;
};
itemHeight: {
type: NumberConstructor;
value: number;
};
};
================================================
FILE: miniprogram_npm/@vant/weapp/picker/shared.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pickerProps = void 0;
exports.pickerProps = {
title: String,
loading: Boolean,
showToolbar: Boolean,
cancelButtonText: {
type: String,
value: '取消',
},
confirmButtonText: {
type: String,
value: '确认',
},
visibleItemCount: {
type: Number,
value: 6,
},
itemHeight: {
type: Number,
value: 44,
},
};
================================================
FILE: miniprogram_npm/@vant/weapp/picker/toolbar.wxml
================================================
{{ cancelButtonText }}
{{
title
}}
{{ confirmButtonText }}
================================================
FILE: miniprogram_npm/@vant/weapp/picker-column/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/picker-column/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
var validator_1 = require("../common/validator");
var DEFAULT_DURATION = 200;
(0, component_1.VantComponent)({
classes: ['active-class'],
props: {
valueKey: String,
className: String,
itemHeight: Number,
visibleItemCount: Number,
initialOptions: {
type: Array,
value: [],
},
defaultIndex: {
type: Number,
value: 0,
observer: function (value) {
this.setIndex(value);
},
},
},
data: {
startY: 0,
offset: 0,
duration: 0,
startOffset: 0,
options: [],
currentIndex: 0,
},
created: function () {
var _this = this;
var _a = this.data, defaultIndex = _a.defaultIndex, initialOptions = _a.initialOptions;
this.set({
currentIndex: defaultIndex,
options: initialOptions,
}).then(function () {
_this.setIndex(defaultIndex);
});
},
methods: {
getCount: function () {
return this.data.options.length;
},
onTouchStart: function (event) {
this.setData({
startY: event.touches[0].clientY,
startOffset: this.data.offset,
duration: 0,
});
},
onTouchMove: function (event) {
var data = this.data;
var deltaY = event.touches[0].clientY - data.startY;
this.setData({
offset: (0, utils_1.range)(data.startOffset + deltaY, -(this.getCount() * data.itemHeight), data.itemHeight),
});
},
onTouchEnd: function () {
var data = this.data;
if (data.offset !== data.startOffset) {
this.setData({ duration: DEFAULT_DURATION });
var index = (0, utils_1.range)(Math.round(-data.offset / data.itemHeight), 0, this.getCount() - 1);
this.setIndex(index, true);
}
},
onClickItem: function (event) {
var index = event.currentTarget.dataset.index;
this.setIndex(index, true);
},
adjustIndex: function (index) {
var data = this.data;
var count = this.getCount();
index = (0, utils_1.range)(index, 0, count);
for (var i = index; i < count; i++) {
if (!this.isDisabled(data.options[i]))
return i;
}
for (var i = index - 1; i >= 0; i--) {
if (!this.isDisabled(data.options[i]))
return i;
}
},
isDisabled: function (option) {
return (0, validator_1.isObj)(option) && option.disabled;
},
getOptionText: function (option) {
var data = this.data;
return (0, validator_1.isObj)(option) && data.valueKey in option
? option[data.valueKey]
: option;
},
setIndex: function (index, userAction) {
var _this = this;
var data = this.data;
index = this.adjustIndex(index) || 0;
var offset = -index * data.itemHeight;
if (index !== data.currentIndex) {
return this.set({ offset: offset, currentIndex: index }).then(function () {
userAction && _this.$emit('change', index);
});
}
return this.set({ offset: offset });
},
setValue: function (value) {
var options = this.data.options;
for (var i = 0; i < options.length; i++) {
if (this.getOptionText(options[i]) === value) {
return this.setIndex(i);
}
}
return Promise.resolve();
},
getValue: function () {
var data = this.data;
return data.options[data.currentIndex];
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/picker-column/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/picker-column/index.wxml
================================================
{{ computed.optionText(option, valueKey) }}
================================================
FILE: miniprogram_npm/@vant/weapp/picker-column/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function isObj(x) {
var type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
function optionText(option, valueKey) {
return isObj(option) && option[valueKey] != null ? option[valueKey] : option;
}
function rootStyle(data) {
return style({
height: addUnit(data.itemHeight * data.visibleItemCount),
});
}
function wrapperStyle(data) {
var offset = addUnit(
data.offset + (data.itemHeight * (data.visibleItemCount - 1)) / 2
);
return style({
transition: 'transform ' + data.duration + 'ms',
'line-height': addUnit(data.itemHeight),
transform: 'translate3d(0, ' + offset + ', 0)',
});
}
module.exports = {
optionText: optionText,
rootStyle: rootStyle,
wrapperStyle: wrapperStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/picker-column/index.wxss
================================================
@import '../common/index.wxss';.van-picker-column{color:var(--picker-option-text-color,#000);font-size:var(--picker-option-font-size,16px);overflow:hidden;text-align:center}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{color:var(--picker-option-selected-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-picker-column__item--disabled{opacity:var(--picker-option-disabled-opacity,.3)}
================================================
FILE: miniprogram_npm/@vant/weapp/popup/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/popup/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var transition_1 = require("../mixins/transition");
(0, component_1.VantComponent)({
classes: [
'enter-class',
'enter-active-class',
'enter-to-class',
'leave-class',
'leave-active-class',
'leave-to-class',
'close-icon-class',
],
mixins: [(0, transition_1.transition)(false)],
props: {
round: Boolean,
closeable: Boolean,
customStyle: String,
overlayStyle: String,
transition: {
type: String,
observer: 'observeClass',
},
zIndex: {
type: Number,
value: 100,
},
overlay: {
type: Boolean,
value: true,
},
closeIcon: {
type: String,
value: 'cross',
},
closeIconPosition: {
type: String,
value: 'top-right',
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
position: {
type: String,
value: 'center',
observer: 'observeClass',
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
safeAreaInsetTop: {
type: Boolean,
value: false,
},
safeAreaTabBar: {
type: Boolean,
value: false,
},
lockScroll: {
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
created: function () {
this.observeClass();
},
methods: {
onClickCloseIcon: function () {
this.$emit('close');
},
onClickOverlay: function () {
this.$emit('click-overlay');
if (this.data.closeOnClickOverlay) {
this.$emit('close');
}
},
observeClass: function () {
var _a = this.data, transition = _a.transition, position = _a.position, duration = _a.duration;
var updateData = {
name: transition || position,
};
if (transition === 'none') {
updateData.duration = 0;
this.originDuration = duration;
}
else if (this.originDuration != null) {
updateData.duration = this.originDuration;
}
this.setData(updateData);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/popup/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-overlay": "../overlay/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/popup/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/popup/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
function popupStyle(data) {
return style([
{
'z-index': data.zIndex,
'-webkit-transition-duration': data.currentDuration + 'ms',
'transition-duration': data.currentDuration + 'ms',
},
data.display ? null : 'display: none',
data.customStyle,
]);
}
module.exports = {
popupStyle: popupStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/popup/index.wxss
================================================
@import '../common/index.wxss';.van-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,#fff);box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.van-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:var(--popup-round-border-radius,16px)}.van-popup--top{left:0;top:0;width:100%}.van-popup--top.van-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.van-popup--bottom{bottom:0;left:0;width:100%}.van-popup--bottom.van-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.van-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--bottom.van-popup--safeTabBar,.van-popup--top.van-popup--safeTabBar{bottom:var(--tabbar-height,50px)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,18px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.van-popup__close-icon--top-left{left:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{right:var(--popup-close-icon-margin,16px);top:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,16px);left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,16px);right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,transform}.van-scale-enter,.van-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:transform}.van-bottom-enter,.van-bottom-leave-to{transform:translate3d(0,100%,0)}.van-top-enter,.van-top-leave-to{transform:translate3d(0,-100%,0)}.van-left-enter,.van-left-leave-to{transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{transform:translate3d(100%,-50%,0)}
================================================
FILE: miniprogram_npm/@vant/weapp/popup/popup.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/progress/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/progress/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var color_1 = require("../common/color");
var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({
props: {
inactive: Boolean,
percentage: {
type: Number,
observer: 'setLeft',
},
pivotText: String,
pivotColor: String,
trackColor: String,
showPivot: {
type: Boolean,
value: true,
},
color: {
type: String,
value: color_1.BLUE,
},
textColor: {
type: String,
value: '#fff',
},
strokeWidth: {
type: null,
value: 4,
},
},
data: {
right: 0,
},
mounted: function () {
this.setLeft();
},
methods: {
setLeft: function () {
var _this = this;
Promise.all([
(0, utils_1.getRect)(this, '.van-progress'),
(0, utils_1.getRect)(this, '.van-progress__pivot'),
]).then(function (_a) {
var portion = _a[0], pivot = _a[1];
if (portion && pivot) {
_this.setData({
right: (pivot.width * (_this.data.percentage - 100)) / 100,
});
}
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/progress/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/progress/index.wxml
================================================
{{ computed.pivotText(pivotText, percentage) }}
================================================
FILE: miniprogram_npm/@vant/weapp/progress/index.wxs
================================================
/* eslint-disable */
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function pivotText(pivotText, percentage) {
return pivotText || percentage + '%';
}
function rootStyle(data) {
return style({
'height': data.strokeWidth ? utils.addUnit(data.strokeWidth) : '',
'background': data.trackColor,
});
}
function portionStyle(data) {
return style({
background: data.inactive ? '#cacaca' : data.color,
width: data.percentage ? data.percentage + '%' : '',
});
}
function pivotStyle(data) {
return style({
color: data.textColor,
right: data.right + 'px',
background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color,
});
}
module.exports = {
pivotText: pivotText,
rootStyle: rootStyle,
portionStyle: portionStyle,
pivotStyle: pivotStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/progress/index.wxss
================================================
@import '../common/index.wxss';.van-progress{background:var(--progress-background-color,#ebedf0);border-radius:var(--progress-height,4px);height:var(--progress-height,4px);position:relative}.van-progress__portion{background:var(--progress-color,#1989fa);border-radius:inherit;height:100%;left:0;position:absolute}.van-progress__pivot{background-color:var(--progress-pivot-background-color,#1989fa);border-radius:1em;box-sizing:border-box;color:var(--progress-pivot-text-color,#fff);font-size:var(--progress-pivot-font-size,10px);line-height:var(--progress-pivot-line-height,1.6);min-width:3.6em;padding:var(--progress-pivot-padding,0 5px);position:absolute;text-align:center;top:50%;transform:translateY(-50%);word-break:keep-all}
================================================
FILE: miniprogram_npm/@vant/weapp/radio/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/radio/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var version_1 = require("../common/version");
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
field: true,
relation: (0, relation_1.useParent)('radio-group', function () {
this.updateFromParent();
}),
classes: ['icon-class', 'label-class'],
props: {
name: null,
value: null,
disabled: Boolean,
useIconSlot: Boolean,
checkedColor: String,
labelPosition: {
type: String,
value: 'right',
},
labelDisabled: Boolean,
shape: {
type: String,
value: 'round',
},
iconSize: {
type: null,
value: 20,
},
},
data: {
direction: '',
parentDisabled: false,
},
methods: {
updateFromParent: function () {
if (!this.parent) {
return;
}
var _a = this.parent.data, value = _a.value, parentDisabled = _a.disabled, direction = _a.direction;
this.setData({
value: value,
direction: direction,
parentDisabled: parentDisabled,
});
},
emitChange: function (value) {
var instance = this.parent || this;
instance.$emit('input', value);
instance.$emit('change', value);
if ((0, version_1.canIUseModel)()) {
instance.setData({ value: value });
}
},
onChange: function () {
if (!this.data.disabled && !this.data.parentDisabled) {
this.emitChange(this.data.name);
}
},
onClickLabel: function () {
var _a = this.data, disabled = _a.disabled, parentDisabled = _a.parentDisabled, labelDisabled = _a.labelDisabled, name = _a.name;
if (!(disabled || parentDisabled) && !labelDisabled) {
this.emitChange(name);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/radio/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/radio/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/radio/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function iconStyle(data) {
var styles = {
'font-size': addUnit(data.iconSize),
};
if (
data.checkedColor &&
!(data.disabled || data.parentDisabled) &&
data.value === data.name
) {
styles['border-color'] = data.checkedColor;
styles['background-color'] = data.checkedColor;
}
return style(styles);
}
function iconCustomStyle(data) {
return style({
'line-height': addUnit(data.iconSize),
'font-size': '.8em',
display: 'block',
});
}
module.exports = {
iconStyle: iconStyle,
iconCustomStyle: iconCustomStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/radio/index.wxss
================================================
@import '../common/index.wxss';.van-radio{align-items:center;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-radio__icon-wrap{flex:none}.van-radio--horizontal{margin-right:var(--padding-sm,12px)}.van-radio__icon{align-items:center;border:1px solid var(--radio-border-color,#c8c9cc);box-sizing:border-box;color:transparent;display:flex;font-size:var(--radio-size,20px);height:1em;justify-content:center;text-align:center;transition-duration:var(--radio-transition-duration,.2s);transition-property:color,border-color,background-color;width:1em}.van-radio__icon--round{border-radius:100%}.van-radio__icon--checked{background-color:var(--radio-checked-icon-color,#1989fa);border-color:var(--radio-checked-icon-color,#1989fa);color:#fff}.van-radio__icon--disabled{background-color:var(--radio-disabled-background-color,#ebedf0);border-color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__icon--disabled.van-radio__icon--checked{color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__label{word-wrap:break-word;color:var(--radio-label-color,#323233);line-height:var(--radio-size,20px);padding-left:var(--radio-label-margin,10px)}.van-radio__label--left{float:left;margin:0 var(--radio-label-margin,10px) 0 0}.van-radio__label--disabled{color:var(--radio-disabled-label-color,#c8c9cc)}.van-radio__label:empty{margin:0}
================================================
FILE: miniprogram_npm/@vant/weapp/radio-group/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/radio-group/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
field: true,
relation: (0, relation_1.useChildren)('radio'),
props: {
value: {
type: null,
observer: 'updateChildren',
},
direction: String,
disabled: {
type: Boolean,
observer: 'updateChildren',
},
},
methods: {
updateChildren: function () {
this.children.forEach(function (child) { return child.updateFromParent(); });
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/radio-group/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/radio-group/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/radio-group/index.wxss
================================================
@import '../common/index.wxss';.van-radio-group--horizontal{display:flex;flex-wrap:wrap}
================================================
FILE: miniprogram_npm/@vant/weapp/rate/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/rate/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../common/utils");
var component_1 = require("../common/component");
var version_1 = require("../common/version");
(0, component_1.VantComponent)({
field: true,
classes: ['icon-class'],
props: {
value: {
type: Number,
observer: function (value) {
if (value !== this.data.innerValue) {
this.setData({ innerValue: value });
}
},
},
readonly: Boolean,
disabled: Boolean,
allowHalf: Boolean,
size: null,
icon: {
type: String,
value: 'star',
},
voidIcon: {
type: String,
value: 'star-o',
},
color: String,
voidColor: String,
disabledColor: String,
count: {
type: Number,
value: 5,
observer: function (value) {
this.setData({ innerCountArray: Array.from({ length: value }) });
},
},
gutter: null,
touchable: {
type: Boolean,
value: true,
},
},
data: {
innerValue: 0,
innerCountArray: Array.from({ length: 5 }),
},
methods: {
onSelect: function (event) {
var _this = this;
var data = this.data;
var score = event.currentTarget.dataset.score;
if (!data.disabled && !data.readonly) {
this.setData({ innerValue: score + 1 });
if ((0, version_1.canIUseModel)()) {
this.setData({ value: score + 1 });
}
wx.nextTick(function () {
_this.$emit('input', score + 1);
_this.$emit('change', score + 1);
});
}
},
onTouchMove: function (event) {
var _this = this;
var touchable = this.data.touchable;
if (!touchable)
return;
var clientX = event.touches[0].clientX;
(0, utils_1.getAllRect)(this, '.van-rate__icon').then(function (list) {
var target = list
.sort(function (cur, next) { return cur.dataset.score - next.dataset.score; })
.find(function (item) { return clientX >= item.left && clientX <= item.right; });
if (target != null) {
_this.onSelect(__assign(__assign({}, event), { currentTarget: target }));
}
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/rate/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/rate/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/rate/index.wxss
================================================
@import '../common/index.wxss';.van-rate{display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{padding:0 var(--rate-horizontal-padding,2px);position:relative}.van-rate__item:not(:last-child){padding-right:var(--rate-icon-gutter,4px)}.van-rate__icon{color:var(--rate-icon-void-color,#c8c9cc);display:block;font-size:var(--rate-icon-size,20px);height:100%}.van-rate__icon--half{left:var(--rate-horizontal-padding,2px);overflow:hidden;position:absolute;top:0;width:.5em}.van-rate__icon--full,.van-rate__icon--half{color:var(--rate-icon-full-color,#ee0a24)}.van-rate__icon--disabled{color:var(--rate-icon-disabled-color,#c8c9cc)}
================================================
FILE: miniprogram_npm/@vant/weapp/row/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/row/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('col', function (target) {
var gutter = this.data.gutter;
if (gutter) {
target.setData({ gutter: gutter });
}
}),
props: {
gutter: {
type: Number,
observer: 'setGutter',
},
},
methods: {
setGutter: function () {
var _this = this;
this.children.forEach(function (col) {
col.setData(_this.data);
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/row/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/row/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/row/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
if (!data.gutter) {
return '';
}
return style({
'margin-right': addUnit(-data.gutter / 2),
'margin-left': addUnit(-data.gutter / 2),
});
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/row/index.wxss
================================================
@import '../common/index.wxss';.van-row:after{clear:both;content:"";display:table}
================================================
FILE: miniprogram_npm/@vant/weapp/search/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/search/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var version_1 = require("../common/version");
(0, component_1.VantComponent)({
field: true,
classes: ['field-class', 'input-class', 'cancel-class'],
props: {
value: {
type: String,
value: '',
},
label: String,
focus: Boolean,
error: Boolean,
disabled: Boolean,
readonly: Boolean,
inputAlign: String,
showAction: Boolean,
useActionSlot: Boolean,
useLeftIconSlot: Boolean,
useRightIconSlot: Boolean,
leftIcon: {
type: String,
value: 'search',
},
rightIcon: String,
placeholder: String,
placeholderStyle: String,
actionText: {
type: String,
value: '取消',
},
background: {
type: String,
value: '#ffffff',
},
maxlength: {
type: Number,
value: -1,
},
shape: {
type: String,
value: 'square',
},
clearable: {
type: Boolean,
value: true,
},
clearTrigger: {
type: String,
value: 'focus',
},
clearIcon: {
type: String,
value: 'clear',
},
cursorSpacing: {
type: Number,
value: 0,
},
},
methods: {
onChange: function (event) {
if ((0, version_1.canIUseModel)()) {
this.setData({ value: event.detail });
}
this.$emit('change', event.detail);
},
onCancel: function () {
var _this = this;
/**
* 修复修改输入框值时,输入框失焦和赋值同时触发,赋值失效
* https://github.com/youzan/vant-weapp/issues/1768
*/
setTimeout(function () {
if ((0, version_1.canIUseModel)()) {
_this.setData({ value: '' });
}
_this.$emit('cancel');
_this.$emit('change', '');
}, 200);
},
onSearch: function (event) {
this.$emit('search', event.detail);
},
onFocus: function (event) {
this.$emit('focus', event.detail);
},
onBlur: function (event) {
this.$emit('blur', event.detail);
},
onClear: function (event) {
this.$emit('clear', event.detail);
},
onClickInput: function (event) {
this.$emit('click-input', event.detail);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/search/index.json
================================================
{
"component": true,
"usingComponents": {
"van-field": "../field/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/search/index.wxml
================================================
{{ label }}
{{ actionText }}
================================================
FILE: miniprogram_npm/@vant/weapp/search/index.wxss
================================================
@import '../common/index.wxss';.van-search{align-items:center;box-sizing:border-box;display:flex;padding:var(--search-padding,10px 12px)}.van-search__content{background-color:var(--search-background-color,#f7f8fa);border-radius:2px;display:flex;flex:1;padding-left:var(--padding-sm,12px)}.van-search__content--round{border-radius:999px}.van-search__label{color:var(--search-label-color,#323233);font-size:var(--search-label-font-size,14px);line-height:var(--search-input-height,34px);padding:var(--search-label-padding,0 5px)}.van-search__field{flex:1}.van-search__field__left-icon{color:var(--search-left-icon-color,#969799)}.van-search--withaction{padding-right:0}.van-search__action{color:var(--search-action-text-color,#323233);font-size:var(--search-action-font-size,14px);line-height:var(--search-input-height,34px)}.van-search__action--hover{background-color:#f2f3f5}.van-search__action-button{padding:var(--search-action-padding,0 8px)}
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
// whether to show popup
show: Boolean,
// overlay custom style
overlayStyle: String,
// z-index
zIndex: {
type: Number,
value: 100,
},
title: String,
cancelText: {
type: String,
value: '取消',
},
description: String,
options: {
type: Array,
value: [],
},
overlay: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
duration: {
type: null,
value: 300,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {
onClickOverlay: function () {
this.$emit('click-overlay');
},
onCancel: function () {
this.onClose();
this.$emit('cancel');
},
onSelect: function (event) {
this.$emit('select', event.detail);
},
onClose: function () {
this.$emit('close');
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/index.json
================================================
{
"component": true,
"usingComponents": {
"van-popup": "../popup/index",
"options": "./options"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/index.wxs
================================================
/* eslint-disable */
function isMulti(options) {
if (options == null || options[0] == null) {
return false;
}
return "Array" === options.constructor && "Array" === options[0].constructor;
}
module.exports = {
isMulti: isMulti
};
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/index.wxss
================================================
@import '../common/index.wxss';.van-share-sheet__header{padding:12px 16px 4px;text-align:center}.van-share-sheet__title{color:#323233;font-size:14px;font-weight:400;line-height:20px;margin-top:8px}.van-share-sheet__title:empty,.van-share-sheet__title:not(:empty)+.van-share-sheet__title{display:none}.van-share-sheet__description{color:#969799;display:block;font-size:12px;line-height:16px;margin-top:8px}.van-share-sheet__description:empty,.van-share-sheet__description:not(:empty)+.van-share-sheet__description{display:none}.van-share-sheet__cancel{background:#fff;border:none;box-sizing:initial;display:block;font-size:16px;height:auto;line-height:48px;padding:0;text-align:center;width:100%}.van-share-sheet__cancel:before{background-color:#f7f8fa;content:" ";display:block;height:8px}.van-share-sheet__cancel:after{display:none}.van-share-sheet__cancel:active{background-color:#f2f3f5}
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/options.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/options.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
options: Array,
showBorder: Boolean,
},
methods: {
onSelect: function (event) {
var index = event.currentTarget.dataset.index;
var option = this.data.options[index];
this.$emit('select', __assign(__assign({}, option), { index: index }));
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/options.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/options.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/options.wxs
================================================
/* eslint-disable */
var PRESET_ICONS = ['qq', 'link', 'weibo', 'wechat', 'poster', 'qrcode', 'weapp-qrcode', 'wechat-moments'];
function getIconURL(icon) {
if (PRESET_ICONS.indexOf(icon) !== -1) {
return 'https://img.yzcdn.cn/vant/share-sheet-' + icon + '.png';
}
return icon;
}
module.exports = {
getIconURL: getIconURL,
};
================================================
FILE: miniprogram_npm/@vant/weapp/share-sheet/options.wxss
================================================
@import '../common/index.wxss';.van-share-sheet__options{-webkit-overflow-scrolling:touch;display:flex;overflow-x:auto;overflow-y:visible;padding:16px 0 16px 8px;position:relative}.van-share-sheet__options--border:before{border-top:1px solid #ebedf0;box-sizing:border-box;content:" ";left:16px;pointer-events:none;position:absolute;right:0;top:0;transform:scaleY(.5);transform-origin:center}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{align-items:center;display:flex;flex-direction:column;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{background-color:initial;border:0;height:auto;line-height:inherit;padding:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{height:48px;margin:0 16px;width:48px}.van-share-sheet__name{color:#646566;font-size:12px;margin-top:8px;padding:0 4px}.van-share-sheet__option-description{color:#c8c9cc;font-size:12px;padding:0 4px}
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('sidebar-item', function () {
this.setActive(this.data.activeKey);
}),
props: {
activeKey: {
type: Number,
value: 0,
observer: 'setActive',
},
},
beforeCreate: function () {
this.currentActive = -1;
},
methods: {
setActive: function (activeKey) {
var _a = this, children = _a.children, currentActive = _a.currentActive;
if (!children.length) {
return Promise.resolve();
}
this.currentActive = activeKey;
var stack = [];
if (currentActive !== activeKey && children[currentActive]) {
stack.push(children[currentActive].setActive(false));
}
if (children[activeKey]) {
stack.push(children[activeKey].setActive(true));
}
return Promise.all(stack);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar/index.wxss
================================================
@import '../common/index.wxss';.van-sidebar{width:var(--sidebar-width,80px)}
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar-item/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar-item/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
classes: ['active-class', 'disabled-class'],
relation: (0, relation_1.useParent)('sidebar'),
props: {
dot: Boolean,
badge: null,
info: null,
title: String,
disabled: Boolean,
},
methods: {
onClick: function () {
var _this = this;
var parent = this.parent;
if (!parent || this.data.disabled) {
return;
}
var index = parent.children.indexOf(this);
parent.setActive(index).then(function () {
_this.$emit('click', index);
parent.$emit('change', index);
});
},
setActive: function (selected) {
return this.setData({ selected: selected });
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar-item/index.json
================================================
{
"component": true,
"usingComponents": {
"van-info": "../info/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar-item/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/sidebar-item/index.wxss
================================================
@import '../common/index.wxss';.van-sidebar-item{background-color:var(--sidebar-background-color,#f7f8fa);border-left:3px solid transparent;box-sizing:border-box;color:var(--sidebar-text-color,#323233);display:block;font-size:var(--sidebar-font-size,14px);line-height:var(--sidebar-line-height,20px);overflow:hidden;padding:var(--sidebar-padding,20px 12px 20px 8px);-webkit-user-select:none;user-select:none}.van-sidebar-item__text{display:inline-block;position:relative;word-break:break-all}.van-sidebar-item--hover:not(.van-sidebar-item--disabled){background-color:var(--sidebar-active-color,#f2f3f5)}.van-sidebar-item:after{border-bottom-width:1px}.van-sidebar-item--selected{border-color:var(--sidebar-selected-border-color,#ee0a24);color:var(--sidebar-selected-text-color,#323233);font-weight:var(--sidebar-selected-font-weight,500)}.van-sidebar-item--selected:after{border-right-width:1px}.van-sidebar-item--selected,.van-sidebar-item--selected.van-sidebar-item--hover{background-color:var(--sidebar-selected-background-color,#fff)}.van-sidebar-item--disabled{color:var(--sidebar-disabled-text-color,#c8c9cc)}
================================================
FILE: miniprogram_npm/@vant/weapp/skeleton/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/skeleton/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: ['avatar-class', 'title-class', 'row-class'],
props: {
row: {
type: Number,
value: 0,
observer: function (value) {
this.setData({ rowArray: Array.from({ length: value }) });
},
},
title: Boolean,
avatar: Boolean,
loading: {
type: Boolean,
value: true,
},
animate: {
type: Boolean,
value: true,
},
avatarSize: {
type: String,
value: '32px',
},
avatarShape: {
type: String,
value: 'round',
},
titleWidth: {
type: String,
value: '40%',
},
rowWidth: {
type: null,
value: '100%',
observer: function (val) {
this.setData({ isArray: val instanceof Array });
},
},
},
data: {
isArray: false,
rowArray: [],
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/skeleton/index.json
================================================
{
"component": true,
"usingComponents": {}
}
================================================
FILE: miniprogram_npm/@vant/weapp/skeleton/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/skeleton/index.wxss
================================================
@import '../common/index.wxss';.van-skeleton{box-sizing:border-box;display:flex;padding:var(--skeleton-padding,0 16px);width:100%}.van-skeleton__avatar{background-color:var(--skeleton-avatar-background-color,#f2f3f5);flex-shrink:0;margin-right:var(--padding-md,16px)}.van-skeleton__avatar--round{border-radius:100%}.van-skeleton__content{flex:1}.van-skeleton__avatar+.van-skeleton__content{padding-top:var(--padding-xs,8px)}.van-skeleton__row,.van-skeleton__title{background-color:var(--skeleton-row-background-color,#f2f3f5);height:var(--skeleton-row-height,16px)}.van-skeleton__title{margin:0}.van-skeleton__row:not(:first-child){margin-top:var(--skeleton-row-margin-top,12px)}.van-skeleton__title+.van-skeleton__row{margin-top:20px}.van-skeleton--animate{animation:van-skeleton-blink 1.2s ease-in-out infinite}@keyframes van-skeleton-blink{50%{opacity:.6}}
================================================
FILE: miniprogram_npm/@vant/weapp/slider/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/slider/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var touch_1 = require("../mixins/touch");
var version_1 = require("../common/version");
var utils_1 = require("../common/utils");
var DRAG_STATUS = {
START: 'start',
MOVING: 'moving',
END: 'end',
};
(0, component_1.VantComponent)({
mixins: [touch_1.touch],
props: {
range: Boolean,
disabled: Boolean,
useButtonSlot: Boolean,
activeColor: String,
inactiveColor: String,
max: {
type: Number,
value: 100,
},
min: {
type: Number,
value: 0,
},
step: {
type: Number,
value: 1,
},
value: {
type: null,
value: 0,
observer: function (val) {
if (val !== this.value) {
this.updateValue(val);
}
},
},
vertical: Boolean,
barHeight: null,
},
created: function () {
this.updateValue(this.data.value);
},
methods: {
onTouchStart: function (event) {
var _this = this;
if (this.data.disabled)
return;
var index = event.currentTarget.dataset.index;
if (typeof index === 'number') {
this.buttonIndex = index;
}
this.touchStart(event);
this.startValue = this.format(this.value);
this.newValue = this.value;
if (this.isRange(this.newValue)) {
this.startValue = this.newValue.map(function (val) { return _this.format(val); });
}
else {
this.startValue = this.format(this.newValue);
}
this.dragStatus = DRAG_STATUS.START;
},
onTouchMove: function (event) {
var _this = this;
if (this.data.disabled)
return;
if (this.dragStatus === DRAG_STATUS.START) {
this.$emit('drag-start');
}
this.touchMove(event);
this.dragStatus = DRAG_STATUS.MOVING;
(0, utils_1.getRect)(this, '.van-slider').then(function (rect) {
var vertical = _this.data.vertical;
var delta = vertical ? _this.deltaY : _this.deltaX;
var total = vertical ? rect.height : rect.width;
var diff = (delta / total) * _this.getRange();
if (_this.isRange(_this.startValue)) {
_this.newValue[_this.buttonIndex] =
_this.startValue[_this.buttonIndex] + diff;
}
else {
_this.newValue = _this.startValue + diff;
}
_this.updateValue(_this.newValue, false, true);
});
},
onTouchEnd: function () {
var _this = this;
if (this.data.disabled)
return;
if (this.dragStatus === DRAG_STATUS.MOVING) {
this.dragStatus = DRAG_STATUS.END;
(0, utils_1.nextTick)(function () {
_this.updateValue(_this.newValue, true);
_this.$emit('drag-end');
});
}
},
onClick: function (event) {
var _this = this;
if (this.data.disabled)
return;
var min = this.data.min;
(0, utils_1.getRect)(this, '.van-slider').then(function (rect) {
var vertical = _this.data.vertical;
var touch = event.touches[0];
var delta = vertical
? touch.clientY - rect.top
: touch.clientX - rect.left;
var total = vertical ? rect.height : rect.width;
var value = Number(min) + (delta / total) * _this.getRange();
if (_this.isRange(_this.value)) {
var _a = _this.value, left = _a[0], right = _a[1];
var middle = (left + right) / 2;
if (value <= middle) {
_this.updateValue([value, right], true);
}
else {
_this.updateValue([left, value], true);
}
}
else {
_this.updateValue(value, true);
}
});
},
isRange: function (val) {
var range = this.data.range;
return range && Array.isArray(val);
},
handleOverlap: function (value) {
if (value[0] > value[1]) {
return value.slice(0).reverse();
}
return value;
},
updateValue: function (value, end, drag) {
var _this = this;
if (this.isRange(value)) {
value = this.handleOverlap(value).map(function (val) { return _this.format(val); });
}
else {
value = this.format(value);
}
this.value = value;
var vertical = this.data.vertical;
var mainAxis = vertical ? 'height' : 'width';
this.setData({
wrapperStyle: "\n background: ".concat(this.data.inactiveColor || '', ";\n ").concat(vertical ? 'width' : 'height', ": ").concat((0, utils_1.addUnit)(this.data.barHeight) || '', ";\n "),
barStyle: "\n ".concat(mainAxis, ": ").concat(this.calcMainAxis(), ";\n left: ").concat(vertical ? 0 : this.calcOffset(), ";\n top: ").concat(vertical ? this.calcOffset() : 0, ";\n ").concat(drag ? 'transition: none;' : '', "\n "),
});
if (drag) {
this.$emit('drag', { value: value });
}
if (end) {
this.$emit('change', value);
}
if ((drag || end) && (0, version_1.canIUseModel)()) {
this.setData({ value: value });
}
},
getScope: function () {
return Number(this.data.max) - Number(this.data.min);
},
getRange: function () {
var _a = this.data, max = _a.max, min = _a.min;
return max - min;
},
getOffsetWidth: function (current, min) {
var scope = this.getScope();
// 避免最小值小于最小step时出现负数情况
return "".concat(Math.max(((current - min) * 100) / scope, 0), "%");
},
// 计算选中条的长度百分比
calcMainAxis: function () {
var value = this.value;
var min = this.data.min;
if (this.isRange(value)) {
return this.getOffsetWidth(value[1], value[0]);
}
return this.getOffsetWidth(value, Number(min));
},
// 计算选中条的开始位置的偏移量
calcOffset: function () {
var value = this.value;
var min = this.data.min;
var scope = this.getScope();
if (this.isRange(value)) {
return "".concat(((value[0] - Number(min)) * 100) / scope, "%");
}
return '0%';
},
format: function (value) {
var min = +this.data.min;
var max = +this.data.max;
var step = +this.data.step;
value = (0, utils_1.clamp)(value, min, max);
var diff = Math.round((value - min) / step) * step;
return (0, utils_1.addNumber)(min, diff);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/slider/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/slider/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/slider/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function barStyle(barHeight, activeColor) {
return style({
height: addUnit(barHeight),
background: activeColor,
});
}
module.exports = {
barStyle: barStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/slider/index.wxss
================================================
@import '../common/index.wxss';.van-slider{background-color:var(--slider-inactive-background-color,#ebedf0);border-radius:999px;height:var(--slider-bar-height,2px);position:relative}.van-slider:before{bottom:calc(var(--padding-xs, 8px)*-1);content:"";left:0;position:absolute;right:0;top:calc(var(--padding-xs, 8px)*-1)}.van-slider__bar{background-color:var(--slider-active-background-color,#1989fa);border-radius:inherit;height:100%;position:relative;transition:all .2s;width:100%}.van-slider__button{background-color:var(--slider-button-background-color,#fff);border-radius:var(--slider-button-border-radius,50%);box-shadow:var(--slider-button-box-shadow,0 1px 2px rgba(0,0,0,.5));height:var(--slider-button-height,24px);width:var(--slider-button-width,24px)}.van-slider__button-wrapper,.van-slider__button-wrapper-right{position:absolute;right:0;top:50%;transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper-left{left:0;position:absolute;top:50%;transform:translate3d(-50%,-50%,0)}.van-slider--disabled{opacity:var(--slider-disabled-opacity,.5)}.van-slider--vertical{display:inline-block;height:100%;width:var(--slider-bar-height,2px)}.van-slider--vertical .van-slider__button-wrapper,.van-slider--vertical .van-slider__button-wrapper-right{bottom:0;right:50%;top:auto;transform:translate3d(50%,50%,0)}.van-slider--vertical .van-slider__button-wrapper-left{left:auto;right:50%;top:0;transform:translate3d(50%,-50%,0)}.van-slider--vertical:before{bottom:0;left:-8px;right:-8px;top:0}
================================================
FILE: miniprogram_npm/@vant/weapp/stepper/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/stepper/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var validator_1 = require("../common/validator");
var LONG_PRESS_START_TIME = 600;
var LONG_PRESS_INTERVAL = 200;
// add num and avoid float number
function add(num1, num2) {
var cardinal = Math.pow(10, 10);
return Math.round((num1 + num2) * cardinal) / cardinal;
}
function equal(value1, value2) {
return String(value1) === String(value2);
}
(0, component_1.VantComponent)({
field: true,
classes: ['input-class', 'plus-class', 'minus-class'],
props: {
value: {
type: null,
},
integer: {
type: Boolean,
observer: 'check',
},
disabled: Boolean,
inputWidth: String,
buttonSize: String,
asyncChange: Boolean,
disableInput: Boolean,
decimalLength: {
type: Number,
value: null,
observer: 'check',
},
min: {
type: null,
value: 1,
observer: 'check',
},
max: {
type: null,
value: Number.MAX_SAFE_INTEGER,
observer: 'check',
},
step: {
type: null,
value: 1,
},
showPlus: {
type: Boolean,
value: true,
},
showMinus: {
type: Boolean,
value: true,
},
disablePlus: Boolean,
disableMinus: Boolean,
longPress: {
type: Boolean,
value: true,
},
theme: String,
alwaysEmbed: Boolean,
},
data: {
currentValue: '',
},
watch: {
value: function () {
this.observeValue();
},
},
created: function () {
this.setData({
currentValue: this.format(this.data.value).newValue,
});
},
methods: {
observeValue: function () {
var value = this.data.value;
this.setData({ currentValue: this.format(value).newValue });
},
check: function () {
var newValue = this.format(this.data.currentValue).newValue;
if (!equal(newValue, this.data.currentValue)) {
this.setData({ currentValue: newValue });
}
},
isDisabled: function (type) {
var _a = this.data, disabled = _a.disabled, disablePlus = _a.disablePlus, disableMinus = _a.disableMinus, currentValue = _a.currentValue, max = _a.max, min = _a.min;
if (type === 'plus') {
return disabled || disablePlus || +currentValue >= +max;
}
return disabled || disableMinus || +currentValue <= +min;
},
onFocus: function (event) {
this.$emit('focus', event.detail);
},
onBlur: function (event) {
var data = this.format(event.detail.value);
this.setData({ currentValue: data.newValue });
this.emitChange(data);
this.$emit('blur', __assign(__assign({}, event.detail), { value: +data.newValue }));
},
// filter illegal characters
filter: function (value) {
value = String(value).replace(/[^0-9.-]/g, '');
if (this.data.integer && value.indexOf('.') !== -1) {
value = value.split('.')[0];
}
return value;
},
format: function (value) {
// filter illegal characters and format integer
var safeValue = this.filter(value);
// format range
var rangeValue = Math.max(Math.min(this.data.max, +safeValue), this.data.min);
// format decimal
var newValue = (0, validator_1.isDef)(this.data.decimalLength)
? rangeValue.toFixed(this.data.decimalLength)
: String(rangeValue);
return { value: value, newValue: newValue };
},
onInput: function (event) {
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
// allow input to be empty
if (value === '') {
return;
}
var formatted = this.format(value);
this.emitChange(formatted);
},
emitChange: function (data) {
var value = data.value, newValue = data.newValue;
if (!this.data.asyncChange) {
// fix when input 11. parsed to 11, unable to enter decimal
this.setData({ currentValue: +value === +newValue ? value : newValue });
}
this.$emit('change', +newValue);
},
onChange: function () {
var type = this.type;
if (this.isDisabled(type)) {
this.$emit('overlimit', type);
return;
}
var diff = type === 'minus' ? -this.data.step : +this.data.step;
var value = this.format(String(add(+this.data.currentValue, diff)));
this.emitChange(value);
this.$emit(type);
},
longPressStep: function () {
var _this = this;
this.longPressTimer = setTimeout(function () {
_this.onChange();
_this.longPressStep();
}, LONG_PRESS_INTERVAL);
},
onTap: function (event) {
var type = event.currentTarget.dataset.type;
this.type = type;
this.onChange();
},
onTouchStart: function (event) {
var _this = this;
if (!this.data.longPress) {
return;
}
clearTimeout(this.longPressTimer);
var type = event.currentTarget.dataset.type;
this.type = type;
this.isLongPress = false;
this.longPressTimer = setTimeout(function () {
_this.isLongPress = true;
_this.onChange();
_this.longPressStep();
}, LONG_PRESS_START_TIME);
},
onTouchEnd: function () {
if (!this.data.longPress) {
return;
}
clearTimeout(this.longPressTimer);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/stepper/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/stepper/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/stepper/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function buttonStyle(data) {
return style({
width: addUnit(data.buttonSize),
height: addUnit(data.buttonSize),
});
}
function inputStyle(data) {
return style({
width: addUnit(data.inputWidth),
height: addUnit(data.buttonSize),
});
}
module.exports = {
buttonStyle: buttonStyle,
inputStyle: inputStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/stepper/index.wxss
================================================
@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{background-color:var(--stepper-background-color,#f2f3f5);border:0;box-sizing:border-box;color:var(--stepper-button-icon-color,#323233);display:inline-block;height:var(--stepper-input-height,28px);margin:1px;padding:var(--padding-base,4px);position:relative;vertical-align:middle;width:var(--stepper-input-height,28px)}.van-stepper__minus:before,.van-stepper__plus:before{height:1px;width:9px}.van-stepper__minus:after,.van-stepper__plus:after{height:9px;width:1px}.van-stepper__minus:empty.van-stepper__minus:after,.van-stepper__minus:empty.van-stepper__minus:before,.van-stepper__minus:empty.van-stepper__plus:after,.van-stepper__minus:empty.van-stepper__plus:before,.van-stepper__plus:empty.van-stepper__minus:after,.van-stepper__plus:empty.van-stepper__minus:before,.van-stepper__plus:empty.van-stepper__plus:after,.van-stepper__plus:empty.van-stepper__plus:before{background-color:currentColor;bottom:0;content:"";left:0;margin:auto;position:absolute;right:0;top:0}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:var(--stepper-border-radius,var(--stepper-border-radius,4px)) 0 0 var(--stepper-border-radius,var(--stepper-border-radius,4px))}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 var(--stepper-border-radius,var(--stepper-border-radius,4px)) var(--stepper-border-radius,var(--stepper-border-radius,4px)) 0}.van-stepper--round .van-stepper__input{background-color:initial!important}.van-stepper--round .van-stepper__minus,.van-stepper--round .van-stepper__plus{border-radius:100%}.van-stepper--round .van-stepper__minus:active,.van-stepper--round .van-stepper__plus:active{opacity:.7}.van-stepper--round .van-stepper__minus--disabled,.van-stepper--round .van-stepper__minus--disabled:active,.van-stepper--round .van-stepper__plus--disabled,.van-stepper--round .van-stepper__plus--disabled:active{opacity:.3}.van-stepper--round .van-stepper__plus{background-color:#ee0a24;color:#fff}.van-stepper--round .van-stepper__minus{background-color:#fff;border:1px solid #ee0a24;color:#ee0a24}.van-stepper__input{-webkit-appearance:none;background-color:var(--stepper-background-color,#f2f3f5);border:0;border-radius:0;border-width:1px 0;box-sizing:border-box;color:var(--stepper-input-text-color,#323233);display:inline-block;font-size:var(--stepper-input-font-size,14px);height:var(--stepper-input-height,28px);margin:1px;min-height:0;padding:1px;text-align:center;vertical-align:middle;width:var(--stepper-input-width,32px)}.van-stepper__input--disabled{background-color:var(--stepper-input-disabled-background-color,#f2f3f5);color:var(--stepper-input-disabled-text-color,#c8c9cc)}
================================================
FILE: miniprogram_npm/@vant/weapp/steps/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/steps/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var color_1 = require("../common/color");
(0, component_1.VantComponent)({
classes: ['desc-class'],
props: {
icon: String,
steps: Array,
active: Number,
direction: {
type: String,
value: 'horizontal',
},
activeColor: {
type: String,
value: color_1.GREEN,
},
inactiveColor: {
type: String,
value: color_1.GRAY_DARK,
},
activeIcon: {
type: String,
value: 'checked',
},
inactiveIcon: String,
},
methods: {
onClick: function (event) {
var index = event.currentTarget.dataset.index;
this.$emit('click-step', index);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/steps/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/steps/index.wxml
================================================
{{ item.text }}
{{ item.desc }}
function get(index, active) {
if (index < active) {
return 'finish';
} else if (index === active) {
return 'process';
}
return 'inactive';
}
module.exports = get;
================================================
FILE: miniprogram_npm/@vant/weapp/steps/index.wxss
================================================
@import '../common/index.wxss';.van-steps{background-color:var(--steps-background-color,#fff);overflow:hidden}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{display:flex;overflow:hidden;position:relative}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{color:var(--step-text-color,#969799);flex:1;font-size:var(--step-font-size,14px);position:relative}.van-step--finish{color:var(--step-finish-text-color,#323233)}.van-step__circle{background-color:var(--step-circle-color,#969799);border-radius:50%;height:var(--step-circle-size,5px);width:var(--step-circle-size,5px)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{bottom:0;position:absolute;right:0;top:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;transform:none}.van-step--horizontal:last-child .van-step__circle-container{padding:0 0 0 8px;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{background-color:#fff;bottom:6px;padding:0 var(--padding-xs,8px);position:absolute;transform:translate3d(-50%,50%,0);z-index:1}.van-step--horizontal .van-step__title{display:inline-block;font-size:var(--step-horizontal-title-font-size,12px);transform:translate3d(-50%,0,0)}.van-step--horizontal .van-step__line{background-color:var(--step-line-color,#ebedf0);bottom:6px;height:1px;left:0;position:absolute;right:0;transform:translate3d(0,50%,0)}.van-step--horizontal.van-step--process{color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical{line-height:18px;padding:10px 10px 10px 0}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{background-color:#fff;content:"";height:20px;left:-15px;position:absolute;top:0;width:1px;z-index:1}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{left:-14px;position:absolute;top:19px;transform:translate3d(-50%,-50%,0);z-index:2}.van-step--vertical .van-step__icon{background-color:var(--steps-background-color,#fff);font-size:var(--step-icon-size,12px);line-height:1}.van-step--vertical .van-step__line{background-color:var(--step-line-color,#ebedf0);height:100%;transform:translate3d(-50%,0,0);width:1px;z-index:1}
================================================
FILE: miniprogram_npm/@vant/weapp/sticky/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/sticky/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../common/utils");
var component_1 = require("../common/component");
var validator_1 = require("../common/validator");
var page_scroll_1 = require("../mixins/page-scroll");
var ROOT_ELEMENT = '.van-sticky';
(0, component_1.VantComponent)({
props: {
zIndex: {
type: Number,
value: 99,
},
offsetTop: {
type: Number,
value: 0,
observer: 'onScroll',
},
disabled: {
type: Boolean,
observer: 'onScroll',
},
container: {
type: null,
observer: 'onScroll',
},
scrollTop: {
type: null,
observer: function (val) {
this.onScroll({ scrollTop: val });
},
},
},
mixins: [
(0, page_scroll_1.pageScrollMixin)(function (event) {
if (this.data.scrollTop != null) {
return;
}
this.onScroll(event);
}),
],
data: {
height: 0,
fixed: false,
transform: 0,
},
mounted: function () {
this.onScroll();
},
methods: {
onScroll: function (_a) {
var _this = this;
var _b = _a === void 0 ? {} : _a, scrollTop = _b.scrollTop;
var _c = this.data, container = _c.container, offsetTop = _c.offsetTop, disabled = _c.disabled;
if (disabled) {
this.setDataAfterDiff({
fixed: false,
transform: 0,
});
return;
}
this.scrollTop = scrollTop || this.scrollTop;
if (typeof container === 'function') {
Promise.all([(0, utils_1.getRect)(this, ROOT_ELEMENT), this.getContainerRect()])
.then(function (_a) {
var root = _a[0], container = _a[1];
if (offsetTop + root.height > container.height + container.top) {
_this.setDataAfterDiff({
fixed: false,
transform: container.height - root.height,
});
}
else if (offsetTop >= root.top) {
_this.setDataAfterDiff({
fixed: true,
height: root.height,
transform: 0,
});
}
else {
_this.setDataAfterDiff({ fixed: false, transform: 0 });
}
})
.catch(function () { });
return;
}
(0, utils_1.getRect)(this, ROOT_ELEMENT).then(function (root) {
if (!(0, validator_1.isDef)(root) || (!root.width && !root.height)) {
return;
}
if (offsetTop >= root.top) {
_this.setDataAfterDiff({ fixed: true, height: root.height });
_this.transform = 0;
}
else {
_this.setDataAfterDiff({ fixed: false });
}
});
},
setDataAfterDiff: function (data) {
var _this = this;
wx.nextTick(function () {
var diff = Object.keys(data).reduce(function (prev, key) {
if (data[key] !== _this.data[key]) {
prev[key] = data[key];
}
return prev;
}, {});
if (Object.keys(diff).length > 0) {
_this.setData(diff);
}
_this.$emit('scroll', {
scrollTop: _this.scrollTop,
isFixed: data.fixed || _this.data.fixed,
});
});
},
getContainerRect: function () {
var nodesRef = this.data.container();
if (!nodesRef) {
return Promise.reject(new Error('not found container'));
}
return new Promise(function (resolve) { return nodesRef.boundingClientRect(resolve).exec(); });
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/sticky/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/sticky/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/sticky/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function wrapStyle(data) {
return style({
transform: data.transform
? 'translate3d(0, ' + data.transform + 'px, 0)'
: '',
top: data.fixed ? addUnit(data.offsetTop) : '',
'z-index': data.zIndex,
});
}
function containerStyle(data) {
return style({
height: data.fixed ? addUnit(data.height) : '',
'z-index': data.zIndex,
});
}
module.exports = {
wrapStyle: wrapStyle,
containerStyle: containerStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/sticky/index.wxss
================================================
@import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{left:0;position:fixed;right:0}
================================================
FILE: miniprogram_npm/@vant/weapp/submit-bar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/submit-bar/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: ['bar-class', 'price-class', 'button-class'],
props: {
tip: {
type: null,
observer: 'updateTip',
},
tipIcon: String,
type: Number,
price: {
type: null,
observer: 'updatePrice',
},
label: String,
loading: Boolean,
disabled: Boolean,
buttonText: String,
currency: {
type: String,
value: '¥',
},
buttonType: {
type: String,
value: 'danger',
},
decimalLength: {
type: Number,
value: 2,
observer: 'updatePrice',
},
suffixLabel: String,
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
},
methods: {
updatePrice: function () {
var _a = this.data, price = _a.price, decimalLength = _a.decimalLength;
var priceStrArr = typeof price === 'number' &&
(price / 100).toFixed(decimalLength).split('.');
this.setData({
hasPrice: typeof price === 'number',
integerStr: priceStrArr && priceStrArr[0],
decimalStr: decimalLength && priceStrArr ? ".".concat(priceStrArr[1]) : '',
});
},
updateTip: function () {
this.setData({ hasTip: typeof this.data.tip === 'string' });
},
onSubmit: function (event) {
this.$emit('submit', event.detail);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/submit-bar/index.json
================================================
{
"component": true,
"usingComponents": {
"van-button": "../button/index",
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/submit-bar/index.wxml
================================================
{{ tip }}
{{ label || '合计:' }}
{{ currency }}
{{ integerStr }}{{decimalStr}}
{{ suffixLabel }}
{{ loading ? '' : buttonText }}
================================================
FILE: miniprogram_npm/@vant/weapp/submit-bar/index.wxss
================================================
@import '../common/index.wxss';.van-submit-bar{background-color:var(--submit-bar-background-color,#fff);bottom:0;left:0;position:fixed;-webkit-user-select:none;user-select:none;width:100%;z-index:var(--submit-bar-z-index,100)}.van-submit-bar__tip{background-color:var(--submit-bar-tip-background-color,#fff7cc);color:var(--submit-bar-tip-color,#f56723);font-size:var(--submit-bar-tip-font-size,12px);line-height:var(--submit-bar-tip-line-height,1.5);padding:var(--submit-bar-tip-padding,10px)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{margin-right:4px;vertical-align:middle}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{align-items:center;background-color:var(--submit-bar-background-color,#fff);display:flex;font-size:var(--submit-bar-text-font-size,14px);height:var(--submit-bar-height,50px);justify-content:flex-end;padding:var(--submit-bar-padding,0 16px)}.van-submit-bar__safe{height:constant(safe-area-inset-bottom);height:env(safe-area-inset-bottom)}.van-submit-bar__text{color:var(--submit-bar-text-color,#323233);flex:1;font-weight:var(--font-weight-bold,500);padding-right:var(--padding-sm,12px);text-align:right}.van-submit-bar__price{color:var(--submit-bar-price-color,#ee0a24);font-size:var(--submit-bar-price-font-size,12px);font-weight:var(--font-weight-bold,500)}.van-submit-bar__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-size:20px}.van-submit-bar__currency{font-size:var(--submit-bar-currency-font-size,12px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{--button-default-height:var(--submit-bar-button-height,40px)!important;--button-line-height:var(--submit-bar-button-height,40px)!important;font-weight:var(--font-weight-bold,500);width:var(--submit-bar-button-width,110px)}
================================================
FILE: miniprogram_npm/@vant/weapp/swipe-cell/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/swipe-cell/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var touch_1 = require("../mixins/touch");
var utils_1 = require("../common/utils");
var THRESHOLD = 0.3;
var ARRAY = [];
(0, component_1.VantComponent)({
props: {
disabled: Boolean,
leftWidth: {
type: Number,
value: 0,
observer: function (leftWidth) {
if (leftWidth === void 0) { leftWidth = 0; }
if (this.offset > 0) {
this.swipeMove(leftWidth);
}
},
},
rightWidth: {
type: Number,
value: 0,
observer: function (rightWidth) {
if (rightWidth === void 0) { rightWidth = 0; }
if (this.offset < 0) {
this.swipeMove(-rightWidth);
}
},
},
asyncClose: Boolean,
name: {
type: null,
value: '',
},
},
mixins: [touch_1.touch],
data: {
catchMove: false,
wrapperStyle: '',
},
created: function () {
this.offset = 0;
ARRAY.push(this);
},
destroyed: function () {
var _this = this;
ARRAY = ARRAY.filter(function (item) { return item !== _this; });
},
methods: {
open: function (position) {
var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
var offset = position === 'left' ? leftWidth : -rightWidth;
this.swipeMove(offset);
this.$emit('open', {
position: position,
name: this.data.name,
});
},
close: function () {
this.swipeMove(0);
},
swipeMove: function (offset) {
if (offset === void 0) { offset = 0; }
this.offset = (0, utils_1.range)(offset, -this.data.rightWidth, this.data.leftWidth);
var transform = "translate3d(".concat(this.offset, "px, 0, 0)");
var transition = this.dragging
? 'none'
: 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)';
this.setData({
wrapperStyle: "\n -webkit-transform: ".concat(transform, ";\n -webkit-transition: ").concat(transition, ";\n transform: ").concat(transform, ";\n transition: ").concat(transition, ";\n "),
});
},
swipeLeaveTransition: function () {
var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
var offset = this.offset;
if (rightWidth > 0 && -offset > rightWidth * THRESHOLD) {
this.open('right');
}
else if (leftWidth > 0 && offset > leftWidth * THRESHOLD) {
this.open('left');
}
else {
this.swipeMove(0);
}
this.setData({ catchMove: false });
},
startDrag: function (event) {
if (this.data.disabled) {
return;
}
this.startOffset = this.offset;
this.touchStart(event);
},
noop: function () { },
onDrag: function (event) {
var _this = this;
if (this.data.disabled) {
return;
}
this.touchMove(event);
if (this.direction !== 'horizontal') {
return;
}
this.dragging = true;
ARRAY.filter(function (item) { return item !== _this && item.offset !== 0; }).forEach(function (item) { return item.close(); });
this.setData({ catchMove: true });
this.swipeMove(this.startOffset + this.deltaX);
},
endDrag: function () {
if (this.data.disabled) {
return;
}
this.dragging = false;
this.swipeLeaveTransition();
},
onClick: function (event) {
var _a = event.currentTarget.dataset.key, position = _a === void 0 ? 'outside' : _a;
this.$emit('click', position);
if (!this.offset) {
return;
}
if (this.data.asyncClose) {
this.$emit('close', {
position: position,
instance: this,
name: this.data.name,
});
}
else {
this.swipeMove(0);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/swipe-cell/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/swipe-cell/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/swipe-cell/index.wxss
================================================
@import '../common/index.wxss';.van-swipe-cell{overflow:hidden;position:relative}.van-swipe-cell__left,.van-swipe-cell__right{height:100%;position:absolute;top:0}.van-swipe-cell__left{left:0;transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;transform:translate3d(100%,0,0)}
================================================
FILE: miniprogram_npm/@vant/weapp/switch/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/switch/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
field: true,
classes: ['node-class'],
props: {
checked: null,
loading: Boolean,
disabled: Boolean,
activeColor: String,
inactiveColor: String,
size: {
type: String,
value: '30',
},
activeValue: {
type: null,
value: true,
},
inactiveValue: {
type: null,
value: false,
},
},
methods: {
onClick: function () {
var _a = this.data, activeValue = _a.activeValue, inactiveValue = _a.inactiveValue, disabled = _a.disabled, loading = _a.loading;
if (disabled || loading) {
return;
}
var checked = this.data.checked === activeValue;
var value = checked ? inactiveValue : activeValue;
this.$emit('input', value);
this.$emit('change', value);
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/switch/index.json
================================================
{
"component": true,
"usingComponents": {
"van-loading": "../loading/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/switch/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/switch/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
var currentColor = data.checked === data.activeValue ? data.activeColor : data.inactiveColor;
return style({
'font-size': addUnit(data.size),
'background-color': currentColor,
});
}
var BLUE = '#1989fa';
var GRAY_DARK = '#969799';
function loadingColor(data) {
return data.checked === data.activeValue
? data.activeColor || BLUE
: data.inactiveColor || GRAY_DARK;
}
module.exports = {
rootStyle: rootStyle,
loadingColor: loadingColor,
};
================================================
FILE: miniprogram_npm/@vant/weapp/switch/index.wxss
================================================
@import '../common/index.wxss';.van-switch{background-color:var(--switch-background-color,#fff);border:var(--switch-border,1px solid rgba(0,0,0,.1));border-radius:var(--switch-node-size,1em);box-sizing:initial;display:inline-block;height:var(--switch-height,1em);position:relative;transition:background-color var(--switch-transition-duration,.3s);width:var(--switch-width,2em)}.van-switch__node{background-color:var(--switch-node-background-color,#fff);border-radius:100%;box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));height:var(--switch-node-size,1em);left:0;position:absolute;top:0;transition:var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);width:var(--switch-node-size,1em);z-index:var(--switch-node-z-index,1)}.van-switch__loading{height:50%;left:25%;position:absolute!important;top:25%;width:50%}.van-switch--on{background-color:var(--switch-on-background-color,#1989fa)}.van-switch--on .van-switch__node{transform:translateX(calc(var(--switch-width, 2em) - var(--switch-node-size, 1em)))}.van-switch--disabled{opacity:var(--switch-disabled-opacity,.4)}
================================================
FILE: miniprogram_npm/@vant/weapp/tab/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/tab/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var relation_1 = require("../common/relation");
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
relation: (0, relation_1.useParent)('tabs'),
props: {
dot: {
type: Boolean,
observer: 'update',
},
info: {
type: null,
observer: 'update',
},
title: {
type: String,
observer: 'update',
},
disabled: {
type: Boolean,
observer: 'update',
},
titleStyle: {
type: String,
observer: 'update',
},
name: {
type: null,
value: '',
},
},
data: {
active: false,
},
methods: {
getComputedName: function () {
if (this.data.name !== '') {
return this.data.name;
}
return this.index;
},
updateRender: function (active, parent) {
var parentData = parent.data;
this.inited = this.inited || active;
this.setData({
active: active,
shouldRender: this.inited || !parentData.lazyRender,
shouldShow: active || parentData.animated,
});
},
update: function () {
if (this.parent) {
this.parent.updateTabs();
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/tab/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/tab/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/tab/index.wxss
================================================
@import '../common/index.wxss';:host{box-sizing:border-box;flex-shrink:0;width:100%}.van-tab__pane{-webkit-overflow-scrolling:touch;box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
var utils_1 = require("../common/utils");
(0, component_1.VantComponent)({
relation: (0, relation_1.useChildren)('tabbar-item', function () {
this.updateChildren();
}),
props: {
active: {
type: null,
observer: 'updateChildren',
},
activeColor: {
type: String,
observer: 'updateChildren',
},
inactiveColor: {
type: String,
observer: 'updateChildren',
},
fixed: {
type: Boolean,
value: true,
observer: 'setHeight',
},
placeholder: {
type: Boolean,
observer: 'setHeight',
},
border: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 1,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
},
data: {
height: 50,
},
methods: {
updateChildren: function () {
var children = this.children;
if (!Array.isArray(children) || !children.length) {
return;
}
children.forEach(function (child) { return child.updateFromParent(); });
},
setHeight: function () {
var _this = this;
if (!this.data.fixed || !this.data.placeholder) {
return;
}
wx.nextTick(function () {
(0, utils_1.getRect)(_this, '.van-tabbar').then(function (res) {
_this.setData({ height: res.height });
});
});
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar/index.wxss
================================================
@import '../common/index.wxss';.van-tabbar{background-color:var(--tabbar-background-color,#fff);box-sizing:initial;display:flex;height:var(--tabbar-height,50px);width:100%}.van-tabbar--fixed{bottom:0;left:0;position:fixed}.van-tabbar--safe{padding-bottom:env(safe-area-inset-bottom)}
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar-item/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar-item/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
props: {
info: null,
name: null,
icon: String,
dot: Boolean,
url: {
type: String,
value: '',
},
linkType: {
type: String,
value: 'redirectTo',
},
iconPrefix: {
type: String,
value: 'van-icon',
},
},
relation: (0, relation_1.useParent)('tabbar'),
data: {
active: false,
activeColor: '',
inactiveColor: '',
},
methods: {
onClick: function () {
var parent = this.parent;
if (parent) {
var index = parent.children.indexOf(this);
var active = this.data.name || index;
if (active !== this.data.active) {
parent.$emit('change', active);
}
}
var _a = this.data, url = _a.url, linkType = _a.linkType;
if (url && wx[linkType]) {
return wx[linkType]({ url: url });
}
this.$emit('click');
},
updateFromParent: function () {
var parent = this.parent;
if (!parent) {
return;
}
var index = parent.children.indexOf(this);
var parentData = parent.data;
var data = this.data;
var active = (data.name || index) === parentData.active;
var patch = {};
if (active !== data.active) {
patch.active = active;
}
if (parentData.activeColor !== data.activeColor) {
patch.activeColor = parentData.activeColor;
}
if (parentData.inactiveColor !== data.inactiveColor) {
patch.inactiveColor = parentData.inactiveColor;
}
if (Object.keys(patch).length > 0) {
this.setData(patch);
}
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar-item/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-info": "../info/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar-item/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/tabbar-item/index.wxss
================================================
@import '../common/index.wxss';:host{flex:1}.van-tabbar-item{align-items:center;color:var(--tabbar-item-text-color,#646566);display:flex;flex-direction:column;font-size:var(--tabbar-item-font-size,12px);height:100%;justify-content:center;line-height:var(--tabbar-item-line-height,1)}.van-tabbar-item__icon{font-size:var(--tabbar-item-icon-size,22px);margin-bottom:var(--tabbar-item-margin-bottom,4px);position:relative}.van-tabbar-item__icon__inner{display:block;min-width:1em}.van-tabbar-item--active{color:var(--tabbar-item-active-color,#1989fa)}.van-tabbar-item__info{margin-top:2px}
================================================
FILE: miniprogram_npm/@vant/weapp/tabs/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/tabs/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var touch_1 = require("../mixins/touch");
var utils_1 = require("../common/utils");
var validator_1 = require("../common/validator");
var relation_1 = require("../common/relation");
(0, component_1.VantComponent)({
mixins: [touch_1.touch],
classes: [
'nav-class',
'tab-class',
'tab-active-class',
'line-class',
'wrap-class',
],
relation: (0, relation_1.useChildren)('tab', function () {
this.updateTabs();
}),
props: {
sticky: Boolean,
border: Boolean,
swipeable: Boolean,
titleActiveColor: String,
titleInactiveColor: String,
color: String,
animated: {
type: Boolean,
observer: function () {
var _this = this;
this.children.forEach(function (child, index) {
return child.updateRender(index === _this.data.currentIndex, _this);
});
},
},
lineWidth: {
type: null,
value: 40,
observer: 'resize',
},
lineHeight: {
type: null,
value: -1,
},
active: {
type: null,
value: 0,
observer: function (name) {
if (name !== this.getCurrentName()) {
this.setCurrentIndexByName(name);
}
},
},
type: {
type: String,
value: 'line',
},
ellipsis: {
type: Boolean,
value: true,
},
duration: {
type: Number,
value: 0.3,
},
zIndex: {
type: Number,
value: 1,
},
swipeThreshold: {
type: Number,
value: 5,
observer: function (value) {
this.setData({
scrollable: this.children.length > value || !this.data.ellipsis,
});
},
},
offsetTop: {
type: Number,
value: 0,
},
lazyRender: {
type: Boolean,
value: true,
},
useBeforeChange: {
type: Boolean,
value: false,
},
},
data: {
tabs: [],
scrollLeft: 0,
scrollable: false,
currentIndex: 0,
container: null,
skipTransition: true,
scrollWithAnimation: false,
lineOffsetLeft: 0,
inited: false,
},
mounted: function () {
var _this = this;
(0, utils_1.requestAnimationFrame)(function () {
_this.swiping = true;
_this.setData({
container: function () { return _this.createSelectorQuery().select('.van-tabs'); },
});
_this.resize();
_this.scrollIntoView();
});
},
methods: {
updateTabs: function () {
var _a = this, _b = _a.children, children = _b === void 0 ? [] : _b, data = _a.data;
this.setData({
tabs: children.map(function (child) { return child.data; }),
scrollable: this.children.length > data.swipeThreshold || !data.ellipsis,
});
this.setCurrentIndexByName(data.active || this.getCurrentName());
},
trigger: function (eventName, child) {
var currentIndex = this.data.currentIndex;
var data = this.getChildData(currentIndex, child);
if (!(0, validator_1.isDef)(data)) {
return;
}
this.$emit(eventName, data);
},
onTap: function (event) {
var _this = this;
var index = event.currentTarget.dataset.index;
var child = this.children[index];
if (child.data.disabled) {
this.trigger('disabled', child);
return;
}
this.onBeforeChange(index).then(function () {
_this.setCurrentIndex(index);
(0, utils_1.nextTick)(function () {
_this.trigger('click');
});
});
},
// correct the index of active tab
setCurrentIndexByName: function (name) {
var _a = this.children, children = _a === void 0 ? [] : _a;
var matched = children.filter(function (child) { return child.getComputedName() === name; });
if (matched.length) {
this.setCurrentIndex(matched[0].index);
}
},
setCurrentIndex: function (currentIndex) {
var _this = this;
var _a = this, data = _a.data, _b = _a.children, children = _b === void 0 ? [] : _b;
if (!(0, validator_1.isDef)(currentIndex) ||
currentIndex >= children.length ||
currentIndex < 0) {
return;
}
(0, utils_1.groupSetData)(this, function () {
children.forEach(function (item, index) {
var active = index === currentIndex;
if (active !== item.data.active || !item.inited) {
item.updateRender(active, _this);
}
});
});
if (currentIndex === data.currentIndex) {
if (!data.inited) {
this.resize();
}
return;
}
var shouldEmitChange = data.currentIndex !== null;
this.setData({ currentIndex: currentIndex });
(0, utils_1.requestAnimationFrame)(function () {
_this.resize();
_this.scrollIntoView();
});
(0, utils_1.nextTick)(function () {
_this.trigger('input');
if (shouldEmitChange) {
_this.trigger('change');
}
});
},
getCurrentName: function () {
var activeTab = this.children[this.data.currentIndex];
if (activeTab) {
return activeTab.getComputedName();
}
},
resize: function () {
var _this = this;
if (this.data.type !== 'line') {
return;
}
var _a = this.data, currentIndex = _a.currentIndex, ellipsis = _a.ellipsis, skipTransition = _a.skipTransition;
Promise.all([
(0, utils_1.getAllRect)(this, '.van-tab'),
(0, utils_1.getRect)(this, '.van-tabs__line'),
]).then(function (_a) {
var _b = _a[0], rects = _b === void 0 ? [] : _b, lineRect = _a[1];
var rect = rects[currentIndex];
if (rect == null) {
return;
}
var lineOffsetLeft = rects
.slice(0, currentIndex)
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
lineOffsetLeft +=
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
_this.setData({ lineOffsetLeft: lineOffsetLeft, inited: true });
_this.swiping = true;
if (skipTransition) {
// waiting transition end
setTimeout(function () {
_this.setData({ skipTransition: false });
}, _this.data.duration);
}
});
},
// scroll active tab into view
scrollIntoView: function () {
var _this = this;
var _a = this.data, currentIndex = _a.currentIndex, scrollable = _a.scrollable, scrollWithAnimation = _a.scrollWithAnimation;
if (!scrollable) {
return;
}
Promise.all([
(0, utils_1.getAllRect)(this, '.van-tab'),
(0, utils_1.getRect)(this, '.van-tabs__nav'),
]).then(function (_a) {
var tabRects = _a[0], navRect = _a[1];
var tabRect = tabRects[currentIndex];
var offsetLeft = tabRects
.slice(0, currentIndex)
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
_this.setData({
scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2,
});
if (!scrollWithAnimation) {
(0, utils_1.nextTick)(function () {
_this.setData({ scrollWithAnimation: true });
});
}
});
},
onTouchScroll: function (event) {
this.$emit('scroll', event.detail);
},
onTouchStart: function (event) {
if (!this.data.swipeable)
return;
this.swiping = true;
this.touchStart(event);
},
onTouchMove: function (event) {
if (!this.data.swipeable || !this.swiping)
return;
this.touchMove(event);
},
// watch swipe touch end
onTouchEnd: function () {
var _this = this;
if (!this.data.swipeable || !this.swiping)
return;
var _a = this, direction = _a.direction, deltaX = _a.deltaX, offsetX = _a.offsetX;
var minSwipeDistance = 50;
if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
var index_1 = this.getAvaiableTab(deltaX);
if (index_1 !== -1) {
this.onBeforeChange(index_1).then(function () { return _this.setCurrentIndex(index_1); });
}
}
this.swiping = false;
},
getAvaiableTab: function (direction) {
var _a = this.data, tabs = _a.tabs, currentIndex = _a.currentIndex;
var step = direction > 0 ? -1 : 1;
for (var i = step; currentIndex + i < tabs.length && currentIndex + i >= 0; i += step) {
var index = currentIndex + i;
if (index >= 0 &&
index < tabs.length &&
tabs[index] &&
!tabs[index].disabled) {
return index;
}
}
return -1;
},
onBeforeChange: function (index) {
var _this = this;
var useBeforeChange = this.data.useBeforeChange;
if (!useBeforeChange) {
return Promise.resolve();
}
return new Promise(function (resolve, reject) {
_this.$emit('before-change', __assign(__assign({}, _this.getChildData(index)), { callback: function (status) { return (status ? resolve() : reject()); } }));
});
},
getChildData: function (index, child) {
var currentChild = child || this.children[index];
if (!(0, validator_1.isDef)(currentChild)) {
return;
}
return {
index: currentChild.index,
name: currentChild.getComputedName(),
title: currentChild.data.title,
};
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/tabs/index.json
================================================
{
"component": true,
"usingComponents": {
"van-info": "../info/index",
"van-sticky": "../sticky/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/tabs/index.wxml
================================================
{{ item.title }}
================================================
FILE: miniprogram_npm/@vant/weapp/tabs/index.wxs
================================================
/* eslint-disable */
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function tabClass(active, ellipsis) {
var classes = ['tab-class'];
if (active) {
classes.push('tab-active-class');
}
if (ellipsis) {
classes.push('van-ellipsis');
}
return classes.join(' ');
}
function tabStyle(data) {
var titleColor = data.active
? data.titleActiveColor
: data.titleInactiveColor;
var ellipsis = data.scrollable && data.ellipsis;
// card theme color
if (data.type === 'card') {
return style({
'border-color': data.color,
'background-color': !data.disabled && data.active ? data.color : null,
color: titleColor || (!data.disabled && !data.active ? data.color : null),
'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null,
});
}
return style({
color: titleColor,
'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null,
});
}
function navStyle(color, type) {
return style({
'border-color': type === 'card' && color ? color : null,
});
}
function trackStyle(data) {
if (!data.animated) {
return '';
}
return style({
left: -100 * data.currentIndex + '%',
'transition-duration': data.duration + 's',
'-webkit-transition-duration': data.duration + 's',
});
}
function lineStyle(data) {
return style({
width: utils.addUnit(data.lineWidth),
opacity: data.inited ? 1 : 0,
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
'background-color': data.color,
height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
'border-radius':
data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
'transition-duration': !data.skipTransition ? data.duration + 's' : null,
'-webkit-transition-duration': !data.skipTransition
? data.duration + 's'
: null,
});
}
module.exports = {
tabClass: tabClass,
tabStyle: tabStyle,
trackStyle: trackStyle,
lineStyle: lineStyle,
navStyle: navStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/tabs/index.wxss
================================================
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff);overflow:auto}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line{height:var(--tabs-line-height,44px)}.van-tabs--card{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;transform:translateX(0)!important}
================================================
FILE: miniprogram_npm/@vant/weapp/tag/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/tag/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
size: String,
mark: Boolean,
color: String,
plain: Boolean,
round: Boolean,
textColor: String,
type: {
type: String,
value: 'default',
},
closeable: Boolean,
},
methods: {
onClose: function () {
this.$emit('close');
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/tag/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/tag/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/tag/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
function rootStyle(data) {
return style({
'background-color': data.plain ? '' : data.color,
color: data.textColor || data.plain ? data.textColor || data.color : '',
});
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/tag/index.wxss
================================================
@import '../common/index.wxss';.van-tag{align-items:center;border-radius:var(--tag-border-radius,2px);color:var(--tag-text-color,#fff);display:inline-flex;font-size:var(--tag-font-size,12px);line-height:var(--tag-line-height,16px);padding:var(--tag-padding,0 4px);position:relative}.van-tag--default{background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{border:1px solid;border-radius:inherit;bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.van-tag--medium{padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{border-radius:var(--tag-large-border-radius,4px);font-size:var(--tag-large-font-size,14px);padding:var(--tag-large-padding,4px 8px)}.van-tag--mark{border-radius:0 var(--tag-round-border-radius,var(--tag-round-border-radius,999px)) var(--tag-round-border-radius,var(--tag-round-border-radius,999px)) 0}.van-tag--mark:after{content:"";display:block;width:2px}.van-tag--round{border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{margin-left:2px;min-width:1em}
================================================
FILE: miniprogram_npm/@vant/weapp/toast/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/toast/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
props: {
show: Boolean,
mask: Boolean,
message: String,
forbidClick: Boolean,
zIndex: {
type: Number,
value: 1000,
},
type: {
type: String,
value: 'text',
},
loadingType: {
type: String,
value: 'circular',
},
position: {
type: String,
value: 'middle',
},
},
methods: {
// for prevent touchmove
noop: function () { },
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/toast/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index",
"van-overlay": "../overlay/index",
"van-transition": "../transition/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/toast/index.wxml
================================================
{{ message }}
{{ message }}
================================================
FILE: miniprogram_npm/@vant/weapp/toast/index.wxss
================================================
@import '../common/index.wxss';.van-toast{word-wrap:break-word;align-items:center;background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:var(--toast-border-radius,8px);box-sizing:initial;color:var(--toast-text-color,#fff);display:flex;flex-direction:column;font-size:var(--toast-font-size,14px);justify-content:center;line-height:var(--toast-line-height,20px);white-space:pre-wrap}.van-toast__container{left:50%;max-width:var(--toast-max-width,70%);position:fixed;top:50%;transform:translate(-50%,-50%);width:-webkit-fit-content;width:fit-content}.van-toast--text{min-width:var(--toast-text-min-width,96px);padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{min-height:var(--toast-default-min-height,88px);padding:var(--toast-default-padding,16px);width:var(--toast-default-width,88px)}.van-toast--icon .van-toast__icon{font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{transform:translateY(-30vh)}.van-toast--bottom{transform:translateY(30vh)}
================================================
FILE: miniprogram_npm/@vant/weapp/toast/toast.d.ts
================================================
///
///
type ToastMessage = string | number;
type ToastContext = WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance;
interface ToastOptions {
show?: boolean;
type?: string;
mask?: boolean;
zIndex?: number;
context?: (() => ToastContext) | ToastContext;
position?: string;
duration?: number;
selector?: string;
forbidClick?: boolean;
loadingType?: string;
message?: ToastMessage;
onClose?: () => void;
}
declare function Toast(toastOptions: ToastOptions | ToastMessage): WechatMiniprogram.Component.TrivialInstance | undefined;
declare namespace Toast {
var loading: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined;
var success: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined;
var fail: (options: ToastMessage | ToastOptions) => WechatMiniprogram.Component.TrivialInstance | undefined;
var clear: () => void;
var setDefaultOptions: (options: ToastOptions) => void;
var resetDefaultOptions: () => void;
}
export default Toast;
================================================
FILE: miniprogram_npm/@vant/weapp/toast/toast.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var validator_1 = require("../common/validator");
var defaultOptions = {
type: 'text',
mask: false,
message: '',
show: true,
zIndex: 1000,
duration: 2000,
position: 'middle',
forbidClick: false,
loadingType: 'circular',
selector: '#van-toast',
};
var queue = [];
var currentOptions = __assign({}, defaultOptions);
function parseOptions(message) {
return (0, validator_1.isObj)(message) ? message : { message: message };
}
function getContext() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
function Toast(toastOptions) {
var options = __assign(__assign({}, currentOptions), parseOptions(toastOptions));
var context = (typeof options.context === 'function'
? options.context()
: options.context) || getContext();
var toast = context.selectComponent(options.selector);
if (!toast) {
console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确');
return;
}
delete options.context;
delete options.selector;
toast.clear = function () {
toast.setData({ show: false });
if (options.onClose) {
options.onClose();
}
};
queue.push(toast);
toast.setData(options);
clearTimeout(toast.timer);
if (options.duration != null && options.duration > 0) {
toast.timer = setTimeout(function () {
toast.clear();
queue = queue.filter(function (item) { return item !== toast; });
}, options.duration);
}
return toast;
}
var createMethod = function (type) { return function (options) {
return Toast(__assign({ type: type }, parseOptions(options)));
}; };
Toast.loading = createMethod('loading');
Toast.success = createMethod('success');
Toast.fail = createMethod('fail');
Toast.clear = function () {
queue.forEach(function (toast) {
toast.clear();
});
queue = [];
};
Toast.setDefaultOptions = function (options) {
Object.assign(currentOptions, options);
};
Toast.resetDefaultOptions = function () {
currentOptions = __assign({}, defaultOptions);
};
exports.default = Toast;
================================================
FILE: miniprogram_npm/@vant/weapp/transition/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/transition/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var transition_1 = require("../mixins/transition");
(0, component_1.VantComponent)({
classes: [
'enter-class',
'enter-active-class',
'enter-to-class',
'leave-class',
'leave-active-class',
'leave-to-class',
],
mixins: [(0, transition_1.transition)(true)],
});
================================================
FILE: miniprogram_npm/@vant/weapp/transition/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/@vant/weapp/transition/index.wxml
================================================
================================================
FILE: miniprogram_npm/@vant/weapp/transition/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
function rootStyle(data) {
return style([
{
'-webkit-transition-duration': data.currentDuration + 'ms',
'transition-duration': data.currentDuration + 'ms',
},
data.display ? null : 'display: none',
data.customStyle,
]);
}
module.exports = {
rootStyle: rootStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/transition/index.wxss
================================================
@import '../common/index.wxss';.van-transition{transition-timing-function:ease}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-fade-down-enter-active,.van-fade-down-leave-active,.van-fade-left-enter-active,.van-fade-left-leave-active,.van-fade-right-enter-active,.van-fade-right-leave-active,.van-fade-up-enter-active,.van-fade-up-leave-active{transition-property:opacity,transform}.van-fade-up-enter,.van-fade-up-leave-to{opacity:0;transform:translate3d(0,100%,0)}.van-fade-down-enter,.van-fade-down-leave-to{opacity:0;transform:translate3d(0,-100%,0)}.van-fade-left-enter,.van-fade-left-leave-to{opacity:0;transform:translate3d(-100%,0,0)}.van-fade-right-enter,.van-fade-right-leave-to{opacity:0;transform:translate3d(100%,0,0)}.van-slide-down-enter-active,.van-slide-down-leave-active,.van-slide-left-enter-active,.van-slide-left-leave-active,.van-slide-right-enter-active,.van-slide-right-leave-active,.van-slide-up-enter-active,.van-slide-up-leave-active{transition-property:transform}.van-slide-up-enter,.van-slide-up-leave-to{transform:translate3d(0,100%,0)}.van-slide-down-enter,.van-slide-down-leave-to{transform:translate3d(0,-100%,0)}.van-slide-left-enter,.van-slide-left-leave-to{transform:translate3d(-100%,0,0)}.van-slide-right-enter,.van-slide-right-leave-to{transform:translate3d(100%,0,0)}
================================================
FILE: miniprogram_npm/@vant/weapp/tree-select/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/tree-select/index.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
(0, component_1.VantComponent)({
classes: [
'main-item-class',
'content-item-class',
'main-active-class',
'content-active-class',
'main-disabled-class',
'content-disabled-class',
],
props: {
items: {
type: Array,
observer: 'updateSubItems',
},
activeId: null,
mainActiveIndex: {
type: Number,
value: 0,
observer: 'updateSubItems',
},
height: {
type: null,
value: 300,
},
max: {
type: Number,
value: Infinity,
},
selectedIcon: {
type: String,
value: 'success',
},
},
data: {
subItems: [],
},
methods: {
// 当一个子项被选择时
onSelectItem: function (event) {
var item = event.currentTarget.dataset.item;
var isArray = Array.isArray(this.data.activeId);
// 判断有没有超出右侧选择的最大数
var isOverMax = isArray && this.data.activeId.length >= this.data.max;
// 判断该项有没有被选中, 如果有被选中,则忽视是否超出的条件
var isSelected = isArray
? this.data.activeId.indexOf(item.id) > -1
: this.data.activeId === item.id;
if (!item.disabled && (!isOverMax || isSelected)) {
this.$emit('click-item', item);
}
},
// 当一个导航被点击时
onClickNav: function (event) {
var index = event.detail;
var item = this.data.items[index];
if (!item.disabled) {
this.$emit('click-nav', { index: index });
}
},
// 更新子项列表
updateSubItems: function () {
var _a = this.data, items = _a.items, mainActiveIndex = _a.mainActiveIndex;
var _b = (items[mainActiveIndex] || {}).children, children = _b === void 0 ? [] : _b;
this.setData({ subItems: children });
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/tree-select/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-sidebar": "../sidebar/index",
"van-sidebar-item": "../sidebar-item/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/tree-select/index.wxml
================================================
{{ item.text }}
================================================
FILE: miniprogram_npm/@vant/weapp/tree-select/index.wxs
================================================
/* eslint-disable */
var array = require('../wxs/array.wxs');
function isActive (activeList, itemId) {
if (array.isArray(activeList)) {
return activeList.indexOf(itemId) > -1;
}
return activeList === itemId;
}
module.exports.isActive = isActive;
================================================
FILE: miniprogram_npm/@vant/weapp/tree-select/index.wxss
================================================
@import '../common/index.wxss';.van-tree-select{display:flex;font-size:var(--tree-select-font-size,14px);position:relative;-webkit-user-select:none;user-select:none}.van-tree-select__nav{--sidebar-padding:12px 8px 12px 12px;background-color:var(--tree-select-nav-background-color,#f7f8fa);flex:1}.van-tree-select__nav__inner{height:100%;width:100%!important}.van-tree-select__content{background-color:var(--tree-select-content-background-color,#fff);flex:2}.van-tree-select__item{font-weight:700;line-height:var(--tree-select-item-height,44px);padding:0 32px 0 var(--padding-md,16px);position:relative}.van-tree-select__item--active{color:var(--tree-select-item-active-color,#ee0a24)}.van-tree-select__item--disabled{color:var(--tree-select-item-disabled-color,#c8c9cc)}.van-tree-select__selected{position:absolute;right:var(--padding-md,16px);top:50%;transform:translateY(-50%)}
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/index.d.ts
================================================
export {};
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/index.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var validator_1 = require("../common/validator");
var shared_1 = require("./shared");
var utils_1 = require("./utils");
(0, component_1.VantComponent)({
props: __assign(__assign(__assign(__assign({ disabled: Boolean, multiple: Boolean, uploadText: String, useBeforeRead: Boolean, afterRead: null, beforeRead: null, previewSize: {
type: null,
value: 80,
}, name: {
type: null,
value: '',
}, accept: {
type: String,
value: 'image',
}, fileList: {
type: Array,
value: [],
observer: 'formatFileList',
}, maxSize: {
type: Number,
value: Number.MAX_VALUE,
}, maxCount: {
type: Number,
value: 100,
}, deletable: {
type: Boolean,
value: true,
}, showUpload: {
type: Boolean,
value: true,
}, previewImage: {
type: Boolean,
value: true,
}, previewFullImage: {
type: Boolean,
value: true,
}, videoFit: {
type: String,
value: 'contain',
}, imageFit: {
type: String,
value: 'scaleToFill',
}, uploadIcon: {
type: String,
value: 'photograph',
} }, shared_1.imageProps), shared_1.videoProps), shared_1.mediaProps), shared_1.messageFileProps),
data: {
lists: [],
isInCount: true,
},
methods: {
formatFileList: function () {
var _a = this.data, _b = _a.fileList, fileList = _b === void 0 ? [] : _b, maxCount = _a.maxCount;
var lists = fileList.map(function (item) { return (__assign(__assign({}, item), { isImage: (0, utils_1.isImageFile)(item), isVideo: (0, utils_1.isVideoFile)(item), deletable: (0, validator_1.isBoolean)(item.deletable) ? item.deletable : true })); });
this.setData({ lists: lists, isInCount: lists.length < maxCount });
},
getDetail: function (index) {
return {
name: this.data.name,
index: index == null ? this.data.fileList.length : index,
};
},
startUpload: function () {
var _this = this;
var _a = this.data, maxCount = _a.maxCount, multiple = _a.multiple, lists = _a.lists, disabled = _a.disabled;
if (disabled)
return;
(0, utils_1.chooseFile)(__assign(__assign({}, this.data), { maxCount: maxCount - lists.length }))
.then(function (res) {
_this.onBeforeRead(multiple ? res : res[0]);
})
.catch(function (error) {
_this.$emit('error', error);
});
},
onBeforeRead: function (file) {
var _this = this;
var _a = this.data, beforeRead = _a.beforeRead, useBeforeRead = _a.useBeforeRead;
var res = true;
if (typeof beforeRead === 'function') {
res = beforeRead(file, this.getDetail());
}
if (useBeforeRead) {
res = new Promise(function (resolve, reject) {
_this.$emit('before-read', __assign(__assign({ file: file }, _this.getDetail()), { callback: function (ok) {
ok ? resolve() : reject();
} }));
});
}
if (!res) {
return;
}
if ((0, validator_1.isPromise)(res)) {
res.then(function (data) { return _this.onAfterRead(data || file); });
}
else {
this.onAfterRead(file);
}
},
onAfterRead: function (file) {
var _a = this.data, maxSize = _a.maxSize, afterRead = _a.afterRead;
var oversize = Array.isArray(file)
? file.some(function (item) { return item.size > maxSize; })
: file.size > maxSize;
if (oversize) {
this.$emit('oversize', __assign({ file: file }, this.getDetail()));
return;
}
if (typeof afterRead === 'function') {
afterRead(file, this.getDetail());
}
this.$emit('after-read', __assign({ file: file }, this.getDetail()));
},
deleteItem: function (event) {
var index = event.currentTarget.dataset.index;
this.$emit('delete', __assign(__assign({}, this.getDetail(index)), { file: this.data.fileList[index] }));
},
onPreviewImage: function (event) {
if (!this.data.previewFullImage)
return;
var index = event.currentTarget.dataset.index;
var _a = this.data, lists = _a.lists, showmenu = _a.showmenu;
var item = lists[index];
wx.previewImage({
urls: lists.filter(function (item) { return (0, utils_1.isImageFile)(item); }).map(function (item) { return item.url; }),
current: item.url,
showmenu: showmenu,
fail: function () {
wx.showToast({ title: '预览图片失败', icon: 'none' });
},
});
},
onPreviewVideo: function (event) {
if (!this.data.previewFullImage)
return;
var index = event.currentTarget.dataset.index;
var lists = this.data.lists;
var sources = [];
var current = lists.reduce(function (sum, cur, curIndex) {
if (!(0, utils_1.isVideoFile)(cur)) {
return sum;
}
sources.push(__assign(__assign({}, cur), { type: 'video' }));
if (curIndex < index) {
sum++;
}
return sum;
}, 0);
wx.previewMedia({
sources: sources,
current: current,
fail: function () {
wx.showToast({ title: '预览视频失败', icon: 'none' });
},
});
},
onPreviewFile: function (event) {
if (!this.data.previewFile)
return;
var index = event.currentTarget.dataset.index;
wx.openDocument({
filePath: this.data.lists[index].url,
showMenu: true,
});
},
onClickPreview: function (event) {
var index = event.currentTarget.dataset.index;
var item = this.data.lists[index];
this.$emit('click-preview', __assign(__assign({}, item), this.getDetail(index)));
},
},
});
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/index.json
================================================
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index"
}
}
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/index.wxml
================================================
{{ item.name || item.url }}
{{ item.message }}
{{ uploadText }}
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/index.wxs
================================================
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function sizeStyle(data) {
return "Array" === data.previewSize.constructor ? style({
width: addUnit(data.previewSize[0]),
height: addUnit(data.previewSize[1]),
}) : style({
width: addUnit(data.previewSize),
height: addUnit(data.previewSize),
});
}
module.exports = {
sizeStyle: sizeStyle,
};
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/index.wxss
================================================
@import '../common/index.wxss';.van-uploader{display:inline-block;position:relative}.van-uploader__wrapper{display:flex;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{align-items:center;background-color:var(--uploader-upload-background-color,#f7f8fa);box-sizing:border-box;display:flex;flex-direction:column;height:var(--uploader-size,80px);justify-content:center;margin:0 8px 8px 0;position:relative;width:var(--uploader-size,80px)}.van-uploader__upload:active{background-color:var(--uploader-upload-active-color,#f2f3f5)}.van-uploader__upload-icon{color:var(--uploader-icon-color,#dcdee0);font-size:var(--uploader-icon-size,24px)}.van-uploader__upload-text{color:var(--uploader-text-color,#969799);font-size:var(--uploader-text-font-size,12px);margin-top:var(--padding-xs,8px)}.van-uploader__upload--disabled{opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{cursor:pointer;margin:0 8px 8px 0;position:relative}.van-uploader__preview-image{display:block;height:var(--uploader-size,80px);overflow:hidden;width:var(--uploader-size,80px)}.van-uploader__preview-delete,.van-uploader__preview-delete:after{height:var(--uploader-delete-icon-size,14px);position:absolute;right:0;top:0;width:var(--uploader-delete-icon-size,14px)}.van-uploader__preview-delete:after{background-color:var(--uploader-delete-background-color,rgba(0,0,0,.7));border-radius:0 0 0 12px;content:""}.van-uploader__preview-delete-icon{color:var(--uploader-delete-color,#fff);font-size:var(--uploader-delete-icon-size,14px);position:absolute;right:0;top:0;transform:scale(.7) translate(10%,-10%);z-index:1}.van-uploader__file{align-items:center;background-color:var(--uploader-file-background-color,#f7f8fa);display:flex;flex-direction:column;height:var(--uploader-size,80px);justify-content:center;width:var(--uploader-size,80px)}.van-uploader__file-icon{color:var(--uploader-file-icon-color,#646566);font-size:var(--uploader-file-icon-size,20px)}.van-uploader__file-name{box-sizing:border-box;color:var(--uploader-file-name-text-color,#646566);font-size:var(--uploader-file-name-font-size,12px);margin-top:var(--uploader-file-name-margin-top,8px);padding:var(--uploader-file-name-padding,0 4px);text-align:center;width:100%}.van-uploader__mask{align-items:center;background-color:var(--uploader-mask-background-color,rgba(50,50,51,.88));bottom:0;color:#fff;display:flex;flex-direction:column;justify-content:center;left:0;position:absolute;right:0;top:0}.van-uploader__mask-icon{font-size:var(--uploader-mask-icon-size,22px)}.van-uploader__mask-message{font-size:var(--uploader-mask-message-font-size,12px);line-height:var(--uploader-mask-message-line-height,14px);margin-top:6px;padding:0 var(--padding-base,4px)}.van-uploader__loading{color:var(--uploader-loading-icon-color,#fff)!important;height:var(--uploader-loading-icon-size,22px);width:var(--uploader-loading-icon-size,22px)}
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/shared.d.ts
================================================
export declare const imageProps: {
sizeType: {
type: ArrayConstructor;
value: string[];
};
capture: {
type: ArrayConstructor;
value: string[];
};
showmenu: {
type: BooleanConstructor;
value: boolean;
};
};
export declare const videoProps: {
capture: {
type: ArrayConstructor;
value: string[];
};
compressed: {
type: BooleanConstructor;
value: boolean;
};
maxDuration: {
type: NumberConstructor;
value: number;
};
camera: {
type: StringConstructor;
value: string;
};
referrerPolicy: {
type: StringConstructor;
value: string;
};
};
export declare const mediaProps: {
capture: {
type: ArrayConstructor;
value: string[];
};
mediaType: {
type: ArrayConstructor;
value: string[];
};
maxDuration: {
type: NumberConstructor;
value: number;
};
camera: {
type: StringConstructor;
value: string;
};
};
export declare const messageFileProps: {
extension: null;
previewFile: {
type: BooleanConstructor;
value: boolean;
};
};
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/shared.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.messageFileProps = exports.mediaProps = exports.videoProps = exports.imageProps = void 0;
// props for image
exports.imageProps = {
sizeType: {
type: Array,
value: ['original', 'compressed'],
},
capture: {
type: Array,
value: ['album', 'camera'],
},
showmenu: {
type: Boolean,
value: true,
},
};
// props for video
exports.videoProps = {
capture: {
type: Array,
value: ['album', 'camera'],
},
compressed: {
type: Boolean,
value: true,
},
maxDuration: {
type: Number,
value: 60,
},
camera: {
type: String,
value: 'back',
},
referrerPolicy: {
type: String,
value: 'no-referrer',
},
};
// props for media
exports.mediaProps = {
capture: {
type: Array,
value: ['album', 'camera'],
},
mediaType: {
type: Array,
value: ['image', 'video', 'mix'],
},
maxDuration: {
type: Number,
value: 60,
},
camera: {
type: String,
value: 'back',
},
};
// props for file
exports.messageFileProps = {
extension: null,
previewFile: {
type: Boolean,
value: true,
},
};
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/utils.d.ts
================================================
export interface File {
url: string;
size?: number;
name?: string;
type: string;
duration?: number;
time?: number;
isImage?: boolean;
isVideo?: boolean;
}
export declare function isImageFile(item: File): boolean;
export declare function isVideoFile(item: File): boolean;
export declare function chooseFile({ accept, multiple, capture, compressed, maxDuration, sizeType, camera, maxCount, mediaType, extension, }: {
accept: any;
multiple: any;
capture: any;
compressed: any;
maxDuration: any;
sizeType: any;
camera: any;
maxCount: any;
mediaType: any;
extension: any;
}): Promise;
================================================
FILE: miniprogram_npm/@vant/weapp/uploader/utils.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.chooseFile = exports.isVideoFile = exports.isImageFile = void 0;
var utils_1 = require("../common/utils");
var validator_1 = require("../common/validator");
function isImageFile(item) {
if (item.isImage != null) {
return item.isImage;
}
if (item.type) {
return item.type === 'image';
}
if (item.url) {
return (0, validator_1.isImageUrl)(item.url);
}
return false;
}
exports.isImageFile = isImageFile;
function isVideoFile(item) {
if (item.isVideo != null) {
return item.isVideo;
}
if (item.type) {
return item.type === 'video';
}
if (item.url) {
return (0, validator_1.isVideoUrl)(item.url);
}
return false;
}
exports.isVideoFile = isVideoFile;
function formatImage(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { type: 'image', url: item.tempFilePath || item.path, thumb: item.tempFilePath || item.path })); });
}
function formatVideo(res) {
return [
__assign(__assign({}, (0, utils_1.pickExclude)(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])), { type: 'video', url: res.tempFilePath, thumb: res.thumbTempFilePath }),
];
}
function formatMedia(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])), { type: item.fileType, url: item.tempFilePath, thumb: item.fileType === 'video' ? item.thumbTempFilePath : item.tempFilePath })); });
}
function formatFile(res) {
return res.tempFiles.map(function (item) { return (__assign(__assign({}, (0, utils_1.pickExclude)(item, ['path'])), { url: item.path })); });
}
function chooseFile(_a) {
var accept = _a.accept, multiple = _a.multiple, capture = _a.capture, compressed = _a.compressed, maxDuration = _a.maxDuration, sizeType = _a.sizeType, camera = _a.camera, maxCount = _a.maxCount, mediaType = _a.mediaType, extension = _a.extension;
return new Promise(function (resolve, reject) {
switch (accept) {
case 'image':
if (utils_1.isPC || utils_1.isWxWork) {
wx.chooseImage({
count: multiple ? Math.min(maxCount, 9) : 1,
sourceType: capture,
sizeType: sizeType,
success: function (res) { return resolve(formatImage(res)); },
fail: reject,
});
}
else {
wx.chooseMedia({
count: multiple ? Math.min(maxCount, 9) : 1,
mediaType: ['image'],
sourceType: capture,
maxDuration: maxDuration,
sizeType: sizeType,
camera: camera,
success: function (res) { return resolve(formatImage(res)); },
fail: reject,
});
}
break;
case 'media':
wx.chooseMedia({
count: multiple ? Math.min(maxCount, 9) : 1,
mediaType: mediaType,
sourceType: capture,
maxDuration: maxDuration,
sizeType: sizeType,
camera: camera,
success: function (res) { return resolve(formatMedia(res)); },
fail: reject,
});
break;
case 'video':
wx.chooseVideo({
sourceType: capture,
compressed: compressed,
maxDuration: maxDuration,
camera: camera,
success: function (res) { return resolve(formatVideo(res)); },
fail: reject,
});
break;
default:
wx.chooseMessageFile(__assign(__assign({ count: multiple ? maxCount : 1, type: accept }, (extension ? { extension: extension } : {})), { success: function (res) { return resolve(formatFile(res)); }, fail: reject }));
break;
}
});
}
exports.chooseFile = chooseFile;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/add-unit.wxs
================================================
/* eslint-disable */
var REGEXP = getRegExp('^-?\d+(\.\d+)?$');
function addUnit(value) {
if (value == null) {
return undefined;
}
return REGEXP.test('' + value) ? value + 'px' : value;
}
module.exports = addUnit;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/array.wxs
================================================
function isArray(array) {
return array && array.constructor === 'Array';
}
module.exports.isArray = isArray;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/bem.wxs
================================================
/* eslint-disable */
var array = require('./array.wxs');
var object = require('./object.wxs');
var PREFIX = 'van-';
function join(name, mods) {
name = PREFIX + name;
mods = mods.map(function(mod) {
return name + '--' + mod;
});
mods.unshift(name);
return mods.join(' ');
}
function traversing(mods, conf) {
if (!conf) {
return;
}
if (typeof conf === 'string' || typeof conf === 'number') {
mods.push(conf);
} else if (array.isArray(conf)) {
conf.forEach(function(item) {
traversing(mods, item);
});
} else if (typeof conf === 'object') {
object.keys(conf).forEach(function(key) {
conf[key] && mods.push(key);
});
}
}
function bem(name, conf) {
var mods = [];
traversing(mods, conf);
return join(name, mods);
}
module.exports = bem;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/memoize.wxs
================================================
/**
* Simple memoize
* wxs doesn't support fn.apply, so this memoize only support up to 2 args
*/
/* eslint-disable */
function isPrimitive(value) {
var type = typeof value;
return (
type === 'boolean' ||
type === 'number' ||
type === 'string' ||
type === 'undefined' ||
value === null
);
}
// mock simple fn.call in wxs
function call(fn, args) {
if (args.length === 2) {
return fn(args[0], args[1]);
}
if (args.length === 1) {
return fn(args[0]);
}
return fn();
}
function serializer(args) {
if (args.length === 1 && isPrimitive(args[0])) {
return args[0];
}
var obj = {};
for (var i = 0; i < args.length; i++) {
obj['key' + i] = args[i];
}
return JSON.stringify(obj);
}
function memoize(fn) {
var cache = {};
return function() {
var key = serializer(arguments);
if (cache[key] === undefined) {
cache[key] = call(fn, arguments);
}
return cache[key];
};
}
module.exports = memoize;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/object.wxs
================================================
/* eslint-disable */
var REGEXP = getRegExp('{|}|"', 'g');
function keys(obj) {
return JSON.stringify(obj)
.replace(REGEXP, '')
.split(',')
.map(function(item) {
return item.split(':')[0];
});
}
module.exports.keys = keys;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/style.wxs
================================================
/* eslint-disable */
var object = require('./object.wxs');
var array = require('./array.wxs');
function kebabCase(word) {
var newWord = word
.replace(getRegExp("[A-Z]", 'g'), function (i) {
return '-' + i;
})
.toLowerCase()
return newWord;
}
function style(styles) {
if (array.isArray(styles)) {
return styles
.filter(function (item) {
return item != null && item !== '';
})
.map(function (item) {
return style(item);
})
.join(';');
}
if ('Object' === styles.constructor) {
return object
.keys(styles)
.filter(function (key) {
return styles[key] != null && styles[key] !== '';
})
.map(function (key) {
return [kebabCase(key), [styles[key]]].join(':');
})
.join(';');
}
return styles;
}
module.exports = style;
================================================
FILE: miniprogram_npm/@vant/weapp/wxs/utils.wxs
================================================
/* eslint-disable */
var bem = require('./bem.wxs');
var memoize = require('./memoize.wxs');
var addUnit = require('./add-unit.wxs');
module.exports = {
bem: memoize(bem),
memoize: memoize,
addUnit: addUnit
};
================================================
FILE: miniprogram_npm/apifm-wxapi/index.js
================================================
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint-disable */
// 小程序开发api接口工具包,https://github.com/gooking/wxapi
var API_BASE_URL = 'https://api.it120.cc';
var COMMON_BASE_URL = 'https://common.apifm.com/';
var CMS_BASE_URL = 'https://cms.apifm.com/';
var subDomain = '-';
var merchantId = '0';
var request = function request(url, needSubDomain, method, data) {
var _url = API_BASE_URL + (needSubDomain ? '/' + subDomain : '') + url;
if (url.indexOf("http") == 0) {
_url = url;
}
var header = {
'Content-Type': 'application/x-www-form-urlencoded'
};
return new Promise(function (resolve, reject) {
wx.request({
url: _url,
method: method,
data: data,
header: header,
success: function success(request) {
resolve(request.data);
},
fail: function fail(error) {
reject(error);
},
complete: function complete(aaa) {
// 加载完成
}
});
});
};
/**
* 小程序的promise没有finally方法,自己扩展下
*/
// Promise.prototype.finally = function (callback) {
// var Promise = this.constructor;
// return this.then(
// function (value) {
// Promise.resolve(callback()).then(
// function () {
// return value;
// }
// );
// },
// function (reason) {
// Promise.resolve(callback()).then(
// function () {
// throw reason;
// }
// );
// }
// );
// }
module.exports = {
init2: function init2(a, b) {
API_BASE_URL = a;
subDomain = b;
},
init: function init(b) {
subDomain = b;
},
setMerchantId: function setMerchantId(mchid) {
merchantId = mchid;
},
init3: function init3(_ref) {
var _ref$apiBaseUrl = _ref.apiBaseUrl,
apiBaseUrl = _ref$apiBaseUrl === undefined ? API_BASE_URL : _ref$apiBaseUrl,
subD = _ref.subDomain,
req = _ref.request;
// 某些需求需要定制化 request,需要保证传入自定义 reuqest 与默认 request 参数一致
if (req) {
request = req;
}
API_BASE_URL = apiBaseUrl;
subDomain = subD;
},
request: request,
queryMobileLocation: function queryMobileLocation() {
var mobile = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/common/mobile-segment/location', false, 'get', { mobile: mobile });
},
nextMobileSegment: function nextMobileSegment(data) {
return request('/common/mobile-segment/next', false, 'post', data);
},
queryMobileLocationV2: function queryMobileLocationV2() {
var mobile = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request(COMMON_BASE_URL + subDomain + '/common/mobile-segment/location', false, 'get', { mobile: mobile });
},
nextMobileSegmentV2: function nextMobileSegmentV2(data) {
return request(COMMON_BASE_URL + subDomain + '/common/mobile-segment/next', false, 'post', data);
},
gpsDistance: function gpsDistance(data) {
return request('/common/map/qq/distance', false, 'post', data);
},
commonIP: function commonIP(ip) {
return request('/common/ip', false, 'get', { ip: ip });
},
commonIPV2: function commonIPV2() {
var ip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request(COMMON_BASE_URL + subDomain + '/common/ip', false, 'get', { ip: ip });
},
commonIPV3: function commonIPV3() {
var ip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request(COMMON_BASE_URL + subDomain + '/common/ip/v2', false, 'get', { ip: ip });
},
forexRate: function forexRate(fromCode, toCode) {
return request('/forex/rate', true, 'get', { fromCode: fromCode, toCode: toCode });
},
queryConfigValue: function queryConfigValue(key) {
return request(COMMON_BASE_URL + subDomain + '/config/value', true, 'get', { key: key });
},
queryConfigBatch: function queryConfigBatch(keys) {
return request(COMMON_BASE_URL + subDomain + '/config/values', true, 'get', { keys: keys });
},
scoreRules: function scoreRules(data) {
return request('/score/send/rule', true, 'post', data);
},
scoreSignRules: function scoreSignRules() {
return request('/score/sign/rules', true, 'get', {});
},
scoreSign: function scoreSign(token) {
return request('/score/sign', true, 'post', {
token: token
});
},
scoreSignLogs: function scoreSignLogs(data) {
return request('/score/sign/logs', true, 'post', data);
},
scoreTodaySignedInfo: function scoreTodaySignedInfo(token) {
return request('/score/today-signed', true, 'get', {
token: token
});
},
scoreExchange: function scoreExchange(token, number) {
return request('/score/exchange', true, 'post', {
number: number,
token: token
});
},
scoreExchangeCash: function scoreExchangeCash(token, deductionScore) {
return request(COMMON_BASE_URL + subDomain + '/score/exchange/cash', false, 'post', {
deductionScore: deductionScore,
token: token
});
},
scoreLogs: function scoreLogs(data) {
return request('/score/logs', true, 'post', data);
},
scoreDynamics: function scoreDynamics() {
return request('/score/dynamics', true, 'get');
},
shareGroupGetScore: function shareGroupGetScore(code, referrer, encryptedData, iv) {
return request('/score/share/wxa/group', true, 'post', {
code: code,
referrer: referrer,
encryptedData: encryptedData,
iv: iv
});
},
scoreDeductionRules: function scoreDeductionRules() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request(COMMON_BASE_URL + subDomain + '/score/deduction/rules', false, 'get', { type: type });
},
scoreDailyFixedNum: function scoreDailyFixedNum(token) {
return request('/score/dailyFixedNum', true, 'post', { token: token });
},
scoreRank: function scoreRank(data) {
return request('/score/rank', true, 'get', data);
},
scoreRankBydate: function scoreRankBydate(data) {
return request('/score/rankBydate', true, 'get', data);
},
scoreMyStatistics: function scoreMyStatistics(data) {
return request('/score/myStatistics', true, 'get', data);
},
expireScorestatistics: function expireScorestatistics(data) {
return request('/score/expireScorestatistics', true, 'post', data);
},
scoreTaskList: function scoreTaskList(token) {
return request(COMMON_BASE_URL + subDomain + '/score/taskList', false, 'get', { token: token });
},
scoreTaskSuccess: function scoreTaskSuccess(token, type) {
return request(COMMON_BASE_URL + subDomain + '/score/taskSuccess', false, 'post', { token: token, type: type });
},
kanjiaSet: function kanjiaSet(goodsId) {
return request('/shop/goods/kanjia/set/v2', true, 'get', { goodsId: goodsId });
},
kanjiaJoin: function kanjiaJoin(token, kjid) {
return request('/shop/goods/kanjia/join', true, 'post', {
kjid: kjid,
token: token
});
},
kanjiaDetail: function kanjiaDetail(kjid, joiner) {
return request('/shop/goods/kanjia/info', true, 'get', {
kjid: kjid,
joiner: joiner
});
},
kanjiaHelp: function kanjiaHelp(token, kjid, joiner) {
var remark = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/shop/goods/kanjia/help', true, 'post', {
kjid: kjid,
joinerUser: joiner,
token: token,
remark: remark
});
},
kanjiaClear: function kanjiaClear(token, kjid) {
return request('/shop/goods/kanjia/clear', true, 'post', {
kjid: kjid,
token: token
});
},
kanjiaMyJoinInfo: function kanjiaMyJoinInfo(token, kjid) {
return request('/shop/goods/kanjia/my', true, 'get', {
kjid: kjid,
token: token
});
},
kanjiaHelpDetail: function kanjiaHelpDetail(token, kjid, joiner) {
return request('/shop/goods/kanjia/myHelp', true, 'get', {
kjid: kjid,
joinerUser: joiner,
token: token
});
},
checkToken: function checkToken(token) {
return request('/user/check-token', true, 'get', {
token: token
});
},
checkReferrer: function checkReferrer(referrer) {
return request('/user/check-referrer', true, 'get', {
referrer: referrer
});
},
addTempleMsgFormid: function addTempleMsgFormid(token, type, formId) {
return request('/template-msg/wxa/formId', true, 'post', {
token: token, type: type, formId: formId
});
},
sendTempleMsg: function sendTempleMsg(data) {
return request('/template-msg/put', true, 'post', data);
},
payVariableUrl: function payVariableUrl(url, data) {
return request(url, true, 'post', data);
},
wxpay: function wxpay(data) {
return request('/pay/wx/wxapp', true, 'post', data);
},
wxpayH5: function wxpayH5(data) {
return request('/pay/wx/h5', true, 'post', data);
},
wxpayJsapi: function wxpayJsapi(data) {
return request('/pay/wx/jsapi', true, 'post', data);
},
wxpayQrcode: function wxpayQrcode(data) {
return request('/pay/wx/qrcode', true, 'post', data);
},
wxpayCode: function wxpayCode(data) {
return request('/pay/wx/paymentCode', true, 'post', data);
},
wxpayApp: function wxpayApp(data) {
return request('/pay/wx/app', true, 'post', data);
},
wxpayRequestMerchantTransfer: function wxpayRequestMerchantTransfer(data) {
return request('/pay/wx/requestMerchantTransfer', true, 'get', data);
},
wxpayFOMO: function wxpayFOMO(data) {
return request('/pay/fomo/wxapp', true, 'post', data);
},
payNow: function payNow(data) {
return request('/pay/fomo/payNow', true, 'post', data);
},
fomoCheckout: function fomoCheckout(data) {
return request('/pay/fomo/checkout', true, 'post', data);
},
wxpayFWS: function wxpayFWS(data) {
return request('/pay/wxfws/wxapp', true, 'post', data);
},
ttpay: function ttpay(data) {
return request('/pay/tt/microapp', true, 'post', data);
},
ttEcpay: function ttEcpay(data) {
return request('/pay/tt/ecpay', true, 'post', data);
},
payQuery: function payQuery(token, outTradeId) {
return request('/pay/query', true, 'get', { token: token, outTradeId: outTradeId });
},
wxpaySaobei: function wxpaySaobei(data) {
return request('/pay/lcsw/wxapp', true, 'post', data);
},
wxpayWepayez: function wxpayWepayez(data) {
return request('/pay/wepayez/wxapp', true, 'post', data);
},
wxpayxpert: function wxpayxpert(data) {
return request('/pay/payxpert/wxapp', true, 'post', data);
},
wxpayIPaynow: function wxpayIPaynow(data) {
return request('/pay/ipaynow/wxapp', true, 'post', data);
},
ccvvPayWxapp: function ccvvPayWxapp(data) {
return request('/pay/ccvv/wxapp', true, 'post', data);
},
wxpayAirwallex: function wxpayAirwallex(data) {
return request('/pay/airwallex/wxapp', true, 'post', data);
},
wxSphGetpaymentparams: function wxSphGetpaymentparams(token, orderId) {
return request('/pay/wxsph/getpaymentparams', true, 'post', { token: token, orderId: orderId });
},
paypalCheckout: function paypalCheckout(data) {
return request('/pay/paypal/checkout', true, 'post', data);
},
alipay: function alipay(data) {
return request('/pay/alipay/semiAutomatic/payurl', true, 'post', data);
},
alipayMP: function alipayMP(data) {
return request('/pay/alipay/gate/mp', true, 'post', data);
},
alipayAPP: function alipayAPP(data) {
return request('/pay/alipay/gate/app', true, 'post', data);
},
alipayQrcode: function alipayQrcode(data) {
return request('/pay/alipay/gate/qrcode', true, 'post', data);
},
alipayQrcode2: function alipayQrcode2(data) {
return request('/pay/alipay/gate/paymentCode', true, 'post', data);
},
alipayH5: function alipayH5(data) {
return request('/pay/alipay/gate/h5', true, 'post', data);
},
alipayPC: function alipayPC(data) {
return request('/pay/alipay/gate/pc', true, 'post', data);
},
kasipayH5: function kasipayH5(data) {
return request('/pay/kasipay/h5', true, 'post', data);
},
hmpayJsapi: function hmpayJsapi(data) {
return request('/pay/sandpay/hmpay/jsapi', true, 'post', data);
},
login_wx: function login_wx(code) {
return request('/user/wxapp/login', true, 'post', {
code: code,
type: 2
});
},
loginWxV2: function loginWxV2(code, appid) {
return request('/user/wxapp/login/v2', true, 'post', {
code: code,
appid: appid
});
},
login_tt: function login_tt(code) {
return request(COMMON_BASE_URL + subDomain + '/user/tt/miniapp/login', false, 'post', {
code: code
});
},
login_q: function login_q(code) {
return request(COMMON_BASE_URL + subDomain + '/user/q/login', false, 'post', {
code: code,
type: 2
});
},
loginWxaMobile: function loginWxaMobile(code, encryptedData, iv) {
return request('/user/wxapp/login/mobile', true, 'post', {
code: code,
encryptedData: encryptedData,
iv: iv
});
},
loginWxaMobileV2: function loginWxaMobileV2(data) {
return request('/user/wxapp/login/mobile', true, 'post', data);
},
loginWxaMobileV3: function loginWxaMobileV3(data) {
return request('/user/wxapp/login/mobile/v2', true, 'post', data);
},
fetchWxaMobile: function fetchWxaMobile(code) {
return request('/user/wxapp/getMobile', true, 'get', { code: code });
},
login_username: function login_username(data) {
return request('/user/username/login', true, 'post', data);
},
bindUsername: function bindUsername(token, username) {
var pwd = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/user/username/bindUsername', true, 'post', {
token: token, username: username, pwd: pwd
});
},
login_mobile: function login_mobile(mobile, pwd) {
var deviceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var deviceName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/m/login', true, 'post', {
mobile: mobile, pwd: pwd, deviceId: deviceId, deviceName: deviceName
});
},
loginMobileV2: function loginMobileV2(data) {
return request('/user/m/login', true, 'post', data);
},
loginMobileSmsCode: function loginMobileSmsCode(data) {
return request('/user/m/loginMobile', true, 'post', data);
},
resetPwdUseMobileCode: function resetPwdUseMobileCode(mobile, pwd, code) {
return request('/user/m/reset-pwd', true, 'post', {
mobile: mobile, pwd: pwd, code: code
});
},
resetPwdUseEmailCode: function resetPwdUseEmailCode(email, pwd, code) {
return request('/user/email/reset-pwd', true, 'post', {
email: email, pwd: pwd, code: code
});
},
wxmpAuth: function wxmpAuth(data) {
return request('/user/wxmp/auth', true, 'post', data);
},
register_complex: function register_complex(data) {
return request('/user/wxapp/register/complex', true, 'post', data);
},
register_tt: function register_tt(data) {
return request(COMMON_BASE_URL + subDomain + '/user/tt/miniapp/register', false, 'post', data);
},
registerQ: function registerQ(data) {
return request(COMMON_BASE_URL + subDomain + '/user/q/register', false, 'post', data);
},
qqAuthorize: function qqAuthorize(data) {
return request(COMMON_BASE_URL + subDomain + '/user/q/authorize', false, 'post', data);
},
qqQrcode: function qqQrcode(content) {
return request(COMMON_BASE_URL + subDomain + '/user/q/qrcode', false, 'post', { content: content });
},
register_simple: function register_simple(data) {
return request('/user/wxapp/register/simple', true, 'post', data);
},
authorize: function authorize(data) {
return request('/user/wxapp/authorize', true, 'post', data);
},
ttAuthorize: function ttAuthorize(data) {
return request(COMMON_BASE_URL + subDomain + '/user/tt/miniapp/authorize', false, 'post', data);
},
register_username: function register_username(data) {
return request('/user/username/register', true, 'post', data);
},
register_mobile: function register_mobile(data) {
return request('/user/m/register', true, 'post', data);
},
bannerTypes: function bannerTypes() {
return request('/banner/types', true, 'get');
},
banners: function banners(data) {
return request('/banner/list', true, 'get', data);
},
goodsCategory: function goodsCategory() {
return request('/shop/goods/category/all', true, 'get');
},
goodsCategoryV2: function goodsCategoryV2() {
var shopId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/shop/goods/category/all', true, 'get', { shopId: shopId });
},
goodsCategoryDetail: function goodsCategoryDetail(id) {
return request('/shop/goods/category/info', true, 'get', { id: id });
},
goodsCategoryDetailV2: function goodsCategoryDetailV2(data) {
return request('/shop/goods/category/info', true, 'get', data);
},
goods: function goods(data) {
if (!data) {
data = {};
}
var shopIds = wx.getStorageSync('shopIds');
if (shopIds) {
data.shopId = shopIds;
}
return request('/shop/goods/list', true, 'post', data);
},
goodsv2: function goodsv2(data) {
if (!data) {
data = {};
}
var shopIds = wx.getStorageSync('shopIds');
if (shopIds) {
data.shopId = shopIds;
}
return request('/shop/goods/list/v2', true, 'post', data);
},
goodsDetail: function goodsDetail(id) {
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/detail', true, 'get', {
id: id, token: token
});
},
goodsDetailV2: function goodsDetailV2(data) {
return request('/shop/goods/detail', true, 'get', data);
},
goodsLimitations: function goodsLimitations(goodsId) {
var priceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/limitation', true, 'get', {
goodsId: goodsId, priceId: priceId
});
},
goodsLimitationsV2: function goodsLimitationsV2(goodsId) {
var propertyChildIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/limitation', true, 'get', {
goodsId: goodsId, propertyChildIds: propertyChildIds
});
},
goodsAddition: function goodsAddition(goodsId) {
return request('/shop/goods/goodsAddition', true, 'get', {
goodsId: goodsId
});
},
goodsShopStores: function goodsShopStores(goodsId) {
return request('/shop/goods/goodsShopStores', true, 'get', {
goodsId: goodsId
});
},
goodsVideoEpisodesList: function goodsVideoEpisodesList(goodsId) {
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/goodsVideoEpisodes/list', true, 'get', {
goodsId: goodsId, token: token
});
},
goodsVideoEpisodesBuy: function goodsVideoEpisodesBuy(goodsId, number, token) {
return request('/goodsVideoEpisodes/buy', true, 'post', {
goodsId: goodsId, number: number, token: token
});
},
goodsStatistics: function goodsStatistics(data) {
return request('/shop/goods/statistics/days', true, 'post', data);
},
goodsUseless: function goodsUseless(data) {
return request('/shop/goods/useful', true, 'post', data);
},
pushNewGoods: function pushNewGoods(data) {
return request('/shop/goods/putOrUpdate', true, 'post', data);
},
mygoods: function mygoods(data) {
return request('/shop/goods/mygoods', true, 'post', data);
},
deleteMyGoods: function deleteMyGoods(token, id) {
return request('/shop/goods/del', true, 'post', { token: token, id: id });
},
goodsPrice: function goodsPrice(goodsId, propertyChildIds) {
return request('/shop/goods/price', true, 'post', {
goodsId: goodsId, propertyChildIds: propertyChildIds
});
},
goodsPriceV2: function goodsPriceV2(data) {
return request('/shop/goods/price', true, 'post', data);
},
goodsPriceDaily: function goodsPriceDaily(goodsId) {
var priceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/price/day', true, 'get', {
goodsId: goodsId, priceId: priceId
});
},
goodsPriceFreight: function goodsPriceFreight(data) {
return request('/shop/goods/price/freight', true, 'get', data);
},
goodsPriceMultilevels: function goodsPriceMultilevels(data) {
return request('/shop/goods/priceMultilevels', true, 'get', data);
},
goodsRebate: function goodsRebate(token, goodsId) {
return request(COMMON_BASE_URL + subDomain + '/shop/goods/rebate/v2', false, 'get', {
token: token, goodsId: goodsId
});
},
goodsReputation: function goodsReputation(data) {
return request('/shop/goods/reputation', true, 'post', data);
},
goodsReputationV2: function goodsReputationV2(data) {
return request('/shop/goods/reputation/v2', true, 'post', data);
},
myBuyGoodsHis: function myBuyGoodsHis(data) {
return request('/shop/goods/his/list', true, 'post', data);
},
myBuyGoodsHisDelete: function myBuyGoodsHisDelete(token) {
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var goodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/shop/goods/his/delete', true, 'post', {
token: token, id: id, goodsId: goodsId
});
},
myBuyGoodsHisV2: function myBuyGoodsHisV2(data) {
return request(COMMON_BASE_URL + subDomain + '/shop/goods/his/list', false, 'post', data);
},
myBuyGoodsHisDeleteV2: function myBuyGoodsHisDeleteV2(token) {
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var goodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request(COMMON_BASE_URL + subDomain + '/shop/goods/his/delete', false, 'post', {
token: token, id: id, goodsId: goodsId
});
},
goodsFavList: function goodsFavList(data) {
return request('/shop/goods/fav/list', true, 'post', data);
},
goodsFavListV2: function goodsFavListV2(data) {
return request('/shop/goods/fav/list/v2', true, 'post', data);
},
goodsFavPut: function goodsFavPut(token, goodsId) {
return request('/shop/goods/fav/add', true, 'post', {
token: token, goodsId: goodsId
});
},
goodsFavAdd: function goodsFavAdd(data) {
return request('/shop/goods/fav/add', true, 'post', data);
},
goodsFavCheck: function goodsFavCheck(token, goodsId) {
return request('/shop/goods/fav/check', true, 'get', {
token: token, goodsId: goodsId
});
},
goodsFavCheckV2: function goodsFavCheckV2(data) {
return request('/shop/goods/fav/check', true, 'get', data);
},
goodsFavDelete: function goodsFavDelete(token) {
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var goodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/shop/goods/fav/delete', true, 'post', {
token: token, id: id, goodsId: goodsId
});
},
goodsFavDeleteV2: function goodsFavDeleteV2(data) {
return request('/shop/goods/fav/delete', true, 'post', data);
},
goodsSeckillGrab: function goodsSeckillGrab(token, goodsId, seconds) {
return request('/goods/seckill/grab', true, 'post', { token: token, goodsId: goodsId, seconds: seconds });
},
coupons: function coupons(data) {
return request('/discounts/coupons', true, 'get', data);
},
couponDetail: function couponDetail(id) {
return request('/discounts/detail', true, 'get', {
id: id
});
},
couponStatistics: function couponStatistics(token) {
return request('/discounts/statistics', true, 'get', { token: token });
},
myCoupons: function myCoupons(data) {
return request('/discounts/my', true, 'get', data);
},
mergeCouponsRules: function mergeCouponsRules() {
return request('/discounts/merge/list', true, 'get');
},
mergeCoupons: function mergeCoupons(data) {
return request('/discounts/merge', true, 'post', data);
},
fetchCoupons: function fetchCoupons(data) {
return request('/discounts/fetch', true, 'post', data);
},
sendCoupons: function sendCoupons(data) {
return request('/discounts/send', true, 'post', data);
},
exchangeCoupons: function exchangeCoupons(token, number, pwd) {
var extJsonStr = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/discounts/exchange', true, 'post', {
token: token, number: number, pwd: pwd, extJsonStr: extJsonStr
});
},
couponsShareOpen: function couponsShareOpen(token, id) {
return request('/discounts/share/open', true, 'post', { token: token, id: id });
},
couponsShareClose: function couponsShareClose(token, id) {
return request('/discounts/share/close', true, 'post', { token: token, id: id });
},
couponsShareFetch: function couponsShareFetch(token, id, shareToken) {
return request('/discounts/share/fetch', true, 'post', { token: token, id: id, shareToken: shareToken });
},
couponsHX: function couponsHX(data) {
return request('/discounts/hx', true, 'post', data);
},
noticeList: function noticeList(data) {
return request('/notice/list', true, 'post', data);
},
noticeLastOne: function noticeLastOne() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/notice/last-one', true, 'get', {
type: type
});
},
noticeDetail: function noticeDetail(id) {
return request('/notice/detail', true, 'get', {
id: id
});
},
addAddress: function addAddress(data) {
return request(COMMON_BASE_URL + subDomain + '/user/shipping-address/add', false, 'post', data);
},
updateAddress: function updateAddress(data) {
return request(COMMON_BASE_URL + subDomain + '/user/shipping-address/update', false, 'post', data);
},
deleteAddress: function deleteAddress(token, id) {
return request(COMMON_BASE_URL + subDomain + '/user/shipping-address/delete', false, 'post', {
id: id,
token: token
});
},
queryAddress: function queryAddress(token) {
return request('/user/shipping-address/list', true, 'get', {
token: token
});
},
queryAddressV2: function queryAddressV2(data) {
return request(COMMON_BASE_URL + subDomain + '/user/shipping-address/list/v2', false, 'post', data);
},
defaultAddress: function defaultAddress(token) {
return request(COMMON_BASE_URL + subDomain + '/user/shipping-address/default/v2', false, 'get', {
token: token
});
},
addressDetail: function addressDetail(token, id) {
return request(COMMON_BASE_URL + subDomain + '/user/shipping-address/detail/v2', false, 'get', {
id: id,
token: token
});
},
pingtuanSet: function pingtuanSet(goodsId) {
return request('/shop/goods/pingtuan/set', true, 'get', {
goodsId: goodsId
});
},
pingtuanSets: function pingtuanSets(goodsIdArray) {
return request('/shop/goods/pingtuan/sets', true, 'get', {
goodsId: goodsIdArray.join()
});
},
goodsDefaultPingtuan: function goodsDefaultPingtuan(goodsId) {
return request('/shop/goods/pingtuan/default', true, 'get', {
goodsId: goodsId
});
},
pingtuanMultilevel: function pingtuanMultilevel(goodsId) {
return request('/shop/goods/pingtuanMultilevel', true, 'get', {
goodsId: goodsId
});
},
pingtuanOpen: function pingtuanOpen(token, goodsId) {
var extJsonStr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/shop/goods/pingtuan/open', true, 'post', {
goodsId: goodsId,
token: token,
extJsonStr: extJsonStr
});
},
pingtuanTuanInfo: function pingtuanTuanInfo(tuanId) {
return request('/shop/goods/pingtuan/tuanInfo', true, 'get', {
tuanId: tuanId
});
},
pingtuanList: function pingtuanList(data) {
return request('/shop/goods/pingtuan/list/v2', true, 'post', data);
},
pingtuanJoinUsers: function pingtuanJoinUsers(tuanId) {
return request('/shop/goods/pingtuan/joiner', true, 'get', { tuanId: tuanId });
},
pingtuanMyJoined: function pingtuanMyJoined(data) {
return request('/shop/goods/pingtuan/my-join-list', true, 'post', data);
},
friendlyPartnerList: function friendlyPartnerList() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/friendly-partner/list', true, 'post', {
type: type
});
},
friendList: function friendList(data) {
return request('/user/friend/list', true, 'post', data);
},
addFriend: function addFriend(token, uid) {
return request('/user/friend/add', true, 'post', { token: token, uid: uid });
},
deleteFriend: function deleteFriend(token, uid) {
return request('/user/friend/delete', true, 'post', { token: token, uid: uid });
},
friendUserDetail: function friendUserDetail(token, uid) {
return request('/user/friend/detail', true, 'get', { token: token, uid: uid });
},
userImList: function userImList(data) {
return request('/userIm/list', true, 'post', data);
},
userImSendmessage: function userImSendmessage(token, uid, content) {
return request('/userIm/sendmessage', true, 'post', { token: token, uid: uid, content: content });
},
userImEmpty: function userImEmpty(token, uid) {
return request('/userIm/empty', true, 'post', { token: token, uid: uid });
},
videoDetail: function videoDetail(videoId) {
return request(COMMON_BASE_URL + subDomain + '/media/video/detail', false, 'get', {
videoId: videoId
});
},
bindMobileWxa: function bindMobileWxa(token, encryptedData, iv) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/wxapp/bindMobile', true, 'post', {
token: token, encryptedData: encryptedData, iv: iv, pwd: pwd
});
},
bindMobileWxapp: function bindMobileWxapp(token, code, encryptedData, iv) {
var pwd = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
return request('/user/wxapp/bindMobile', true, 'post', {
token: token, code: code, encryptedData: encryptedData, iv: iv, pwd: pwd
});
},
bindMobileWxappV2: function bindMobileWxappV2(token, code) {
var pwd = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/user/wxapp/bindMobile/v2', true, 'post', {
token: token, code: code, pwd: pwd
});
},
bindMobileTta: function bindMobileTta(token, encryptedData, iv) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request(COMMON_BASE_URL + subDomain + '/user/tt/miniapp/bindMobile', false, 'post', {
token: token, encryptedData: encryptedData, iv: iv, pwd: pwd
});
},
bindMobileSms: function bindMobileSms(token, mobile, code) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/m/bind-mobile', true, 'post', {
token: token, mobile: mobile, code: code, pwd: pwd
});
},
userDetail: function userDetail(token) {
return request('/user/detail', true, 'get', {
token: token
});
},
randomNick: function randomNick() {
var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/user/randomNick', true, 'get', {
len: len
});
},
userDetailSpreadUser: function userDetailSpreadUser(token, uid) {
return request('/user/detail/spreadUser', true, 'get', {
token: token, uid: uid
});
},
userWxinfo: function userWxinfo(token) {
return request('/user/wxinfo', true, 'get', {
token: token
});
},
userAliappInfo: function userAliappInfo(token) {
return request('/user/aliappInfo', true, 'get', {
token: token
});
},
userAmount: function userAmount(token) {
return request('/user/amount', true, 'get', {
token: token
});
},
userAmountV2: function userAmountV2(token) {
return request(COMMON_BASE_URL + subDomain + '/user/amount', false, 'get', {
token: token
});
},
orderCreate: function orderCreate(data) {
return request('/order/create', true, 'post', data);
},
orderList: function orderList(data) {
return request('/order/list', true, 'post', data);
},
orderDetail: function orderDetail(token, id) {
var hxNumber = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var peisongOrderId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/order/detail', true, 'get', {
id: id,
token: token,
hxNumber: hxNumber,
peisongOrderId: peisongOrderId
});
},
orderMtLocation: function orderMtLocation(id) {
return request('/order/mtlocation', true, 'get', {
id: id
});
},
orderDelivery: function orderDelivery(token, orderId) {
return request('/order/delivery', true, 'post', {
orderId: orderId,
token: token
});
},
orderReputation: function orderReputation(data) {
return request('/order/reputation', true, 'post', data);
},
orderReputationList: function orderReputationList(data) {
return request('/order/listReputation', true, 'post', data);
},
orderReputationDelete: function orderReputationDelete(data) {
return request('/order/reputation/delete', true, 'post', data);
},
orderReputationModify: function orderReputationModify(data) {
return request('/order/reputation/modify', true, 'post', data);
},
orderClose: function orderClose(token, orderId) {
return request('/order/close', true, 'post', {
orderId: orderId,
token: token
});
},
orderCloseV2: function orderCloseV2(data) {
return request('/order/close', true, 'post', data);
},
orderDelete: function orderDelete(token, orderId) {
return request('/order/delete', true, 'post', {
orderId: orderId,
token: token
});
},
orderPay: function orderPay(token, orderId) {
return request('/order/pay', true, 'post', {
orderId: orderId,
token: token
});
},
orderPayV2: function orderPayV2(data) {
return request('/order/pay', true, 'post', data);
},
jdjlOrderPay: function jdjlOrderPay(token, _token) {
var couponId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/jdjl/payOrder', true, 'post', {
_token: _token,
token: token,
couponId: couponId
});
},
orderHX: function orderHX(hxNumber) {
return request('/order/hx', true, 'post', {
hxNumber: hxNumber
});
},
orderHXV2: function orderHXV2(data) {
return request('/order/hx', true, 'post', data);
},
orderSet: function orderSet() {
return request('/order/set', true, 'get');
},
orderRefunds: function orderRefunds(token, orderId) {
return request('/order/refund', true, 'get', {
token: token,
orderId: orderId
});
},
withDrawApply: function withDrawApply(token, money) {
return request('/user/withDraw/apply', true, 'post', {
money: money,
token: token
});
},
withDrawApplyV2: function withDrawApplyV2(data) {
return request('/user/withDraw/apply', true, 'post', data);
},
withDrawDetail: function withDrawDetail(token, id) {
return request('/user/withDraw/detail', true, 'get', {
token: token,
id: id
});
},
withDrawLogs: function withDrawLogs(data) {
return request('/user/withDraw/list', true, 'post', data);
},
withDrawSetting: function withDrawSetting() {
return request('/user/withDraw/setting', true, 'get');
},
withDrawApplyV3: function withDrawApplyV3(data) {
return request(COMMON_BASE_URL + subDomain + '/user/withdrawal/apply', true, 'post', data);
},
withDrawDetailV2: function withDrawDetailV2(data) {
return request(COMMON_BASE_URL + subDomain + '/user/withdrawal/detail', true, 'get', data);
},
withDrawLogsV2: function withDrawLogsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/user/withdrawal/list', true, 'post', data);
},
withDrawSettingV2: function withDrawSettingV2() {
return request(COMMON_BASE_URL + subDomain + '/user/withdrawal/setting', true, 'get');
},
wxpayRequestMerchantTransferV2: function wxpayRequestMerchantTransferV2(data) {
return request(COMMON_BASE_URL + subDomain + '/user/withdrawal/requestMerchantTransfer', true, 'get', data);
},
province: function province() {
return request('/common/region/v2/province', false, 'get');
},
city: function city() {
return request('/common/region/v2/city', false, 'get');
},
districts: function districts() {
return request('/common/region/v2/districts', false, 'get');
},
streets: function streets() {
return request('/common/region/v2/streets', false, 'get');
},
nextRegion: function nextRegion(pid) {
return request('/common/region/v2/child', false, 'get', {
pid: pid
});
},
regionInfo: function regionInfo(id) {
return request('/common/region/v2/info', false, 'get', {
id: id
});
},
regionInfoBatch: function regionInfoBatch(ids) {
return request('/common/region/v2/infoBatch', false, 'get', {
ids: ids
});
},
regionSearch: function regionSearch(data) {
return request('/common/region/v2/search', false, 'post', data);
},
provinceV2: function provinceV2() {
return request(COMMON_BASE_URL + subDomain + '/region/province', false, 'get');
},
cityV2: function cityV2() {
return request(COMMON_BASE_URL + subDomain + '/region/city', false, 'get');
},
districtsV2: function districtsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/region/districts', false, 'post', data);
},
streetsV2: function streetsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/region/streets', false, 'post', data);
},
nextRegionV2: function nextRegionV2(pid) {
return request(COMMON_BASE_URL + subDomain + '/region/child', false, 'get', { pid: pid });
},
regionInfoV2: function regionInfoV2(id) {
return request(COMMON_BASE_URL + subDomain + '/region/info', false, 'get', { id: id });
},
regionInfoBatchV2: function regionInfoBatchV2(ids) {
return request(COMMON_BASE_URL + subDomain + '/region/infoBatch', false, 'get', { ids: ids });
},
regionSearchV2: function regionSearchV2(data) {
return request(COMMON_BASE_URL + subDomain + '/region/search', false, 'post', data);
},
regionAnalysis: function regionAnalysis(address) {
return request(COMMON_BASE_URL + subDomain + '/region/analysis', false, 'post', { address: address });
},
cashLogs: function cashLogs(data) {
return request('/user/cashLog', true, 'post', data);
},
cashLogsV2: function cashLogsV2(data) {
return request('/user/cashLog/v2', true, 'post', data);
},
cashLogsV3: function cashLogsV3(data) {
return request(COMMON_BASE_URL + subDomain + '/user/cashLog/v2', false, 'post', data);
},
statisticsComingOut: function statisticsComingOut(data) {
return request('/user/statisticsComingOut', true, 'post', data);
},
statisticsComingOutV2: function statisticsComingOutV2(data) {
return request(COMMON_BASE_URL + subDomain + '/user/statisticsComingOut', false, 'post', data);
},
payLogs: function payLogs(data) {
return request('/user/payLogs', true, 'post', data);
},
rechargeSendRules: function rechargeSendRules() {
return request('/user/recharge/send/rule', true, 'get');
},
payBillDiscounts: function payBillDiscounts() {
return request('/payBill/discounts', true, 'get');
},
payBill: function payBill(token, money) {
var pwd = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/payBill/pay', true, 'post', { token: token, money: money, pwd: pwd });
},
payBillV2: function payBillV2(data) {
return request('/payBill/pay', true, 'post', data);
},
vipLevel: function vipLevel() {
return request('/config/vipLevel', true, 'get');
},
fxApply: function fxApply(token, name, mobile) {
return request('/saleDistribution/apply', true, 'post', { token: token, name: name, mobile: mobile });
},
fxApplyV2: function fxApplyV2(data) {
return request('/saleDistribution/apply/v2', true, 'post', data);
},
fxSetting: function fxSetting() {
return request(COMMON_BASE_URL + subDomain + '/saleDistribution/setting', true, 'get');
},
fxBuy: function fxBuy(token) {
return request('/saleDistribution/buy', true, 'post', { token: token });
},
fxApplyProgress: function fxApplyProgress(token) {
return request('/saleDistribution/apply/progress', true, 'get', { token: token });
},
fxApplyProgressV2: function fxApplyProgressV2(token) {
return request('/saleDistribution/apply/progress/v2', true, 'get', { token: token });
},
fxMembers: function fxMembers(data) {
return request('/saleDistribution/members', true, 'post', data);
},
fxCommisionLog: function fxCommisionLog(data) {
return request('/saleDistribution/commision/log', true, 'post', data);
},
fxCommisionFreezeAmount: function fxCommisionFreezeAmount(token) {
return request('/saleDistribution/commission/freeze', true, 'get', { token: token });
},
fxSaleroomRankTotal: function fxSaleroomRankTotal(page, pageSize) {
return request('/saleDistribution/sale-room-rank/total', true, 'get', {
page: page, pageSize: pageSize
});
},
fxSaleroomRankTotalTeam: function fxSaleroomRankTotalTeam(page, pageSize) {
return request('/saleDistribution/sale-room-rank/team/total', true, 'get', {
page: page, pageSize: pageSize
});
},
fxSaleroomRankDaily: function fxSaleroomRankDaily(page, pageSize, day) {
return request(COMMON_BASE_URL + subDomain + '/saleDistribution/sale-room-rank/daily', false, 'get', {
page: page, pageSize: pageSize, day: day
});
},
fxStatisticsDays: function fxStatisticsDays(data) {
return request(COMMON_BASE_URL + subDomain + '/saleDistribution/statistics/days', false, 'get', data);
},
fxUpgrade: function fxUpgrade(token) {
return request(COMMON_BASE_URL + subDomain + '/saleDistribution/upgrade', false, 'post', { token: token });
},
fxMembersStatistics: function fxMembersStatistics(token) {
return request('/saleDistribution/members/statistics', true, 'get', { token: token });
},
fxMyCommisionStatistics: function fxMyCommisionStatistics(token, days) {
return request(COMMON_BASE_URL + subDomain + '/saleDistribution/my/commision', false, 'get', { token: token, days: days });
},
fxGoods: function fxGoods(data) {
return request('/saleDistribution/goods', true, 'post', data);
},
fxTeamReport: function fxTeamReport(data) {
return request('/saleDistribution/team/report', true, 'post', data);
},
fxCities: function fxCities(token) {
return request('/saleDistribution/city/list', true, 'get', { token: token });
},
fxCityReport: function fxCityReport(data) {
return request('/saleDistribution/city/report', true, 'post', data);
},
goodsSellNumberStatistics: function goodsSellNumberStatistics(page, pageSize) {
var goodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request(COMMON_BASE_URL + subDomain + '/site/goods/statistics', false, 'get', {
page: page, pageSize: pageSize, goodsId: goodsId
});
},
wxaQrcode: function wxaQrcode(data) {
return request('https://oss.apifm.com/' + subDomain + '/qrcode/wxa/unlimit', true, 'post', data);
},
ttaQrcode: function ttaQrcode(paramsJson, expireHours) {
return request(COMMON_BASE_URL + subDomain + '/user/tt/miniapp/qrcode', false, 'post', {
content: JSON.stringify(paramsJson),
expireHours: expireHours
});
},
commonQrcode: function commonQrcode(data) {
return request('https://oss.apifm.com/' + subDomain + '/qrcode/content', true, 'post', data);
},
uploadFile: function uploadFile(token, tempFilePath) {
var expireHours = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var uploadUrl = API_BASE_URL + '/' + subDomain + '/dfs/upload/file';
return new Promise(function (resolve, reject) {
wx.uploadFile({
url: uploadUrl,
filePath: tempFilePath,
name: 'upfile',
formData: {
'token': token,
expireHours: expireHours
},
success: function success(res) {
resolve(JSON.parse(res.data));
},
fail: function fail(error) {
reject(error);
},
complete: function complete(aaa) {
// 加载完成
}
});
});
},
uploadFileV2: function uploadFileV2(token, tempFilePath) {
var expireHours = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return new Promise(function (resolve, reject) {
wx.uploadFile({
url: 'https://oss.apifm.com/upload2',
filePath: tempFilePath,
name: 'upfile',
formData: {
token: token,
subDomain: subDomain,
expireHours: expireHours
},
success: function success(res) {
resolve(JSON.parse(res.data));
},
fail: function fail(error) {
reject(error);
},
complete: function complete(aaa) {
// 加载完成
}
});
});
},
uploadFileV22: function uploadFileV22(token, tempFilePath) {
var expireHours = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return new Promise(function (resolve, reject) {
tt.uploadFile({
url: 'https://dfs.apifm.com/upload2',
filePath: tempFilePath,
name: 'upfile',
formData: {
token: token,
subDomain: subDomain,
expireHours: expireHours
},
success: function success(res) {
resolve(JSON.parse(res.data));
},
fail: function fail(error) {
reject(error);
},
complete: function complete(aaa) {
// 加载完成
}
});
});
},
uploadFileFromUrl: function uploadFileFromUrl() {
var remoteFileUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var ext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/dfs/upload/url', true, 'post', { remoteFileUrl: remoteFileUrl, ext: ext });
},
uploadFileFromUrlV2: function uploadFileFromUrlV2(data) {
var _data = Object.assign(data, { subDomain: subDomain });
return request('https://oss.apifm.com/uploadByUrl', false, 'post', _data);
},
uploadFileFromUrlV22: function uploadFileFromUrlV22(data) {
var _data = Object.assign(data, { subDomain: subDomain });
return request('https://dfs.apifm.com/uploadByUrl', false, 'post', _data);
},
uploadFileList: function uploadFileList() {
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/dfs/upload/list', true, 'post', { path: path });
},
uploadFileListV2: function uploadFileListV2(data) {
return request('/dfs/upload/list/v2', true, 'post', data);
},
galleryList: function galleryList(data) {
return request('/dfs/gallery', true, 'post', data);
},
refundApply: function refundApply(data) {
return request('/order/refundApply/apply', true, 'post', data);
},
refundApplyDetail: function refundApplyDetail(token, orderId) {
var orderGoodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/order/refundApply/info', true, 'get', {
token: token,
orderId: orderId,
orderGoodsId: orderGoodsId
});
},
refundApplyCancel: function refundApplyCancel(token, orderId) {
var orderGoodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/order/refundApply/cancel', true, 'post', {
token: token,
orderId: orderId,
orderGoodsId: orderGoodsId
});
},
refundApplySetBackLogistics: function refundApplySetBackLogistics(data) {
return request('/order/refundApply/setBackLogistics', true, 'post', data);
},
cmsCategories: function cmsCategories() {
return request(COMMON_BASE_URL + subDomain + '/cms/category/list', false, 'get', {});
},
cmsCategoryDetail: function cmsCategoryDetail(id) {
return request(COMMON_BASE_URL + subDomain + '/cms/category/info', false, 'get', { id: id });
},
cmsArticles: function cmsArticles(data) {
return request('/cms/news/list', true, 'post', data);
},
cmsArticlesV2: function cmsArticlesV2(data) {
return request('/cms/news/list/v2', true, 'post', data);
},
cmsArticlesV3: function cmsArticlesV3(data) {
return request(CMS_BASE_URL + merchantId + '/cms/news/list/v2', true, 'post', data);
},
cmsArticleUsefulLogs: function cmsArticleUsefulLogs(data) {
return request(CMS_BASE_URL + merchantId + '/cms/news/useful/logs', false, 'post', data);
},
cmsArticleDetail: function cmsArticleDetail(id) {
return request('/cms/news/detail', true, 'get', { id: id });
},
cmsArticleDetailV2: function cmsArticleDetailV2(id) {
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/cms/news/detail/v2', true, 'get', { id: id, token: token });
},
cmsArticleDetailV3: function cmsArticleDetailV3(data) {
return request(CMS_BASE_URL + merchantId + '/cms/news/detail/v2', true, 'get', data);
},
cmsArticlePreNext: function cmsArticlePreNext(id) {
return request('/cms/news/preNext', true, 'get', { id: id });
},
cmsArticlePreNextV2: function cmsArticlePreNextV2(id) {
return request(CMS_BASE_URL + merchantId + '/cms/news/preNext', true, 'get', { id: id });
},
cmsArticleCreate: function cmsArticleCreate(data) {
return request('/cms/news/put', true, 'post', data);
},
cmsArticleCreateV2: function cmsArticleCreateV2(data) {
return request(CMS_BASE_URL + merchantId + '/cms/news/put', true, 'post', data);
},
cmsArticleDelete: function cmsArticleDelete(token, id) {
return request('/cms/news/del', true, 'post', { token: token, id: id });
},
cmsArticleDeleteV2: function cmsArticleDeleteV2(token, id) {
return request(CMS_BASE_URL + merchantId + '/cms/news/del', true, 'post', { token: token, id: id });
},
cmsArticleUseless: function cmsArticleUseless(data) {
return request(CMS_BASE_URL + merchantId + '/cms/news/useful', false, 'post', data);
},
cmsArticleModifyExtNumber: function cmsArticleModifyExtNumber(data) {
return request('/cms/news/modifyExtNumber', true, 'post', data);
},
cmsArticleModifyExtNumberV2: function cmsArticleModifyExtNumberV2(data) {
return request(CMS_BASE_URL + merchantId + '/cms/news/modifyExtNumber', true, 'post', data);
},
newsOwnerUserViewStatistics: function newsOwnerUserViewStatistics(data) {
return request('/newsOwnerUserViewStatistics/list', true, 'post', data);
},
cmsPage: function cmsPage(key) {
return request(COMMON_BASE_URL + subDomain + '/cms/page/info/v2', true, 'get', { key: key });
},
cmsTags: function cmsTags() {
return request('/cms/tags/list', true, 'get', {});
},
cmsTagsV2: function cmsTagsV2(data) {
return request(CMS_BASE_URL + merchantId + '/newsTag/list', true, 'post', data);
},
cmsNewsSignUsers: function cmsNewsSignUsers(data) {
return request('/newsSign/signUsers', true, 'post', data);
},
cmsNewsSignOnline: function cmsNewsSignOnline(data) {
return request('/newsSign/signOnline', true, 'post', data);
},
cmsNewsSignOffline: function cmsNewsSignOffline(data) {
return request('/newsSign/signOffline', true, 'post', data);
},
cmsNewsSignCheck: function cmsNewsSignCheck(token, newsId) {
return request('/newsSign/check', true, 'get', { token: token, newsId: newsId });
},
invoiceList: function invoiceList(data) {
return request('/invoice/list', true, 'post', data);
},
invoiceApply: function invoiceApply(data) {
return request('/invoice/apply', true, 'post', data);
},
invoiceDetail: function invoiceDetail(token, id) {
return request('/invoice/info', true, 'get', { token: token, id: id });
},
depositList: function depositList(data) {
return request('/deposit/list', true, 'post', data);
},
payDeposit: function payDeposit(data) {
return request('/deposit/pay', true, 'post', data);
},
depositInfo: function depositInfo(token, id) {
return request('/deposit/info', true, 'get', { token: token, id: id });
},
depositBackApply: function depositBackApply(token, id) {
return request('/deposit/back/apply', true, 'post', { token: token, id: id });
},
depositListV2: function depositListV2(data) {
return request(COMMON_BASE_URL + subDomain + '/deposit/list', false, 'post', data);
},
payDepositV2: function payDepositV2(data) {
return request(COMMON_BASE_URL + subDomain + '/deposit/pay', false, 'post', data);
},
payStatusDepositV2: function payStatusDepositV2(data) {
return request(COMMON_BASE_URL + subDomain + '/deposit/payStatus', false, 'post', data);
},
depositInfoV2: function depositInfoV2(token, id) {
return request(COMMON_BASE_URL + subDomain + '/deposit/info', false, 'get', { token: token, id: id });
},
depositBackApplyV2: function depositBackApplyV2(token, id) {
return request(COMMON_BASE_URL + subDomain + '/deposit/back/apply', false, 'post', { token: token, id: id });
},
shopAreaCities: function shopAreaCities() {
return request('/shopArea/cities', true, 'get');
},
shopAreaList: function shopAreaList(data) {
return request('/shopArea/list', true, 'post', data);
},
shopAreaDetail: function shopAreaDetail(id) {
return request('/shopArea/detail', true, 'get', { id: id });
},
fetchShopsCities: function fetchShopsCities() {
return request('/shop/subshop/cities', true, 'get');
},
fetchShops: function fetchShops(data) {
return request('/shop/subshop/list', true, 'post', data);
},
fetchShopsV2: function fetchShopsV2(data) {
return request('/shop/subshop/list/v2', true, 'post', data);
},
fetchMyShops: function fetchMyShops(token) {
return request('/shop/subshop/my', true, 'get', { token: token });
},
shopSubdetail: function shopSubdetail(id) {
return request('/shop/subshop/detail/v2', true, 'get', { id: id });
},
shopSubApply: function shopSubApply(data) {
return request('/shop/subshop/apply', true, 'post', data);
},
pickPoints: function pickPoints(data) {
return request('/shop/subshop/pickPoints', true, 'post', data);
},
shopReputationList: function shopReputationList(data) {
return request('/shop/subshop/listReputation', true, 'post', data);
},
shopPicList: function shopPicList(data) {
return request('/shop/subshop/shopPics', true, 'post', data);
},
shopFavPut: function shopFavPut(token, shopId) {
return request('/shop/fav/add', true, 'post', { token: token, shopId: shopId });
},
shopFavCheck: function shopFavCheck(token, shopId) {
return request('/shop/fav/check', true, 'get', { token: token, shopId: shopId });
},
shopFavList: function shopFavList(data) {
return request('/shop/fav/list', true, 'post', data);
},
shopFavDelete: function shopFavDelete(token, shopId) {
return request('/shop/fav/delete', true, 'post', { token: token, shopId: shopId });
},
userAttendantFavPut: function userAttendantFavPut(token, attendantId) {
return request('/userAttendantFav/add', true, 'post', { token: token, attendantId: attendantId });
},
userAttendantFavCheck: function userAttendantFavCheck(token, attendantId) {
return request('/userAttendantFav/check', true, 'get', { token: token, attendantId: attendantId });
},
userAttendantFavList: function userAttendantFavList(data) {
return request('/userAttendantFav/list', true, 'post', data);
},
userAttendantFavDelete: function userAttendantFavDelete(token, attendantId) {
return request('/userAttendantFav/delete', true, 'post', { token: token, attendantId: attendantId });
},
addComment: function addComment(data) {
return request('/comment/add', true, 'post', data);
},
commentList: function commentList(data) {
return request('/comment/list', true, 'post', data);
},
commentListV2: function commentListV2(data) {
return request('/comment/list/v2', true, 'post', data);
},
delComment: function delComment(data) {
return request('/comment/del', true, 'post', data);
},
modifyUserInfo: function modifyUserInfo(data) {
return request('/user/modify', true, 'post', data);
},
modifyUserInfoV2: function modifyUserInfoV2(data) {
return request(COMMON_BASE_URL + subDomain + '/user/modify', false, 'post', data);
},
bindSaleman: function bindSaleman(data) {
return request('/user/bindSaleman', true, 'post', data);
},
modifyUserPassword: function modifyUserPassword(token, pwdOld, pwdNew) {
return request('/user/modify/password', true, 'post', { token: token, pwdOld: pwdOld, pwdNew: pwdNew });
},
modifyUserPasswordByUserName: function modifyUserPasswordByUserName(data) {
return request('/user/username/modifyPassword', true, 'post', data);
},
anonymousUserInfo: function anonymousUserInfo(id) {
return request('/user/anonymous/info', true, 'get', { id: id });
},
uniqueId: function uniqueId() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/uniqueId/get', true, 'get', { type: type });
},
sequence: function sequence() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var defValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request(COMMON_BASE_URL + subDomain + '/uniqueId/sequence', false, 'get', { type: type, defValue: defValue });
},
queryBarcode: function queryBarcode() {
var barcode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/barcode/info', true, 'get', { barcode: barcode });
},
luckyInfo: function luckyInfo(id) {
return request('/luckyInfo/info/v2', true, 'get', { id: id });
},
luckyInfoJoin: function luckyInfoJoin(id, token) {
return request('/luckyInfo/join', true, 'post', { id: id, token: token });
},
luckyInfoJoinMy: function luckyInfoJoinMy(id, token) {
return request('/luckyInfo/join/my', true, 'get', { id: id, token: token });
},
luckyInfoJoinLogs: function luckyInfoJoinLogs(data) {
return request('/luckyInfo/join/logs', true, 'post', data);
},
jsonList: function jsonList(data) {
return request('/json/list', true, 'post', data);
},
jsonListV2: function jsonListV2(data) {
return request('/json/list/v2', true, 'post', data);
},
jsonSet: function jsonSet(data) {
return request('/json/set', true, 'post', data);
},
jsonDelete: function jsonDelete(token, id) {
return request('/json/delete', true, 'post', { token: token, id: id });
},
jsonTop: function jsonTop(token, id, isTop) {
return request('/json/top', true, 'post', { token: token, id: id, isTop: isTop });
},
jsonHighlight: function jsonHighlight(token, id, isHighlight) {
return request('/json/highlight', true, 'post', { token: token, id: id, isHighlight: isHighlight });
},
jsonListV3: function jsonListV3(data) {
return request(COMMON_BASE_URL + subDomain + '/json/list', true, 'post', data);
},
jsonSetV2: function jsonSetV2(data) {
return request(COMMON_BASE_URL + subDomain + '/json/set', true, 'post', data);
},
jsonDeleteV2: function jsonDeleteV2(data) {
return request(COMMON_BASE_URL + subDomain + '/json/delete', true, 'post', data);
},
jsonTopv2: function jsonTopv2(data) {
return request(COMMON_BASE_URL + subDomain + '/json/top', true, 'post', data);
},
jsonHighlightv2: function jsonHighlightv2(data) {
return request(COMMON_BASE_URL + subDomain + '/json/highlight', true, 'post', data);
},
graphValidateCodeUrl: function graphValidateCodeUrl() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.random();
var _url = API_BASE_URL + '/' + subDomain + '/verification/pic/get?key=' + key;
return _url;
},
graphValidateCodeCheck: function graphValidateCodeCheck() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.random();
var code = arguments[1];
return request('/verification/pic/check', true, 'post', { key: key, code: code });
},
shortUrl: function shortUrl() {
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/common/short-url/shorten', false, 'post', { url: url });
},
shortUrlV2: function shortUrlV2(content) {
return request('/common/short-url/shorten/v2', false, 'post', { content: content });
},
shortUrlExpand: function shortUrlExpand(suffix) {
return request('/common/short-url/expand', false, 'post', { suffix: suffix });
},
smsValidateCode: function smsValidateCode(mobile) {
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var picCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/verification/sms/get', true, 'get', { mobile: mobile, key: key, picCode: picCode });
},
smsValidateCodeByToken: function smsValidateCodeByToken(token) {
return request('/verification/sms/get-by-token', true, 'get', { token: token });
},
smsValidateCodeCheck: function smsValidateCodeCheck(mobile, code) {
return request('/verification/sms/check', true, 'post', { mobile: mobile, code: code });
},
mailValidateCode: function mailValidateCode(mail) {
return request('/verification/mail/get', true, 'get', { mail: mail });
},
mailValidateCodeCheck: function mailValidateCodeCheck(mail, code) {
return request('/verification/mail/check', true, 'post', { mail: mail, code: code });
},
mapDistance: function mapDistance(lat1, lng1, lat2, lng2) {
return request('/common/map/distance', false, 'get', { lat1: lat1, lng1: lng1, lat2: lat2, lng2: lng2 });
},
mapDistanceNavigation: function mapDistanceNavigation(key, mode, from, to) {
return request('/common/map/qq/distance', false, 'post', { key: key, mode: mode, from: from, to: to });
},
mapQQAddress: function mapQQAddress() {
var location = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var coord_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '5';
return request('/common/map/qq/address', false, 'get', { location: location, coord_type: coord_type });
},
mapQQAddressV2: function mapQQAddressV2(key, location) {
var coord_type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '5';
return request('/common/map/qq/address', false, 'get', { key: key, location: location, coord_type: coord_type });
},
mapQQSearch: function mapQQSearch(data) {
return request('/common/map/qq/search', false, 'post', data);
},
mapQQSearchV2: function mapQQSearchV2(data) {
return request(COMMON_BASE_URL + subDomain + '/map/qq/search', false, 'post', data);
},
mapDistanceNavigationV2: function mapDistanceNavigationV2(data) {
return request(COMMON_BASE_URL + subDomain + '/map/qq/distance', false, 'post', data);
},
mapQQAddressV3: function mapQQAddressV3(data) {
return request(COMMON_BASE_URL + subDomain + '/map/qq/address', false, 'post', data);
},
mapGeocoder: function mapGeocoder(data) {
return request(COMMON_BASE_URL + subDomain + '/map/geocoder', false, 'post', data);
},
mapDrive: function mapDrive(data) {
return request(COMMON_BASE_URL + subDomain + '/map/drive', false, 'post', data);
},
mapAddressToGps: function mapAddressToGps(data) {
return request(COMMON_BASE_URL + subDomain + '/map/addressToGps', false, 'post', data);
},
virtualTraderList: function virtualTraderList(data) {
return request('/virtualTrader/list', true, 'post', data);
},
virtualTraderDetail: function virtualTraderDetail(token, id) {
return request('/virtualTrader/info', true, 'get', { token: token, id: id });
},
virtualTraderBuy: function virtualTraderBuy(token, id) {
return request('/virtualTrader/buy', true, 'post', { token: token, id: id });
},
virtualTraderMyBuyLogs: function virtualTraderMyBuyLogs(data) {
return request('/virtualTrader/buy/logs', true, 'post', data);
},
virtualTraderListV2: function virtualTraderListV2(data) {
return request(COMMON_BASE_URL + subDomain + '/virtualTrader/list', false, 'post', data);
},
virtualTraderDetailV2: function virtualTraderDetailV2(token, id) {
return request(COMMON_BASE_URL + subDomain + '/virtualTrader/info', false, 'get', { token: token, id: id });
},
virtualTraderBuyV2: function virtualTraderBuyV2(token, id) {
return request(COMMON_BASE_URL + subDomain + '/virtualTrader/buy', false, 'post', { token: token, id: id });
},
virtualTraderMyBuyLogsV2: function virtualTraderMyBuyLogsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/virtualTrader/buy/logs', false, 'post', data);
},
queuingTypes: function queuingTypes() {
var status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/queuing/types', true, 'get', { status: status });
},
queuingGet: function queuingGet(token, typeId) {
var mobile = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/queuing/get', true, 'post', { token: token, typeId: typeId, mobile: mobile });
},
queuingMy: function queuingMy(token) {
var typeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var status = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/queuing/my', true, 'get', { token: token, typeId: typeId, status: status });
},
idcardCheck: function idcardCheck(token, name, idCardNo) {
return request('/user/idcard', true, 'post', { token: token, name: name, idCardNo: idCardNo });
},
idcardCheckManualReview: function idcardCheckManualReview(data) {
return request('/user/idcard/manualReview', true, 'post', data);
},
idcardCheckManualReviewInfo: function idcardCheckManualReviewInfo(token) {
return request('/user/idcard/manualReview/info', true, 'get', { token: token });
},
userTagList: function userTagList(data) {
return request('/userTag/list', true, 'post', data);
},
userTagCertificateQuery: function userTagCertificateQuery(token) {
return request('/userTag/certificate/query', true, 'get', { token: token });
},
userTagCertificate: function userTagCertificate(data) {
return request('/userTag/certificate', true, 'post', data);
},
bindSeller: function bindSeller(data) {
return request('/user/bindSeller', true, 'post', data);
},
loginout: function loginout(token) {
return request('/user/loginout', true, 'get', { token: token });
},
userLogedList: function userLogedList(token) {
return request('/user/logedUserList', true, 'get', { token: token });
},
userDelete: function userDelete(token) {
return request('/user/delete', true, 'post', { token: token });
},
dynamicUserCode: function dynamicUserCode(token) {
return request(COMMON_BASE_URL + subDomain + '/user/dynamicUserCode', false, 'get', { token: token });
},
userLevelList: function userLevelList(data) {
return request(COMMON_BASE_URL + subDomain + '/user/level/list', false, 'post', data);
},
userLevelDetail: function userLevelDetail(levelId) {
return request(COMMON_BASE_URL + subDomain + '/user/level/info', false, 'get', { id: levelId });
},
userLevelPrices: function userLevelPrices(levelId) {
return request(COMMON_BASE_URL + subDomain + '/user/level/prices', false, 'get', { levelId: levelId });
},
userLevelBuy: function userLevelBuy(token, priceId) {
var isAutoRenew = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var remark = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request(COMMON_BASE_URL + subDomain + '/user/level/buy', false, 'post', {
token: token,
userLevelPriceId: priceId,
isAutoRenew: isAutoRenew,
remark: remark
});
},
userLevelBuyLogs: function userLevelBuyLogs(data) {
return request(COMMON_BASE_URL + subDomain + '/user/level/buyLogs', false, 'post', data);
},
messageList: function messageList(data) {
return request('/user/message/list', true, 'post', data);
},
messageRead: function messageRead(token, id) {
return request('/user/message/read', true, 'post', { token: token, id: id });
},
messageDelete: function messageDelete(token, id) {
return request('/user/message/del', true, 'post', { token: token, id: id });
},
bindOpenid: function bindOpenid(token, code) {
// SDK文档到这里
return request('/user/wxapp/bindOpenid', true, 'post', {
token: token, code: code,
type: 2
});
},
bindOpenidV2: function bindOpenidV2(token, code, appid) {
return request('/user/wxapp/bindOpenid/v2', true, 'post', {
token: token, code: code, appid: appid
});
},
bindOpenidV11: function bindOpenidV11(data) {
return request('/user/wxapp/bindOpenid', true, 'post', data);
},
encryptedData: function encryptedData(code, _encryptedData, iv) {
return request('/user/wxapp/decode/encryptedData', true, 'post', {
code: code, encryptedData: _encryptedData, iv: iv
});
},
voteItems: function voteItems(data) {
return request(COMMON_BASE_URL + subDomain + '/vote/items', false, 'post', data);
},
voteItemDetail: function voteItemDetail(id) {
return request(COMMON_BASE_URL + subDomain + '/vote/info', false, 'get', { id: id });
},
vote: function vote(token, voteId, items, remark) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote', false, 'post', {
token: token, voteId: voteId,
items: items.join(),
remark: remark
});
},
voteCategory: function voteCategory(data) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote/category', false, 'post', data);
},
myVote: function myVote(token, voteId) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote/info', false, 'get', {
token: token, voteId: voteId
});
},
myVoteV2: function myVoteV2(token, voteId) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote/info/v2', false, 'get', {
token: token, voteId: voteId
});
},
voteLogs: function voteLogs(data) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote/list', false, 'post', data);
},
voteGroups: function voteGroups(data) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote/groups', false, 'post', data);
},
voteGroupsDetail: function voteGroupsDetail(data) {
return request(COMMON_BASE_URL + subDomain + '/vote/vote/groups/detail', false, 'get', data);
},
myInviteVoteJoinList: function myInviteVoteJoinList(data) {
return request(COMMON_BASE_URL + subDomain + '/vote/myInviteLoinList', false, 'post', data);
},
yuyueItemPublish: function yuyueItemPublish(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/publish', false, 'post', data);
},
yuyueItems: function yuyueItems(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/items', false, 'post', data);
},
yuyueItemDetail: function yuyueItemDetail(id) {
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request(COMMON_BASE_URL + subDomain + '/yuyue/info', false, 'get', { id: id, token: token });
},
yuyueItemDelete: function yuyueItemDelete(token, id) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/del', false, 'post', { token: token, id: id });
},
yuyueJoin: function yuyueJoin(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/join', false, 'post', data);
},
yuyueJoinPay: function yuyueJoinPay(token, joinId) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/pay', false, 'post', {
token: token, joinId: joinId
});
},
yuyueJoinUpdate: function yuyueJoinUpdate(token, joinId, extJsonStr) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/join/update', false, 'post', {
token: token, joinId: joinId, extJsonStr: extJsonStr
});
},
yuyueLike: function yuyueLike(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/like', false, 'post', data);
},
yuyueJoinDelete: function yuyueJoinDelete(token, joinId) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/delJoin', false, 'post', {
token: token, id: joinId
});
},
yuyueServered: function yuyueServered(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/servered', false, 'post', data);
},
yuyueMyJoinInfo: function yuyueMyJoinInfo(token, joinId) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/join/info', false, 'post', {
token: token, joinId: joinId
});
},
yuyueMyJoinLogs: function yuyueMyJoinLogs(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/join/list', false, 'post', data);
},
yuyueTeams: function yuyueTeams(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/info/teams', false, 'post', data);
},
yuyueTeamDetail: function yuyueTeamDetail(teamId) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/info/team', false, 'get', { teamId: teamId });
},
yuyueTeamMembers: function yuyueTeamMembers(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/info/team/members', false, 'post', data);
},
yuyueTeamDeleteMember: function yuyueTeamDeleteMember(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/info/team/members/del', false, 'post', data);
},
yuyueFavList: function yuyueFavList(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/fav/list', false, 'post', data);
},
yuyueFavAdd: function yuyueFavAdd(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/fav/add', false, 'post', data);
},
yuyueFavDelete: function yuyueFavDelete(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/fav/delete', false, 'post', data);
},
yuyueFavCheck: function yuyueFavCheck(data) {
return request(COMMON_BASE_URL + subDomain + '/yuyue/fav/check', false, 'get', data);
},
register_email: function register_email(data) {
return request('/user/email/register', true, 'post', data);
},
login_email: function login_email(data) {
return request('/user/email/login', true, 'post', data);
},
bindEmail: function bindEmail(token, email, code) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/email/bindEmail', true, 'post', {
token: token, email: email, code: code, pwd: pwd
});
},
goodsDynamic: function goodsDynamic(type) {
return request('/site/goods/dynamic', true, 'get', { type: type });
},
goodsDynamicV2: function goodsDynamicV2(data) {
return request('/site/goods/dynamic', true, 'get', data);
},
usersDynamic: function usersDynamic(type) {
return request(COMMON_BASE_URL + subDomain + '/site/user/dynamic', false, 'get', { type: type });
},
fetchSubDomainByWxappAppid: function fetchSubDomainByWxappAppid(appid) {
return request('/subdomain/appid/wxapp', false, 'get', { appid: appid });
},
cmsArticleFavPut: function cmsArticleFavPut(token, newsId) {
return request('/cms/news/fav/add', true, 'post', { token: token, newsId: newsId });
},
cmsArticleFavCheck: function cmsArticleFavCheck(token, newsId) {
return request('/cms/news/fav/check', true, 'get', { token: token, newsId: newsId });
},
cmsArticleFavList: function cmsArticleFavList(data) {
return request('/cms/news/fav/list', true, 'post', data);
},
cmsArticleFavListV2: function cmsArticleFavListV2(data) {
return request('/cms/news/fav/list/v2', true, 'post', data);
},
cmsArticleFavDeleteById: function cmsArticleFavDeleteById(token, id) {
return request('/cms/news/fav/delete', true, 'post', { token: token, id: id });
},
cmsArticleFavDeleteByNewsId: function cmsArticleFavDeleteByNewsId(token, newsId) {
return request('/cms/news/fav/delete', true, 'post', { token: token, newsId: newsId });
},
shippingCarInfo: function shippingCarInfo(token) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shopping-cart/info', true, 'get', {
token: token, type: type
});
},
shippingCarInfoAddItem: function shippingCarInfoAddItem(token, goodsId, number, sku, addition) {
var type = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
return request('/shopping-cart/add', true, 'post', {
token: token,
goodsId: goodsId,
number: number,
sku: sku && sku.length > 0 ? JSON.stringify(sku) : '',
addition: addition && addition.length > 0 ? JSON.stringify(addition) : '',
type: type
});
},
shippingCarInfoAddItemV2: function shippingCarInfoAddItemV2(data) {
return request('/shopping-cart/add', true, 'post', data);
},
shippingCarInfoModifyNumber: function shippingCarInfoModifyNumber(token, key, number) {
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/shopping-cart/modifyNumber', true, 'post', {
token: token, key: key, number: number, type: type
});
},
shippingCarInfoRemoveItem: function shippingCarInfoRemoveItem(token, key) {
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/shopping-cart/remove', true, 'post', {
token: token, key: key, type: type
});
},
shippingCartSelected: function shippingCartSelected(token, key, selected) {
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/shopping-cart/select', true, 'post', {
token: token, key: key, selected: selected, type: type
});
},
shippingCarInfoRemoveAll: function shippingCarInfoRemoveAll(token) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shopping-cart/empty', true, 'post', {
token: token, type: type
});
},
growthLogs: function growthLogs(data) {
return request('/growth/logs', true, 'post', data);
},
exchangeScoreToGrowth: function exchangeScoreToGrowth(token, deductionScore) {
return request('/growth/exchange', true, 'post', {
token: token, deductionScore: deductionScore
});
},
growthLogsV2: function growthLogsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/growthLog/logs', true, 'post', data);
},
exchangeScoreToGrowthV2: function exchangeScoreToGrowthV2(data) {
return request(COMMON_BASE_URL + subDomain + '/growthLog/exchange', true, 'post', data);
},
wxaMpLiveRooms: function wxaMpLiveRooms() {
return request('/wx/live/rooms', true, 'get');
},
wxaMpLiveRoomHisVedios: function wxaMpLiveRoomHisVedios(roomId) {
return request('/wx/live/his', true, 'get', {
roomId: roomId
});
},
peisonFeeList: function peisonFeeList() {
return request('/fee/peisong/list', true, 'get');
},
peisongMembers: function peisongMembers(data) {
return request('/peisong/member/list', true, 'post', data);
},
peisongMemberInfo: function peisongMemberInfo(token) {
return request('/peisong/member/info', true, 'get', {
token: token
});
},
peisongMemberChangeWorkStatus: function peisongMemberChangeWorkStatus(token) {
return request('/peisong/member/change-work-status', true, 'post', {
token: token
});
},
peisongOrdersGrabbing: function peisongOrdersGrabbing(token) {
return request('/peisong/order/grabbing', true, 'get', { token: token });
},
peisongOrders: function peisongOrders(data) {
return request('/peisong/order/list', true, 'post', data);
},
peisongOrderGrab: function peisongOrderGrab(data) {
return request('/peisong/order/grab', true, 'post', data);
},
peisongOrderDetail: function peisongOrderDetail(token, id) {
return request('/peisong/order/detail', true, 'get', { token: token, id: id });
},
peisongOrderEstimatedCompletionTime: function peisongOrderEstimatedCompletionTime(data) {
return request('/peisong/order/estimatedCompletionTime', true, 'post', data);
},
peisongStartService: function peisongStartService(data) {
return request('/peisong/order/start-service', true, 'post', data);
},
peisongEndService: function peisongEndService(data) {
return request('/peisong/order/end-service', true, 'post', data);
},
peisongEndServiceRemark: function peisongEndServiceRemark(token, id, remarkEnd) {
return request('/peisong/order/end-service/remarkEnd', true, 'post', { token: token, id: id, remarkEnd: remarkEnd });
},
peisongOrderAllocation: function peisongOrderAllocation(token, id, uid) {
return request('/peisong/order/allocation', true, 'post', {
token: token, id: id, uid: uid
});
},
siteStatistics: function siteStatistics() {
return request(COMMON_BASE_URL + subDomain + '/site/statistics', false, 'get');
},
orderStatistics: function orderStatistics(token) {
return request('/order/statistics', true, 'get', {
token: token
});
},
orderStatisticsv2: function orderStatisticsv2(data) {
return request('/order/statistics', true, 'get', data);
},
siteStatisticsSaleroom: function siteStatisticsSaleroom(data) {
return request(COMMON_BASE_URL + subDomain + '/site/statistics/saleroom', false, 'get', data);
},
siteStatisticsSaleroomYear: function siteStatisticsSaleroomYear() {
var year = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request(COMMON_BASE_URL + subDomain + '/site/statistics/saleroom/year', false, 'get', { year: year });
},
bonusLog: function bonusLog(data) {
return request('/bonusLog/list', true, 'post', data);
},
bonusLogV2: function bonusLogV2(data) {
return request(COMMON_BASE_URL + subDomain + '/bonusLog/list', false, 'post', data);
},
mtjAsset: function mtjAsset(token) {
return request('/mtj/asset', true, 'get', { token: token });
},
mtjSetting: function mtjSetting() {
return request('/mtj/setting', true, 'get');
},
mtjLogs: function mtjLogs(data) {
return request('/mtj/logs', true, 'post', data);
},
mtjStatistics: function mtjStatistics() {
return request('/site/statistics/mjt', true, 'get');
},
mtjTransfer: function mtjTransfer(data) {
return request('/mtj/transfer', true, 'post', data);
},
mtjTransferLogs: function mtjTransferLogs(data) {
return request('/mtj/transfer/logs', true, 'post', data);
},
mtjAssetV2: function mtjAssetV2(token) {
return request(COMMON_BASE_URL + subDomain + '/mtj/asset', true, 'get', { token: token });
},
mtjSettingV2: function mtjSettingV2() {
return request(COMMON_BASE_URL + subDomain + '/mtj/setting', true, 'get');
},
mtjLogsV2: function mtjLogsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/mtj/logs', true, 'post', data);
},
mtjStatisticsV2: function mtjStatisticsV2() {
return request(COMMON_BASE_URL + subDomain + '/site/statistics/mjt', true, 'get');
},
mtjTransferV2: function mtjTransferV2(data) {
return request(COMMON_BASE_URL + subDomain + '/mtj/transfer', true, 'post', data);
},
mtjTransferLogsV2: function mtjTransferLogsV2(data) {
return request(COMMON_BASE_URL + subDomain + '/mtj/transfer/logs', true, 'post', data);
},
wxOpenAuthorization: function wxOpenAuthorization(data) {
return request('/user/wxsns/authorization', true, 'post', data);
},
wxOpenRegister: function wxOpenRegister(data) {
return request('/user/wxsns/register', true, 'post', data);
},
wxOpenBindOpenid: function wxOpenBindOpenid(data) {
return request('/user/wxsns/bindOpenid/v2', true, 'post', data);
},
wxOpenLogin: function wxOpenLogin(data) {
return request('/user/wxsns/login', true, 'post', data);
},
userAttentioncheck: function userAttentioncheck(token, uid) {
return request('/user/attention/check', true, 'get', {
token: token, uid: uid
});
},
userAttentionAdd: function userAttentionAdd(token, uid) {
return request('/user/attention/add', true, 'post', {
token: token, uid: uid
});
},
userAttentionRemove: function userAttentionRemove(token, uid) {
return request('/user/attention/remove', true, 'post', {
token: token, uid: uid
});
},
userAttentionMeList: function userAttentionMeList(data) {
return request('/user/attention/attention-me', true, 'post', data);
},
userMyAttentionList: function userMyAttentionList(data) {
return request('/user/attention/my-attention', true, 'post', data);
},
userAttentionDetail: function userAttentionDetail(token, uid) {
return request('/user/attention/detail', true, 'get', {
token: token, uid: uid
});
},
userAttentionStatistics: function userAttentionStatistics(token) {
return request('/user/attention/statistics', true, 'get', {
token: token
});
},
cyTableToken: function cyTableToken(tableId, key) {
return request('/cyTable/token', true, 'post', {
id: tableId,
k: key
});
},
cyTableAddOrder: function cyTableAddOrder(data) {
return request('/cyTable/add-order', true, 'post', data);
},
cyTablePayOrder: function cyTablePayOrder(data) {
return request('/cyTable/pay-order', true, 'post', data);
},
cyTableInfo: function cyTableInfo(id) {
return request('/cyTable/info', true, 'get', { id: id });
},
cyTableList: function cyTableList(data) {
return request('/cyTable/list', true, 'post', data);
},
goodsTimesSchedule: function goodsTimesSchedule() {
var goodsId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var propertyChildIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var brandId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var categoryId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/shop/goods/times/schedule', true, 'post', { goodsId: goodsId, propertyChildIds: propertyChildIds, brandId: brandId, categoryId: categoryId });
},
goodsTimesDays: function goodsTimesDays(goodsId) {
var propertyChildIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/times/days', true, 'post', { goodsId: goodsId, propertyChildIds: propertyChildIds });
},
goodsTimesDayItems: function goodsTimesDayItems(day, goodsId) {
var propertyChildIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/shop/goods/times/items', true, 'post', { day: day, goodsId: goodsId, propertyChildIds: propertyChildIds });
},
goodsBrandList: function goodsBrandList(data) {
return request('/shop/goods/brand/list', true, 'post', data);
},
goodsBrandDetail: function goodsBrandDetail(id) {
return request('/shop/goods/brand/detail', true, 'get', { id: id });
},
wxappServiceLogin: function wxappServiceLogin(data) {
return request('/user/wxappService/login', true, 'post', data);
},
wxappServiceLoginWxaMobile: function wxappServiceLoginWxaMobile(data) {
return request('/user/wxappService/login/mobile', true, 'post', data);
},
wxappServiceRegisterComplex: function wxappServiceRegisterComplex(data) {
return request('/user/wxappService/register/complex', true, 'post', data);
},
wxappServiceRegisterSimple: function wxappServiceRegisterSimple(data) {
return request('/user/wxappService/register/simple', true, 'post', data);
},
wxappServiceAuthorize: function wxappServiceAuthorize(data) {
return request('/user/wxappService/authorize', true, 'post', data);
},
wxappServiceBindMobile: function wxappServiceBindMobile(data) {
return request('/user/wxappService/bindMobile', true, 'post', data);
},
wxappServiceBindMobileV2: function wxappServiceBindMobileV2(data) {
return request('/user/wxappService/bindMobile/v2', true, 'post', data);
},
wxappServiceBindOpenid: function wxappServiceBindOpenid(data) {
return request('/user/wxappService/bindOpenid', true, 'post', data);
},
wxappServiceEncryptedData: function wxappServiceEncryptedData(data) {
return request('/user/wxappService/decode/encryptedData', true, 'post', data);
},
trtcUserSig: function trtcUserSig(token) {
return request('/trtc/userSig', true, 'get', { token: token });
},
setPayPassword: function setPayPassword(token, pwd) {
return request('/user/paypwd/set', true, 'post', { token: token, pwd: pwd });
},
modifyPayPassword: function modifyPayPassword(token, pwdOld, pwdNew) {
return request('/user/paypwd/modify', true, 'post', { token: token, pwdOld: pwdOld, pwdNew: pwdNew });
},
resetPayPassword: function resetPayPassword(mobile, code, pwd) {
return request('/user/paypwd/reset', true, 'post', { mobile: mobile, code: code, pwd: pwd });
},
adPosition: function adPosition(key) {
return request('/site/adPosition/info', true, 'get', { key: key });
},
adPositionBatch: function adPositionBatch(keys) {
return request('/site/adPosition/batch', true, 'get', { keys: keys });
},
momentsCategory: function momentsCategory() {
return request('/momentsCategory/list', true, 'get');
},
momentsList: function momentsList(data) {
return request('/moments/list', true, 'post', data);
},
momentsdetail: function momentsdetail(id) {
return request('/moments/detail', true, 'get', { id: id });
},
goodsVisitLog: function goodsVisitLog(data) {
return request('/goods/visitLog', true, 'post', data);
},
goodsVisitLogAdd: function goodsVisitLogAdd(data) {
return request('/goods/visitLog/add', true, 'post', data);
},
goodsVisitLogDelete: function goodsVisitLogDelete(data) {
return request('/goods/visitLog/delete', true, 'post', data);
},
goodsVisitLogClear: function goodsVisitLogClear(token) {
return request('/goods/visitLog/clear', true, 'post', { token: token });
},
goodsVisitLogV2: function goodsVisitLogV2(data) {
return request(COMMON_BASE_URL + subDomain + '/goods/visitLog', false, 'post', data);
},
goodsVisitLogAddV2: function goodsVisitLogAddV2(data) {
return request(COMMON_BASE_URL + subDomain + '/goods/visitLog/add', false, 'post', data);
},
goodsVisitLogDeleteV2: function goodsVisitLogDeleteV2(data) {
return request(COMMON_BASE_URL + subDomain + '/goods/visitLog/delete', false, 'post', data);
},
goodsVisitLogClearV2: function goodsVisitLogClearV2(token) {
return request(COMMON_BASE_URL + subDomain + '/goods/visitLog/clear', false, 'post', { token: token });
},
channelDataPush: function channelDataPush(key, content) {
return request('/channelData/push', true, 'post', { key: key, content: content });
},
channelDataPull: function channelDataPull(key) {
return request('/channelData/pull', true, 'get', { key: key });
},
bindPartner: function bindPartner(token, partnerId) {
return request('/user/bindPartner', true, 'post', { token: token, uid: partnerId });
},
partnerSetting: function partnerSetting() {
return request('/partner/setting', true, 'get');
},
partnerBindTeamLeader: function partnerBindTeamLeader(token, uid) {
return request('/partner/bindTeamLeader', true, 'post', { token: token, uid: uid });
},
partnerBuyTeamLeader: function partnerBuyTeamLeader(token) {
return request('/partner/buy', true, 'post', { token: token });
},
partnerMembersStatistics: function partnerMembersStatistics(token) {
return request(COMMON_BASE_URL + subDomain + '/partner/members/statistics', false, 'get', { token: token });
},
partnerMembers: function partnerMembers(data) {
return request(COMMON_BASE_URL + subDomain + '/partner/members', false, 'post', data);
},
myLiveRooms: function myLiveRooms(data) {
return request('/liveRooms/my', true, 'post', data);
},
liveRooms: function liveRooms(data) {
return request('/liveRooms/list', true, 'post', data);
},
myLiveRoomsInfo: function myLiveRoomsInfo(token, id) {
return request('/liveRooms/my/info', true, 'get', { token: token, id: id });
},
liveRoomsInfo: function liveRoomsInfo(token, id) {
return request('/liveRooms/info', true, 'get', { token: token, id: id });
},
liveRoomGoodsMainly: function liveRoomGoodsMainly(data) {
return request('/liveRooms/goods/mainly', true, 'post', data);
},
stopLiveRoom: function stopLiveRoom(token, id) {
return request('/liveRooms/my/stop', true, 'post', { token: token, id: id });
},
likeLiveRoom: function likeLiveRoom(token, id) {
return request('/liveRooms/like', true, 'post', { token: token, id: id });
},
liveRoomOnlineUsers: function liveRoomOnlineUsers(token, roomId) {
return request('/websocket/rest/liveRoom/onlines', false, 'get', { token: token, roomId: roomId });
},
liveRoomKickOutUser: function liveRoomKickOutUser(token, roomId, uid) {
return request('/websocket/rest/liveRoom/kickOut', false, 'post', { token: token, roomId: roomId, uid: uid });
},
mockApi: function mockApi(groupName, apiName, method) {
return request('/mock/' + groupName + '/' + apiName, true, method);
},
tourJourneyList: function tourJourneyList(type, refId) {
return request('/tourJourney/list', true, 'get', { type: type, refId: refId });
},
userBankSelectBanks: function userBankSelectBanks() {
return request('/userBank/banks', true, 'get');
},
userBankInfo: function userBankInfo(token) {
return request('/userBank/info', true, 'get', { token: token });
},
userBankBind: function userBankBind(data) {
return request('/userBank/bind', true, 'post', data);
},
userBankUnBind: function userBankUnBind(token) {
return request('/userBank/unbind', true, 'post', { token: token });
},
// 京东VOP相关接口
jdvopGoodsList: function jdvopGoodsList(data) {
return request('/jdvop/' + merchantId + '/goods/list', false, 'post', data);
},
jdvopGoodsListV2: function jdvopGoodsListV2(data) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/list', false, 'post', data);
},
jdvopGoodsListV3: function jdvopGoodsListV3(data) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/v2/list', false, 'post', data);
},
jdvopGoodsCheckCanBuy: function jdvopGoodsCheckCanBuy(data) {
return request('/jdvop/' + merchantId + '/goods/checkCanBuy', false, 'post', data);
},
jdvopGoodsCheckCanBuyV2: function jdvopGoodsCheckCanBuyV2(data) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/checkCanBuy', false, 'post', data);
},
jdvopGoodsCheckCanBuyV3: function jdvopGoodsCheckCanBuyV3(data) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/v2/getSkusAllSaleState', false, 'post', data);
},
jdvopGoodsDetail: function jdvopGoodsDetail(goodsId) {
return request('/jdvop/' + merchantId + '/goods/detail', false, 'get', {
skuId: goodsId,
queryExts: 'wxintroduction'
});
},
jdvopGoodsDetailV2: function jdvopGoodsDetailV2(goodsId) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/detail', false, 'get', {
skuId: goodsId,
queryExts: 'wxintroduction'
});
},
jdvopGoodsDetailV3: function jdvopGoodsDetailV3(data) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/v2/detail', false, 'get', data);
},
jdvopGoodsSkuImages: function jdvopGoodsSkuImages(goodsId) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/skuImages', false, 'get', {
skuId: goodsId
});
},
jdvopGoodsSkuImagesV2: function jdvopGoodsSkuImagesV2(goodsId) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/v2/skuImages', false, 'get', {
skuId: goodsId
});
},
jdVopSkuGoodsSaleRule: function jdVopSkuGoodsSaleRule(skuId) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/goods/v2/checkSkuSaleList', false, 'get', { skuId: skuId });
},
jdvopCartInfo: function jdvopCartInfo(token) {
return request('/jdvop/' + merchantId + '/shopping-cart/info', false, 'get', {
token: token
});
},
jdvopCartAdd: function jdvopCartAdd(data) {
return request('/jdvop/' + merchantId + '/shopping-cart/add', false, 'post', data);
},
jdvopCartModifyNumber: function jdvopCartModifyNumber(token, key, number) {
return request('/jdvop/' + merchantId + '/shopping-cart/modifyNumber', false, 'post', {
token: token, key: key, number: number
});
},
jdvopCartSelect: function jdvopCartSelect(token, key, selected) {
return request('/jdvop/' + merchantId + '/shopping-cart/select', false, 'post', {
token: token, key: key, selected: selected
});
},
jdvopCartRemove: function jdvopCartRemove(token, key) {
return request('/jdvop/' + merchantId + '/shopping-cart/remove', false, 'post', {
token: token, key: key
});
},
jdvopCartEmpty: function jdvopCartEmpty(token) {
return request('/jdvop/' + merchantId + '/shopping-cart/empty', false, 'post', {
token: token
});
},
jdvopCartInfoV2: function jdvopCartInfoV2(token) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/shopping-cart/info', false, 'get', {
token: token
});
},
jdvopCartAddV2: function jdvopCartAddV2(data) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/shopping-cart/add', false, 'post', data);
},
jdvopCartModifyNumberV2: function jdvopCartModifyNumberV2(token, key, number) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/shopping-cart/modifyNumber', false, 'post', {
token: token, key: key, number: number
});
},
jdvopCartSelectV2: function jdvopCartSelectV2(token, key, selected) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/shopping-cart/select', false, 'post', {
token: token, key: key, selected: selected
});
},
jdvopCartRemoveV2: function jdvopCartRemoveV2(token, key) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/shopping-cart/remove', false, 'post', {
token: token, key: key
});
},
jdvopCartEmptyV2: function jdvopCartEmptyV2(token) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/shopping-cart/empty', false, 'post', {
token: token
});
},
jdvopCategory: function jdvopCategory(pid) {
return request('https://jdvop.apifm.com/jdvop/' + merchantId + '/category/list', false, 'get', {
pid: pid
});
},
jdvopCategory46: function jdvopCategory46(pid) {
return request('https://jdvop.apifm.com/jdvop/46/category/list', false, 'get', {
pid: pid
});
},
// 商家从区管进货
jdvopJinhuoGoods: function jdvopJinhuoGoods(data) {
return request('/vop/goods/list', true, 'post', data);
},
jdvopJinhuoGoodsDetail: function jdvopJinhuoGoodsDetail(token, skuId) {
return request('/vop/goods/detail', true, 'get', { token: token, skuId: skuId });
},
// cps
cpsJdGoodsCategory: function cpsJdGoodsCategory(parentId, grade) {
return request('/cpsJdGoods/category', true, 'get', { parentId: parentId, grade: grade });
},
cpsJdGoodsSearch: function cpsJdGoodsSearch(data) {
return request('/cpsJdGoods/search', true, 'post', data);
},
cpsJdGoodsDetail: function cpsJdGoodsDetail(data) {
return request('/cpsJdGoods/detail', true, 'get', data);
},
cpsJdGoodsSetExt: function cpsJdGoodsSetExt(data) {
return request('/cpsJdGoods/ext/set', true, 'post', data);
},
cpsJdGoodsQueryExt: function cpsJdGoodsQueryExt(skuId) {
return request('/cpsJdGoods/ext/query', true, 'get', { skuId: skuId });
},
cpsJdGoodsShotUrl: function cpsJdGoodsShotUrl(token, skuId) {
return request('/cpsJdGoods/shotUrl', true, 'get', { token: token, skuId: skuId });
},
cpsJdGoodsShotUrlSite: function cpsJdGoodsShotUrlSite(token, materialUrl, couponUrl) {
return request('/cpsJdGoods/shotUrl/site', true, 'post', { token: token, materialUrl: materialUrl, couponUrl: couponUrl });
},
cpsJdOrders: function cpsJdOrders(data) {
return request('/cpsJdOrder/list', true, 'post', data);
},
cpsJdOrderDetail: function cpsJdOrderDetail(token, id) {
return request('/cpsJdOrder/detail', true, 'get', { token: token, id: id });
},
cpsPddBeian: function cpsPddBeian(token) {
return request('/cpsPddGoods/beian', true, 'get', { token: token });
},
cpsPddGoodsDetail: function cpsPddGoodsDetail(data) {
return request('/cpsPddGoods/detail', true, 'get', data);
},
cpsPddGoodsShotUrl: function cpsPddGoodsShotUrl(token, goodsSign) {
return request('/cpsPddGoods/shotUrl', true, 'get', { token: token, goodsSign: goodsSign });
},
cpsPddOrders: function cpsPddOrders(data) {
return request('/cpsPddOrder/list', true, 'post', data);
},
cpsPddOrderDetail: function cpsPddOrderDetail(token, id) {
return request('/cpsPddOrder/detail', true, 'get', { token: token, id: id });
},
cpsTaobaoGoodsDetail: function cpsTaobaoGoodsDetail(data) {
return request('/cpsTaobaoGoods/detail', true, 'get', data);
},
cpsTaobaoGoodsShotUrl: function cpsTaobaoGoodsShotUrl(token, content) {
return request('/cpsTaobaoGoods/shotUrl', true, 'post', { token: token, content: content });
},
cpsTaobaoGoodsKouling: function cpsTaobaoGoodsKouling(token, content) {
return request('/cpsTaobaoGoods/kouling', true, 'post', { token: token, content: content });
},
// 回收
recycleOrders: function recycleOrders(data) {
return request('/recycleOrder/list', true, 'post', data);
},
recycleOrderApply: function recycleOrderApply(data) {
return request('/recycleOrder/apply', true, 'post', data);
},
recycleOrderDetail: function recycleOrderDetail(token, id) {
return request('/recycleOrder/detail', true, 'get', { token: token, id: id });
},
recycleOrderFahuo: function recycleOrderFahuo(data) {
return request('/recycleOrder/fahuo', true, 'post', data);
},
recycleOrderClose: function recycleOrderClose(token, id) {
return request('/recycleOrder/close', true, 'post', { token: token, id: id });
},
recycleOrderDelete: function recycleOrderDelete(token, id) {
return request('/recycleOrder/del', true, 'post', { token: token, id: id });
},
// 会员卡
cardList: function cardList(data) {
return request('/card/list', true, 'get', data);
},
cardInfo: function cardInfo(id) {
return request('/card/info', true, 'get', { id: id });
},
cardBuy: function cardBuy(token, id) {
return request('/card/buy', true, 'post', { token: token, id: id });
},
cardMyList: function cardMyList(token) {
return request('/card/my', true, 'get', { token: token });
},
cardMyLogs: function cardMyLogs(data) {
return request('/card/logs', true, 'post', data);
},
cardExchangeFromPwd: function cardExchangeFromPwd(data) {
return request('/card/exchange', true, 'post', data);
},
cardShareOpen: function cardShareOpen(data) {
return request('/card/share/open', true, 'post', data);
},
cardShareClose: function cardShareClose(data) {
return request('/card/share/close', true, 'post', data);
},
cardShareFetch: function cardShareFetch(data) {
return request('/card/share/fetch', true, 'post', data);
},
// 收藏卡片
collectCardHis: function collectCardHis(data) {
return request('/collectCard/del', true, 'post', data);
},
collectCardInfo: function collectCardInfo(number) {
return request('/collectCard/cardInfo', true, 'get', { number: number });
},
collectCardHisInfo: function collectCardHisInfo(token, id) {
return request('/collectCard/hisInfo', true, 'get', { token: token, id: id });
},
collectCardBind: function collectCardBind(data) {
return request('/collectCard/bind', true, 'post', data);
},
collectCardUnBind: function collectCardUnBind(token, id, smsCode) {
return request('/collectCard/bind', true, 'post', { token: token, id: id, smsCode: smsCode });
},
// 其他
bengenSaleTongjiList: function bengenSaleTongjiList(data) {
return request('/bengenSaleTongji/list', true, 'post', data);
},
bengenSaleTongjiRank: function bengenSaleTongjiRank(data) {
return request('/bengenSaleTongji/rank', true, 'get', data);
},
// 购买课程
courseInfoList: function courseInfoList(data) {
return request('/courseInfo/list', true, 'post', data);
},
courseInfo: function courseInfo(id) {
return request('/courseInfo/info', true, 'get', { id: id });
},
courseBuyLogPublic: function courseBuyLogPublic(data) {
return request('/courseBuyLog/public', true, 'post', data);
},
courseBuyLogMy: function courseBuyLogMy(data) {
return request('/courseBuyLog/my', true, 'post', data);
},
courseInfoBuy: function courseInfoBuy(data) {
return request('/courseBuyLog/buy', true, 'post', data);
},
courseInfoBuyLogPay: function courseInfoBuyLogPay(token, orderId) {
return request('/courseBuyLog/pay', true, 'post', { token: token, orderId: orderId });
},
courseInfoBuyLogDetail: function courseInfoBuyLogDetail(token, id) {
var hxNumber = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/courseBuyLog/detail', true, 'get', { token: token, id: id, hxNumber: hxNumber });
},
courseInfoBuyLogClose: function courseInfoBuyLogClose(token, orderId) {
return request('/courseBuyLog/close', true, 'post', { token: token, orderId: orderId });
},
courseInfoBuyLogDelete: function courseInfoBuyLogDelete(token, orderId) {
return request('/courseBuyLog/del', true, 'post', { token: token, orderId: orderId });
},
courseInfoListV2: function courseInfoListV2(data) {
return request(COMMON_BASE_URL + subDomain + '/courseInfo/list', false, 'post', data);
},
courseInfoV2: function courseInfoV2(id) {
return request(COMMON_BASE_URL + subDomain + '/courseInfo/info', false, 'get', { id: id });
},
courseBuyLogPublicV2: function courseBuyLogPublicV2(data) {
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/public', false, 'post', data);
},
courseBuyLogMyV2: function courseBuyLogMyV2(data) {
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/my', false, 'post', data);
},
courseInfoBuyV2: function courseInfoBuyV2(data) {
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/buy', false, 'post', data);
},
courseInfoBuyLogPayV2: function courseInfoBuyLogPayV2(token, orderId) {
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/pay', false, 'post', { token: token, orderId: orderId });
},
courseInfoBuyLogDetailV2: function courseInfoBuyLogDetailV2(token, id) {
var hxNumber = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/detail', false, 'get', { token: token, id: id, hxNumber: hxNumber });
},
courseInfoBuyLogCloseV2: function courseInfoBuyLogCloseV2(token, orderId) {
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/close', false, 'post', { token: token, orderId: orderId });
},
courseInfoBuyLogDeleteV2: function courseInfoBuyLogDeleteV2(token, orderId) {
return request(COMMON_BASE_URL + subDomain + '/courseBuyLog/del', false, 'post', { token: token, orderId: orderId });
},
// 橱窗
chuchuanSettingInfo: function chuchuanSettingInfo(uid) {
return request('/chuchuan/info', true, 'get', { uid: uid });
},
chuchuanSettingModify: function chuchuanSettingModify(data) {
return request('/chuchuan/modify', true, 'post', data);
},
chuchuanGoodsList: function chuchuanGoodsList(data) {
return request('/chuchuanGoods/list', true, 'post', data);
},
chuchuanGoodsAdd: function chuchuanGoodsAdd(data) {
return request('/chuchuanGoods/add', true, 'post', data);
},
chuchuanGoodsRemove: function chuchuanGoodsRemove(token, goodsId) {
return request('/chuchuanGoods/remove', true, 'post', { token: token, goodsId: goodsId });
},
chuchuanGoodsCheck: function chuchuanGoodsCheck(token, goodsId) {
return request('/chuchuanGoods/check', true, 'get', { token: token, goodsId: goodsId });
},
// 寄存
jicunGoodsList: function jicunGoodsList(data) {
return request('/jicunGoods/list', true, 'post', data);
},
jicunGoodsDetail: function jicunGoodsDetail(data) {
return request('/jicunGoods/detail', true, 'get', data);
},
// stripe
stripeAddCard: function stripeAddCard(data) {
return request('/pay/stripe/addCard', true, 'post', data);
},
stripeCardList: function stripeCardList(token) {
return request('/pay/stripe/cardList', true, 'get', { token: token });
},
stripeDelCard: function stripeDelCard(token, cardId) {
return request('/pay/stripe/deleteCard', true, 'post', { token: token, cardId: cardId });
},
stripeCharge: function stripeCharge(data) {
return request('/pay/stripe/charge', true, 'post', data);
},
// ocr
ocrBusinessLicense: function ocrBusinessLicense(imageUrl) {
return request(COMMON_BASE_URL + subDomain + '/ocr/businessLicense', false, 'post', { imageUrl: imageUrl });
},
ocrIdcard: function ocrIdcard(imageUrl) {
return request(COMMON_BASE_URL + subDomain + '/ocr/idcard', false, 'post', { imageUrl: imageUrl });
},
ocrBankcard: function ocrBankcard(imageUrl) {
return request(COMMON_BASE_URL + subDomain + '/ocr/bankcard', false, 'post', { imageUrl: imageUrl });
},
ocrDriverLicense: function ocrDriverLicense(imageUrl) {
return request(COMMON_BASE_URL + subDomain + '/ocr/driverLicense', false, 'post', { imageUrl: imageUrl });
},
// 朋友圈
momentsPublish: function momentsPublish(data) {
return request('/user/moments/publish', true, 'post', data);
},
userMomentsList: function userMomentsList(data) {
return request('/user/moments/list', true, 'get', data);
},
momentsDetail: function momentsDetail(token, momentsId) {
return request('/user/moments/detail', true, 'get', { token: token, momentsId: momentsId });
},
momentsDelete: function momentsDelete(token, momentsId) {
return request('/user/moments/del', true, 'post', { token: token, momentsId: momentsId });
},
momentsDeleteComment: function momentsDeleteComment(token, commentId) {
return request('/user/moments/delCommon', true, 'post', { token: token, commentId: commentId });
},
momentsLike: function momentsLike(token, momentsId) {
return request('/user/moments/like', true, 'post', { token: token, momentsId: momentsId });
},
momentsComment: function momentsComment(token, momentsId) {
var uid = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var content = arguments[3];
return request('/user/moments/comment', true, 'post', { token: token, momentsId: momentsId, uid: uid, content: content });
},
momentsCommentLogs: function momentsCommentLogs(data) {
return request('/user/moments/logs', true, 'get', data);
},
momentsLogsRead: function momentsLogsRead(token, logsIds) {
return request('/user/moments/logRead', true, 'post', { token: token, logsIds: logsIds });
},
bottleMsgPublish: function bottleMsgPublish(data) {
return request('/bottleMsg/publish', true, 'post', data);
},
bottleMsgSalvage: function bottleMsgSalvage(token) {
return request('/bottleMsg/salvage', true, 'get', { token: token });
},
userInvoiceInfo: function userInvoiceInfo(token) {
return request('/userInvoice/info', true, 'get', { token: token });
},
userInvoiceUnbind: function userInvoiceUnbind(token) {
return request('/userInvoice/unbind', true, 'post', { token: token });
},
userInvoiceBind: function userInvoiceBind(data) {
return request('/userInvoice/bind', true, 'post', data);
},
goodsLendsList: function goodsLendsList(data) {
return request('/goodsLends/list', true, 'post', data);
},
goodsLendsLogs: function goodsLendsLogs(data) {
return request('/goodsLends/logs', true, 'post', data);
},
// 支付宝小程序
aliappUserRegister: function aliappUserRegister(data) {
return request('/user/aliapp/register', true, 'post', data);
},
aliappUserLogin: function aliappUserLogin(data) {
return request('/user/aliapp/login', true, 'post', data);
},
aliappUserAuthorize: function aliappUserAuthorize(data) {
return request('/user/aliapp/authorize', true, 'post', data);
},
aliappWebUserAuthorize: function aliappWebUserAuthorize(data) {
return request('/user/aliappweb/authorize', true, 'post', data);
},
aliappQrcode: function aliappQrcode(content) {
return request('/user/aliapp/qrcode', true, 'post', { content: content });
},
aliappMiniappBindMobile: function aliappMiniappBindMobile(data) {
return request('/user/aliapp/bindMobile', true, 'post', data);
},
aliappBindMobile: function aliappBindMobile(data) {
return request('/user/aliapp/bindMobile', true, 'post', data);
},
aliappGetMobile: function aliappGetMobile(encryptedData) {
return request('/user/aliapp/getMobile', true, 'post', { encryptedData: encryptedData });
},
tempDataSet: function tempDataSet(key, content) {
return request('/tempData/set', true, 'post', { key: key, content: content });
},
tempDataGet: function tempDataGet(key) {
return request('/tempData/get', true, 'get', { key: key });
},
tempDataSetV2: function tempDataSetV2(key, content) {
return request(COMMON_BASE_URL + merchantId + '/tempData/set', true, 'post', { key: key, content: content });
},
tempDataGetV2: function tempDataGetV2(key) {
return request(COMMON_BASE_URL + merchantId + '/tempData/get', true, 'get', { key: key });
},
commonDatetime: function commonDatetime() {
return request('/common/datetime', true, 'get');
},
commonDays: function commonDays() {
var startDay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var days = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/common/days', false, 'get', { startDay: startDay, days: days });
},
commonDiffMillis: function commonDiffMillis() {
var d1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var d2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/common/diffMillis', false, 'get', { d1: d1, d2: d2 });
},
// 企业应用 组织/成员/网盘
organizePrices: function organizePrices() {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/prices', true, 'get');
},
organizeCreate: function organizeCreate(data) {
return request(COMMON_BASE_URL + subDomain + '/organizeInfo/create', true, 'post', data);
},
organizeUpgrade: function organizeUpgrade(data) {
return request(COMMON_BASE_URL + subDomain + '/organizeInfo/upgrade', true, 'post', data);
},
organizeModify: function organizeModify(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/modify', true, 'post', data);
},
organizeJoinKey: function organizeJoinKey(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/joinKey', true, 'get', data);
},
organizeJoin: function organizeJoin(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/join', true, 'post', data);
},
organizeGrantAdmin: function organizeGrantAdmin(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/grantAdmin', true, 'post', data);
},
organizeKick: function organizeKick(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/kick', true, 'post', data);
},
organizeKickAllMembers: function organizeKickAllMembers(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/kickAllMembers', true, 'post', data);
},
organizeKickSelf: function organizeKickSelf(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/kickSelf', true, 'post', data);
},
organizeNick: function organizeNick(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/nick', true, 'post', data);
},
organizeDelete: function organizeDelete(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/deleteOrganize', true, 'post', data);
},
organizeMyOrganizeInfo: function organizeMyOrganizeInfo(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/myOrganizeInfo', true, 'post', data);
},
organizeDetail: function organizeDetail(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/organizeDetail', true, 'get', data);
},
organizeMembers: function organizeMembers(data) {
return request(CMS_BASE_URL + subDomain + '/organizeInfo/members', true, 'post', data);
},
organizeNoticeList: function organizeNoticeList(data) {
return request(CMS_BASE_URL + subDomain + '/organizeNotice/list', true, 'post', data);
},
organizeNoticeDetail: function organizeNoticeDetail(data) {
return request(CMS_BASE_URL + subDomain + '/organizeNotice/detail', true, 'get', data);
},
organizeNoticeSave: function organizeNoticeSave(data) {
return request(CMS_BASE_URL + subDomain + '/organizeNotice/save', true, 'post', data);
},
organizeNoticeDelete: function organizeNoticeDelete(data) {
return request(CMS_BASE_URL + subDomain + '/organizeNotice/del', true, 'post', data);
},
organizePanUploadGetSignature: function organizePanUploadGetSignature(data) {
return request(CMS_BASE_URL + subDomain + '/organizePan/uploadGetSignature', true, 'post', data);
},
organizePanUploadV2: function organizePanUploadV2(data) {
return request(CMS_BASE_URL + subDomain + '/organizePan/upload', true, 'post', data);
},
organizePanDownloadV2: function organizePanDownloadV2(data) {
return request(CMS_BASE_URL + subDomain + '/organizePan/download', true, 'get', data);
},
organizePanFiles: function organizePanFiles(data) {
return request(CMS_BASE_URL + subDomain + '/organizePan/files', true, 'post', data);
},
organizePanModify: function organizePanModify(data) {
return request(CMS_BASE_URL + subDomain + '/organizePan/modify', true, 'post', data);
},
organizePanDelete: function organizePanDelete(data) {
return request(CMS_BASE_URL + subDomain + '/organizePan/del', true, 'post', data);
},
newsExtFieldList: function newsExtFieldList(token, organizeId, newsId) {
return request('/newsExtField/extFields', true, 'get', { token: token, organizeId: organizeId, newsId: newsId });
},
newsExtFieldDynamic: function newsExtFieldDynamic(token, newsId) {
return request('/newsExtField/dynamic', true, 'get', { token: token, newsId: newsId });
},
newsExtFieldSet: function newsExtFieldSet(data) {
return request('/newsExtField/setField', true, 'post', data);
},
newsExtFieldInit: function newsExtFieldInit(data) {
return request(CMS_BASE_URL + subDomain + '/newsExtField/initFields', true, 'post', data);
},
newsExtFieldListV2: function newsExtFieldListV2(data) {
return request(CMS_BASE_URL + subDomain + '/newsExtField/extFields', true, 'get', data);
},
newsExtFieldDynamicV2: function newsExtFieldDynamicV2(data) {
return request(CMS_BASE_URL + subDomain + '/newsExtField/dynamic', true, 'get', data);
},
newsExtFieldSetV2: function newsExtFieldSetV2(data) {
return request(CMS_BASE_URL + subDomain + '/newsExtField/setField', true, 'post', data);
},
userAttendantList: function userAttendantList(data) {
return request('/user/attendant/list', true, 'post', data);
},
userAttendantDetail: function userAttendantDetail(id) {
var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/user/attendant/detail', true, 'get', { id: id, token: token });
},
userAttendantGoods: function userAttendantGoods(id) {
return request('/user/attendant/goods', true, 'get', { id: id });
},
userAttendantGoodsSet: function userAttendantGoodsSet(token, ids) {
return request('/user/attendant/goodsSet', true, 'post', { token: token, ids: ids });
},
userAttendantBindShop: function userAttendantBindShop(token, shopId) {
return request('/user/attendant/bindShop', true, 'post', { shopId: shopId, token: token });
},
userAttendantUnBindShop: function userAttendantUnBindShop(token) {
return request('/user/attendant/unbindShop', true, 'post', { token: token });
},
userAttendantChangeStatus: function userAttendantChangeStatus(data) {
return request('/user/attendant/changeStatus', true, 'post', data);
},
userAttendantDaysTimesAttendant: function userAttendantDaysTimesAttendant(goodsId, day) {
return request('/user/attendant/daysTimesAttendant', true, 'get', { goodsId: goodsId, day: day });
},
userAttendantDaysTimesAttendantSetQuery: function userAttendantDaysTimesAttendantSetQuery(token, day) {
return request('/user/attendant/daysTimesAttendant/set/query', true, 'get', { token: token, day: day });
},
userAttendantDaysTimesAttendantSet: function userAttendantDaysTimesAttendantSet(data) {
return request('/user/attendant/daysTimesAttendant/set', true, 'post', data);
},
userAttendantListReputation: function userAttendantListReputation(data) {
return request('/user/attendant/listReputation', true, 'post', data);
},
userAttendantShowPics: function userAttendantShowPics(id) {
return request('/user/attendant/showPics', true, 'get', { id: id });
},
userAttendantShowPicsAdd: function userAttendantShowPicsAdd(token, url) {
return request('/user/attendant/showPicsAdd', true, 'post', { token: token, url: url });
},
userAttendantShowPicsDel: function userAttendantShowPicsDel(token, id) {
return request('/user/attendant/showPicsDel', true, 'post', { token: token, id: id });
},
userAttendantUpdate: function userAttendantUpdate(data) {
return request('/user/attendant/update', true, 'post', data);
},
userAttendantOrderServing: function userAttendantOrderServing(token, orderId) {
return request('/order/serving', true, 'post', { token: token, orderId: orderId });
},
userAttendantOrderRejectOrder: function userAttendantOrderRejectOrder(token, orderId) {
return request('/order/rejectOrder', true, 'post', { token: token, orderId: orderId });
},
userAttendantOrderSuccess: function userAttendantOrderSuccess(token, orderId) {
return request('/order/success', true, 'post', { token: token, orderId: orderId });
},
shopCategory: function shopCategory() {
return request('/shopCategory/all', true, 'get');
},
shopCategoryDetail: function shopCategoryDetail(id) {
return request('/shopCategory/info', true, 'get', { id: id });
},
yudingStatistics: function yudingStatistics(day) {
return request('/shop/goods/yudingStatistics', true, 'get', { day: day });
},
contactList: function contactList() {
return request('/contact/list', true, 'get');
},
distributedLock: function distributedLock(key, seconds) {
return request('/distributedLock/lock', true, 'get', { key: key, seconds: seconds });
},
distributedLockRelease: function distributedLockRelease(key) {
return request('/distributedLock/lock', true, 'get', { key: key });
},
communitySetting: function communitySetting() {
return request('/community/setting', true, 'get');
},
communityLeaderApply: function communityLeaderApply(data) {
return request('/communityLeader/apply', true, 'post', data);
},
communityLeaderApplyInfo: function communityLeaderApplyInfo(token) {
return request('/communityLeader/apply/info', true, 'get', { token: token });
},
communityLeaderBuy: function communityLeaderBuy(token) {
return request('/communityLeader/buy', true, 'post', { token: token });
},
communityOrderFahuo: function communityOrderFahuo(data) {
return request('/communityOrder/fahuo', true, 'post', data);
},
wxmpOpenid: function wxmpOpenid(code) {
return request('/user/wxmp/openid', true, 'get', { code: code });
},
listingSet: function listingSet() {
return request('/listingSet/info', true, 'get');
},
listingMyListing: function listingMyListing(token) {
return request('/listingInfo/myListing', true, 'get', { token: token });
},
listingSave: function listingSave(data) {
return request('/listingInfo/save', true, 'post', data);
},
listingDetail: function listingDetail(id) {
return request('/listingInfo/detail', true, 'get', { id: id });
},
listingCancel: function listingCancel(token, id) {
return request('/listingInfo/cancel', true, 'post', { token: token, id: id });
},
listingSuccess: function listingSuccess(token, id) {
return request('/listingInfo/success', true, 'post', { token: token, id: id });
},
listingDelete: function listingDelete(token, id) {
return request('/listingInfo/delete', true, 'post', { token: token, id: id });
},
listingAddGoods: function listingAddGoods(data) {
return request('/listingInfo/addGoods', true, 'post', data);
},
listingRemoveGoods: function listingRemoveGoods(data) {
return request('/listingInfo/removeGoods', true, 'post', data);
},
listingJoinList: function listingJoinList(data) {
return request('/listingInfo/joinList', true, 'post', data);
},
attendantAcceptOrder: function attendantAcceptOrder(data) {
return request('/order/acceptOrder', true, 'post', data);
},
orderCancelOrderPeriod: function orderCancelOrderPeriod(data) {
return request('/order/cancelOrderPeriod', true, 'post', data);
},
orderStartOrderPeriod: function orderStartOrderPeriod(data) {
return request('/order/startOrderPeriod', true, 'post', data);
},
shansongCourierInfo: function shansongCourierInfo(data) {
return request('/order/shansongCourierInfo', true, 'get', data);
},
shansongOrderInfo: function shansongOrderInfo(data) {
return request('/order/shansongOrderInfo', true, 'get', data);
},
userAttendantOrderStatistics: function userAttendantOrderStatistics(data) {
return request('/order/statisticsJishi', true, 'get', data);
},
keloopOrderLogs: function keloopOrderLogs(data) {
return request('/order/keloop/orderLogs', true, 'get', data);
},
keloopCourierTag: function keloopCourierTag(data) {
return request('/order/keloop/courierTag', true, 'get', data);
},
workingHoursMySubmitLogs: function workingHoursMySubmitLogs(data) {
return request('/workingHours/mySubmitLogs', true, 'post', data);
},
workingHoursSubmit: function workingHoursSubmit(data) {
return request('/workingHours/submit', true, 'post', data);
},
workingHoursBossReport: function workingHoursBossReport(data) {
return request('/workingHours/bossReport', true, 'post', data);
},
workingHoursMyProject: function workingHoursMyProject(data) {
return request('/workingHours/myProject', true, 'post', data);
},
workingHoursProjectInfo: function workingHoursProjectInfo(code) {
return request('/workingHours/project', true, 'get', { code: code });
},
bestpayProCreateOrder: function bestpayProCreateOrder(data) {
return request('/pay/bestpay/proCreateOrder', true, 'post', data);
},
bestpayH5: function bestpayH5(data) {
return request('/pay/bestpay/h5', true, 'get', data);
},
shopIotDevices: function shopIotDevices(data) {
return request('/shopIot/devices', true, 'get', data);
},
shopIotCmds: function shopIotCmds(data) {
return request('/shopIot/cmds', true, 'get', data);
},
shopIotExecute: function shopIotExecute(data) {
return request('/shopIot/execute', true, 'post', data);
},
wxTemplateNumberList: function wxTemplateNumberList(token) {
return request('/wxTemplateNumber/list', true, 'get', { token: token });
},
wxTemplateNumberSubscribe: function wxTemplateNumberSubscribe(data) {
return request('/wxTemplateNumber/subscribe', true, 'post', data);
},
errandsTaskPublish: function errandsTaskPublish(data) {
return request('/errandsTask/publish', true, 'post', data);
},
errandsTaskPay: function errandsTaskPay(data) {
return request('/errandsTask/pay', true, 'post', data);
},
errandsTaskAccept: function errandsTaskAccept(data) {
return request('/errandsTask/accept', true, 'post', data);
},
errandsTaskFinish: function errandsTaskFinish(data) {
return request('/errandsTask/finish', true, 'post', data);
},
errandsTaskSuccess: function errandsTaskSuccess(data) {
return request('/errandsTask/success', true, 'post', data);
},
activityVoteInfoList: function activityVoteInfoList(data) {
return request('/activityVoteInfo/list', true, 'post', data);
},
activityVoteInfoJoinList: function activityVoteInfoJoinList(data) {
return request('/activityVoteInfo/joinList', true, 'post', data);
},
activityVoteInfoDetail: function activityVoteInfoDetail(id) {
return request('/activityVoteInfo/detail', true, 'get', { id: id });
},
activityVoteInfoJoinDetail: function activityVoteInfoJoinDetail(joinId) {
return request('/activityVoteInfo/joinDetail', true, 'get', { joinId: joinId });
},
activityVoteInfoScoreToVotes: function activityVoteInfoScoreToVotes(activityId) {
return request('/activityVoteInfo/scoreToVotes', true, 'get', { activityId: activityId });
},
activityVoteInfoFetchVoteNumber: function activityVoteInfoFetchVoteNumber(data) {
return request('/activityVoteInfo/fetchVoteNumber', true, 'post', data);
},
activityVoteInfoJoin: function activityVoteInfoJoin(data) {
return request('/activityVoteInfo/join', true, 'post', data);
},
activityVoteInfoVote: function activityVoteInfoVote(data) {
return request('/activityVoteInfo/vote', true, 'post', data);
},
activityVoteBlance: function activityVoteBlance(token, activityId) {
return request('/activityVoteInfo/balance', true, 'get', { token: token, activityId: activityId });
},
stringsToPlainText: function stringsToPlainText(content) {
var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/common/strings/plainText', true, 'post', { content: content, len: len });
},
blindBoxFriendsMatch: function blindBoxFriendsMatch(data) {
return request('/blindBoxFriends/match', true, 'post', data);
},
blindBoxFriendsPush: function blindBoxFriendsPush(data) {
return request('/blindBoxFriends/push', true, 'post', data);
},
blindBoxFriendsPay: function blindBoxFriendsPay(data) {
return request('/blindBoxFriends/pay', true, 'post', data);
},
blindBoxFriendsChangeStatus: function blindBoxFriendsChangeStatus(data) {
return request('/blindBoxFriends/changeStatus', true, 'post', data);
},
blindBoxFriendsDelete: function blindBoxFriendsDelete(data) {
return request('/blindBoxFriends/delete', true, 'post', data);
},
blindBoxFriendsPullLogs: function blindBoxFriendsPullLogs(data) {
return request('/blindBoxFriends/pullLogs', true, 'post', data);
},
blindBoxFriendsPushLogs: function blindBoxFriendsPushLogs(data) {
return request('/blindBoxFriends/pushLogs', true, 'post', data);
},
blindBoxFriendsRechargeRule: function blindBoxFriendsRechargeRule() {
return request('/blindBoxFriends/rechargeRule', true, 'get');
},
blindBoxFriendsBuyPullTimes: function blindBoxFriendsBuyPullTimes(data) {
return request('/blindBoxFriends/buyPullTimes', true, 'post', data);
},
blindBoxFriendsUnlock: function blindBoxFriendsUnlock(data) {
return request('/blindBoxFriends/unlock', true, 'post', data);
},
blindBoxFriendsBalance: function blindBoxFriendsBalance(token) {
return request('/blindBoxFriends/balance', true, 'get', { token: token });
},
cpactivityInfoDetail: function cpactivityInfoDetail(id) {
return request('/cpactivityInfo/detail', true, 'get', { id: id });
},
cpactivityUpdateUserInfo: function cpactivityUpdateUserInfo(data) {
return request('/cpactivityInfo/updateUserInfo', true, 'post', data);
},
cpactivityJoinDetail: function cpactivityJoinDetail(data) {
return request('/cpactivityInfo/join', true, 'get', data);
},
cpactivityJoin: function cpactivityJoin(data) {
return request('/cpactivityInfo/join', true, 'post', data);
},
cpactivityJoinDynamics: function cpactivityJoinDynamics(cpactivityId) {
return request('/cpactivityInfo/joinDynamics', true, 'get', { cpactivityId: cpactivityId });
},
cpactivityPay: function cpactivityPay(data) {
return request('/cpactivityInfo/pay', true, 'post', data);
},
volcesArkCreateChatCompletion: function volcesArkCreateChatCompletion(message) {
return request(COMMON_BASE_URL + subDomain + '/volcesArk/createChatCompletion', false, 'post', { message: message });
},
volcesArkChatCompletionResult: function volcesArkChatCompletionResult(key) {
return request(COMMON_BASE_URL + subDomain + '/volcesArk/result', false, 'get', { key: key });
}
};
/***/ })
/******/ ]);
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/index/index.js
================================================
const main = {
/**
* 渲染块
* @param {Object} params
*/
drawBlock({ text, width = 0, height, x, y, paddingLeft = 0, paddingRight = 0, borderWidth, backgroundColor, borderColor, borderRadius = 0, opacity = 1 }) {
// 判断是否块内有文字
let blockWidth = 0; // 块的宽度
let textX = 0;
let textY = 0;
if (typeof text !== 'undefined') {
// 如果有文字并且块的宽度小于文字宽度,块的宽度为 文字的宽度 + 内边距
const textWidth = this._getTextWidth(typeof text.text === 'string' ? text : text.text);
blockWidth = textWidth > width ? textWidth : width;
blockWidth += paddingLeft + paddingLeft;
const { textAlign = 'left', text: textCon } = text;
textY = height / 2 + y; // 文字的y轴坐标在块中线
if (textAlign === 'left') {
// 如果是右对齐,那x轴在块的最左边
textX = x + paddingLeft;
} else if (textAlign === 'center') {
textX = blockWidth / 2 + x;
} else {
textX = x + blockWidth - paddingRight;
}
} else {
blockWidth = width;
}
if (backgroundColor) {
// 画面
this.ctx.save();
this.ctx.setGlobalAlpha(opacity);
this.ctx.setFillStyle(backgroundColor);
if (borderRadius > 0) {
// 画圆角矩形
this._drawRadiusRect(x, y, blockWidth, height, borderRadius);
this.ctx.fill();
} else {
this.ctx.fillRect(this.toPx(x), this.toPx(y), this.toPx(blockWidth), this.toPx(height));
}
this.ctx.restore();
}
if (borderWidth) {
// 画线
this.ctx.save();
this.ctx.setGlobalAlpha(opacity);
this.ctx.setStrokeStyle(borderColor);
this.ctx.setLineWidth(this.toPx(borderWidth));
if (borderRadius > 0) {
// 画圆角矩形边框
this._drawRadiusRect(x, y, blockWidth, height, borderRadius);
this.ctx.stroke();
} else {
this.ctx.strokeRect(this.toPx(x), this.toPx(y), this.toPx(blockWidth), this.toPx(height));
}
this.ctx.restore();
}
if (text) {
this.drawText(Object.assign(text, { x: textX, y: textY }))
}
},
/**
* 渲染文字
* @param {Object} params
*/
drawText(params) {
const { x, y, fontSize, color, baseLine, textAlign, text, opacity = 1, width, lineNum, lineHeight } = params;
if (Object.prototype.toString.call(text) === '[object Array]') {
let preText = { x, y, baseLine };
text.forEach(item => {
preText.x += item.marginLeft || 0;
const textWidth = this._drawSingleText(Object.assign(item, {
...preText,
}));
preText.x += textWidth + (item.marginRight || 0); // 下一段字的x轴为上一段字x + 上一段字宽度
})
} else {
this._drawSingleText(params);
}
},
/**
* 渲染图片
*/
drawImage(data) {
const { imgPath, x, y, w, h, sx, sy, sw, sh, borderRadius = 0, borderWidth = 0, borderColor } = data;
this.ctx.save();
if (borderRadius > 0) {
this._drawRadiusRect(x, y, w, h, borderRadius);
this.ctx.strokeStyle = 'rgba(255,255,255,0)';
this.ctx.stroke();
this.ctx.clip();
this.ctx.drawImage(imgPath, this.toPx(sx), this.toPx(sy), this.toPx(sw), this.toPx(sh), this.toPx(x), this.toPx(y), this.toPx(w), this.toPx(h));
if (borderWidth > 0) {
this.ctx.setStrokeStyle(borderColor);
this.ctx.setLineWidth(this.toPx(borderWidth));
this.ctx.stroke();
}
} else {
this.ctx.drawImage(imgPath, this.toPx(sx), this.toPx(sy), this.toPx(sw), this.toPx(sh), this.toPx(x), this.toPx(y), this.toPx(w), this.toPx(h));
}
this.ctx.restore();
},
/**
* 渲染线
* @param {*} param0
*/
drawLine({ startX, startY, endX, endY, color, width }) {
this.ctx.save();
this.ctx.beginPath();
this.ctx.setStrokeStyle(color);
this.ctx.setLineWidth(this.toPx(width));
this.ctx.moveTo(this.toPx(startX), this.toPx(startY));
this.ctx.lineTo(this.toPx(endX), this.toPx(endY));
this.ctx.stroke();
this.ctx.closePath();
this.ctx.restore();
},
downloadResource({ images = [], pixelRatio = 1 }) {
const drawList = [];
this.drawArr = [];
images.forEach((image, index) => drawList.push(this._downloadImageAndInfo(image, index, pixelRatio)));
return Promise.all(drawList);
},
initCanvas(w, h, debug) {
return new Promise((resolve) => {
this.setData({
pxWidth: this.toPx(w),
pxHeight: this.toPx(h),
debug,
}, resolve);
});
}
}
const handle = {
/**
* 画圆角矩形
*/
_drawRadiusRect(x, y, w, h, r) {
const br = r / 2;
this.ctx.beginPath();
this.ctx.moveTo(this.toPx(x + br), this.toPx(y)); // 移动到左上角的点
this.ctx.lineTo(this.toPx(x + w - br), this.toPx(y));
this.ctx.arc(this.toPx(x + w - br), this.toPx(y + br), this.toPx(br), 2 * Math.PI * (3 / 4), 2 * Math.PI * (4 / 4))
this.ctx.lineTo(this.toPx(x + w), this.toPx(y + h - br));
this.ctx.arc(this.toPx(x + w - br), this.toPx(y + h - br), this.toPx(br), 0, 2 * Math.PI * (1 / 4))
this.ctx.lineTo(this.toPx(x + br), this.toPx(y + h));
this.ctx.arc(this.toPx(x + br), this.toPx(y + h - br), this.toPx(br), 2 * Math.PI * (1 / 4), 2 * Math.PI * (2 / 4))
this.ctx.lineTo(this.toPx(x), this.toPx(y + br));
this.ctx.arc(this.toPx(x + br), this.toPx(y + br), this.toPx(br), 2 * Math.PI * (2 / 4), 2 * Math.PI * (3 / 4))
},
/**
* 计算文本长度
* @param {Array|Object}} text 数组 或者 对象
*/
_getTextWidth(text) {
let texts = [];
if (Object.prototype.toString.call(text) === '[object Object]') {
texts.push(text);
} else {
texts = text;
}
let width = 0;
texts.forEach(({ fontSize, text, marginLeft = 0, marginRight = 0 }) => {
this.ctx.setFontSize(this.toPx(fontSize));
width += this.ctx.measureText(text).width + marginLeft + marginRight;
})
return this.toRpx(width);
},
/**
* 渲染一段文字
*/
_drawSingleText({ x, y, fontSize, color, baseLine, textAlign = 'left', text, opacity = 1, textDecoration = 'none',
width, lineNum = 1, lineHeight = 0, fontWeight = 'normal', fontStyle = 'normal', fontFamily = "sans-serif"}) {
this.ctx.save();
this.ctx.beginPath();
this.ctx.font = fontStyle + " " + fontWeight + " " + this.toPx(fontSize, true) + "px " + fontFamily
this.ctx.setGlobalAlpha(opacity);
// this.ctx.setFontSize(this.toPx(fontSize));
this.ctx.setFillStyle(color);
this.ctx.setTextBaseline(baseLine);
this.ctx.setTextAlign(textAlign);
let textWidth = this.toRpx(this.ctx.measureText(text).width);
const textArr = [];
if (textWidth > width) {
// 文本宽度 大于 渲染宽度
let fillText = '';
let line = 1;
for (let i = 0; i <= text.length - 1 ; i++) { // 将文字转为数组,一行文字一个元素
fillText = fillText + text[i];
if (this.toRpx(this.ctx.measureText(fillText).width) >= width) {
if (line === lineNum) {
if (i !== text.length - 1) {
fillText = fillText.substring(0, fillText.length - 1) + '...';
}
}
if(line <= lineNum) {
textArr.push(fillText);
}
fillText = '';
line++;
} else {
if(line <= lineNum) {
if(i === text.length -1){
textArr.push(fillText);
}
}
}
}
textWidth = width;
} else {
textArr.push(text);
}
textArr.forEach((item, index) => {
this.ctx.fillText(item, this.toPx(x), this.toPx(y + (lineHeight || fontSize) * index));
})
this.ctx.restore();
// textDecoration
if (textDecoration !== 'none') {
let lineY = y;
if (textDecoration === 'line-through') {
// 目前只支持贯穿线
lineY = y;
// 小程序画布baseLine偏移阈值
let threshold = 5;
// 根据baseLine的不同对贯穿线的Y坐标做相应调整
switch (baseLine) {
case 'top':
lineY += fontSize / 2 + threshold;
break;
case 'middle':
break;
case 'bottom':
lineY -= fontSize / 2 + threshold;
break;
default:
lineY -= fontSize / 2 - threshold;
break;
}
}
this.ctx.save();
this.ctx.moveTo(this.toPx(x), this.toPx(lineY));
this.ctx.lineTo(this.toPx(x) + this.toPx(textWidth), this.toPx(lineY));
this.ctx.setStrokeStyle(color);
this.ctx.stroke();
this.ctx.restore();
}
return textWidth;
},
}
const helper = {
/**
* 下载图片并获取图片信息
*/
_downloadImageAndInfo(image, index, pixelRatio) {
return new Promise((resolve, reject) => {
const { x, y, url, zIndex } = image;
const imageUrl = url;
// 下载图片
this._downImage(imageUrl, index)
// 获取图片信息
.then(imgPath => this._getImageInfo(imgPath, index))
.then(({ imgPath, imgInfo }) => {
// 根据画布的宽高计算出图片绘制的大小,这里会保证图片绘制不变形
let sx;
let sy;
const borderRadius = image.borderRadius || 0;
const setWidth = image.width;
const setHeight = image.height;
const width = this.toRpx(imgInfo.width / pixelRatio);
const height = this.toRpx(imgInfo.height / pixelRatio);
if (width / height <= setWidth / setHeight) {
sx = 0;
sy = (height - ((width / setWidth) * setHeight)) / 2;
} else {
sy = 0;
sx = (width - ((height / setHeight) * setWidth)) / 2;
}
this.drawArr.push({
type: 'image',
borderRadius,
borderWidth: image.borderWidth,
borderColor: image.borderColor,
zIndex: typeof zIndex !== 'undefined' ? zIndex : index,
imgPath,
sx,
sy,
sw: (width - (sx * 2)),
sh: (height - (sy * 2)),
x,
y,
w: setWidth,
h: setHeight,
});
resolve();
})
.catch(err => reject(err));
});
},
/**
* 下载图片资源
* @param {*} imageUrl
*/
_downImage(imageUrl) {
return new Promise((resolve, reject) => {
if (/^http/.test(imageUrl) && !new RegExp(wx.env.USER_DATA_PATH).test(imageUrl)) {
wx.downloadFile({
url: this._mapHttpToHttps(imageUrl),
success: (res) => {
if (res.statusCode === 200) {
resolve(res.tempFilePath);
} else {
reject(res.errMsg);
}
},
fail(err) {
reject(err);
},
});
} else {
// 支持本地地址
resolve(imageUrl);
}
});
},
/**
* 获取图片信息
* @param {*} imgPath
* @param {*} index
*/
_getImageInfo(imgPath, index) {
return new Promise((resolve, reject) => {
wx.getImageInfo({
src: imgPath,
success(res) {
resolve({ imgPath, imgInfo: res, index });
},
fail(err) {
reject(err);
},
});
});
},
toPx(rpx, int) {
if (int) {
return parseInt(rpx * this.factor * this.pixelRatio);
}
return rpx * this.factor * this.pixelRatio;
},
toRpx(px, int) {
if (int) {
return parseInt(px / this.factor);
}
return px / this.factor;
},
/**
* 将http转为https
* @param {String}} rawUrl 图片资源url
*/
_mapHttpToHttps(rawUrl) {
if (rawUrl.indexOf(':') < 0) {
return rawUrl;
}
const urlComponent = rawUrl.split(':');
if (urlComponent.length === 2) {
if (urlComponent[0] === 'http') {
urlComponent[0] = 'https';
return `${urlComponent[0]}:${urlComponent[1]}`;
}
}
return rawUrl;
},
}
Component({
properties: {
},
created() {
const sysInfo = wx.getSystemInfoSync();
const screenWidth = sysInfo.screenWidth;
this.factor = screenWidth / 750;
},
methods: Object.assign({
/**
* 计算画布的高度
* @param {*} config
*/
getHeight(config) {
const getTextHeight = (text) => {
let fontHeight = text.lineHeight || text.fontSize;
let height = 0;
if (text.baseLine === 'top') {
height = fontHeight;
} else if (text.baseLine === 'middle') {
height = fontHeight / 2;
} else {
height = 0;
}
return height;
}
const heightArr = [];
(config.blocks || []).forEach((item) => {
heightArr.push(item.y + item.height);
});
(config.texts || []).forEach((item) => {
let height;
if (Object.prototype.toString.call(item.text) === '[object Array]') {
item.text.forEach((i) => {
height = getTextHeight({...i, baseLine: item.baseLine});
heightArr.push(item.y + height);
});
} else {
height = getTextHeight(item);
heightArr.push(item.y + height);
}
});
(config.images || []).forEach((item) => {
heightArr.push(item.y + item.height);
});
(config.lines || []).forEach((item) => {
heightArr.push(item.startY);
heightArr.push(item.endY);
});
const sortRes = heightArr.sort((a, b) => b - a);
let canvasHeight = 0;
if (sortRes.length > 0) {
canvasHeight = sortRes[0];
}
if (config.height < canvasHeight || !config.height) {
return canvasHeight;
} else {
return config.height;
}
},
create(config) {
this.ctx = wx.createCanvasContext('canvasid', this);
this.pixelRatio = config.pixelRatio || 1;
const height = this.getHeight(config);
this.initCanvas(config.width, height, config.debug)
.then(() => {
// 设置画布底色
if (config.backgroundColor) {
this.ctx.save();
this.ctx.setFillStyle(config.backgroundColor);
this.ctx.fillRect(0, 0, this.toPx(config.width), this.toPx(height));
this.ctx.restore();
}
const { texts = [], images = [], blocks = [], lines = [] } = config;
const queue = this.drawArr
.concat(texts.map((item) => {
item.type = 'text';
item.zIndex = item.zIndex || 0;
return item;
}))
.concat(blocks.map((item) => {
item.type = 'block';
item.zIndex = item.zIndex || 0;
return item;
}))
.concat(lines.map((item) => {
item.type = 'line';
item.zIndex = item.zIndex || 0;
return item;
}));
// 按照顺序排序
queue.sort((a, b) => a.zIndex - b.zIndex);
queue.forEach((item) => {
if (item.type === 'image') {
this.drawImage(item)
} else if (item.type === 'text') {
this.drawText(item)
} else if (item.type === 'block') {
this.drawBlock(item)
} else if (item.type === 'line') {
this.drawLine(item)
}
});
const res = wx.getSystemInfoSync();
const platform = res.platform;
let time = 0;
if (platform === 'android') {
// 在安卓平台,经测试发现如果海报过于复杂在转换时需要做延时,要不然样式会错乱
time = 300;
}
this.ctx.draw(false, () => {
setTimeout(() => {
wx.canvasToTempFilePath({
canvasId: 'canvasid',
success: (res) => {
this.triggerEvent('success', res.tempFilePath);
},
fail: (err) => {
this.triggerEvent('fail', err);
},
}, this);
}, time);
});
})
.catch((err) => {
wx.showToast({ icon: 'none', title: err.errMsg || '生成失败' });
console.error(err);
});
},
}, main, handle, helper),
});
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/index/index.json
================================================
{
"component": true
}
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/index/index.wxml
================================================
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/index/index.wxss
================================================
.canvas {
width: 750rpx;
height: 750rpx;
}
.canvas.pro {
position: absolute;
bottom: 0;
left: 0;
transform: translate3d(-9999rpx, 0, 0);
}
.canvas.debug {
position: absolute;
bottom: 0;
left: 0;
border: 1rpx solid #ccc;
}
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/poster/index.js
================================================
Component({
properties: {
config: {
type: Object,
value: {},
},
preload: { // 是否预下载图片资源
type: Boolean,
value: false,
},
hideLoading: { // 是否隐藏loading
type: Boolean,
value: false,
}
},
ready() {
if (this.data.preload) {
const poster = this.selectComponent('#poster');
this.downloadStatus = 'doing';
poster.downloadResource(this.data.config).then(() => {
this.downloadStatus = 'success';
this.trigger('downloadSuccess');
}).catch((e) => {
this.downloadStatus = 'fail';
this.trigger('downloadFail', e);
});
}
},
methods: {
trigger(event, data) {
if (this.listener && typeof this.listener[event] === 'function') {
this.listener[event](data);
}
},
once(event, fun) {
if (typeof this.listener === 'undefined') {
this.listener = {};
}
this.listener[event] = fun;
},
downloadResource(reset) {
return new Promise((resolve, reject) => {
if (reset) {
this.downloadStatus = null;
}
const poster = this.selectComponent('#poster');
if (this.downloadStatus && this.downloadStatus !== 'fail') {
if (this.downloadStatus === 'success') {
resolve();
} else {
this.once('downloadSuccess', () => resolve());
this.once('downloadFail', (e) => reject(e));
}
} else {
poster.downloadResource(this.data.config)
.then(() => {
this.downloadStatus = 'success';
resolve();
})
.catch((e) => reject(e));
}
})
},
onCreate(reset = false) {
!this.data.hideLoading && wx.showLoading({ mask: true, title: '生成中' });
return this.downloadResource(typeof reset === 'boolean' && reset).then(() => {
!this.data.hideLoading && wx.hideLoading();
const poster = this.selectComponent('#poster');
poster.create(this.data.config);
})
.catch((err) => {
!this.data.hideLoading && wx.hideLoading();
wx.showToast({ icon: 'none', title: err.errMsg || '生成失败' });
console.error(err);
this.triggerEvent('fail', err);
})
},
onCreateSuccess(e) {
const { detail } = e;
this.triggerEvent('success', detail);
},
onCreateFail(err) {
console.error(err);
this.triggerEvent('fail', err);
}
}
})
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/poster/index.json
================================================
{
"component": true,
"usingComponents": {
"we-canvas": "../index/index"
}
}
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/poster/index.wxml
================================================
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/poster/index.wxss
================================================
================================================
FILE: miniprogram_npm/wxa-plugin-canvas/poster/poster.js
================================================
const defaultOptions = {
selector: '#poster'
};
function Poster(options = {}, that) {
options = {
...defaultOptions,
...options,
};
const pages = getCurrentPages();
let ctx = pages[pages.length - 1];
if (that) ctx = that
const poster = ctx.selectComponent(options.selector);
delete options.selector;
return poster;
};
Poster.create = (reset = false, that) => {
const poster = Poster({}, that);
if (!poster) {
console.error('请设置组件的id="poster"!!!');
} else {
return Poster({}, that).onCreate(reset);
}
}
export default Poster;
================================================
FILE: miniprogram_npm/wxbarcode/index.js
================================================
module.exports = (function() {
var __MODS__ = {};
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
__DEFINE__(1768619533625, function(require, module, exports) {
module.exports = require('./demo/utils')
}, function(modId) {var map = {"./demo/utils":1768619533626}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1768619533626, function(require, module, exports) {
var barcode = require('./barcode');
var qrcode = require('./qrcode');
function convert_length(length) {
return Math.round(wx.getSystemInfoSync().windowWidth * length / 750);
}
function barc(id, code, width, height) {
barcode.code128(wx.createCanvasContext(id), code, convert_length(width), convert_length(height))
}
function qrc(id, code, width, height) {
qrcode.api.draw(code, {
ctx: wx.createCanvasContext(id),
width: convert_length(width),
height: convert_length(height)
})
}
module.exports = {
barcode: barc,
qrcode: qrc
}
}, function(modId) { var map = {"./barcode":1768619533627,"./qrcode":1768619533628}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1768619533627, function(require, module, exports) {
var CHAR_TILDE = 126;
var CODE_FNC1 = 102;
var SET_STARTA = 103;
var SET_STARTB = 104;
var SET_STARTC = 105;
var SET_SHIFT = 98;
var SET_CODEA = 101;
var SET_CODEB = 100;
var SET_STOP = 106;
var REPLACE_CODES = {
CHAR_TILDE: CODE_FNC1 //~ corresponds to FNC1 in GS1-128 standard
}
var CODESET = {
ANY: 1,
AB: 2,
A: 3,
B: 4,
C: 5
};
function getBytes(str) {
var bytes = [];
for (var i = 0; i < str.length; i++) {
bytes.push(str.charCodeAt(i));
}
return bytes;
}
exports.code128 = function (ctx, text, width, height) {
width = parseInt(width);
height = parseInt(height);
var codes = stringToCode128(text);
var g = new Graphics(ctx, width, height);
var barWeight = g.area.width / ((codes.length - 3) * 11 + 35);
var x = g.area.left;
var y = g.area.top;
for (var i = 0; i < codes.length; i++) {
var c = codes[i];
//two bars at a time: 1 black and 1 white
for (var bar = 0; bar < 8; bar += 2) {
var barW = PATTERNS[c][bar] * barWeight;
// var barH = height - y - this.border;
var barH = height - y;
var spcW = PATTERNS[c][bar + 1] * barWeight;
//no need to draw if 0 width
if (barW > 0) {
g.fillFgRect(x, y, barW, barH);
}
x += barW + spcW;
}
}
ctx.draw();
}
function stringToCode128(text) {
var barc = {
currcs: CODESET.C
};
var bytes = getBytes(text);
//decide starting codeset
var index = bytes[0] == CHAR_TILDE ? 1 : 0;
var csa1 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB;
var csa2 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB;
barc.currcs = getBestStartSet(csa1, csa2);
barc.currcs = perhapsCodeC(bytes, barc.currcs);
//if no codeset changes this will end up with bytes.length+3
//start, checksum and stop
var codes = new Array();
switch (barc.currcs) {
case CODESET.A:
codes.push(SET_STARTA);
break;
case CODESET.B:
codes.push(SET_STARTB);
break;
default:
codes.push(SET_STARTC);
break;
}
for (var i = 0; i < bytes.length; i++) {
var b1 = bytes[i]; //get the first of a pair
//should we translate/replace
if (b1 in REPLACE_CODES) {
codes.push(REPLACE_CODES[b1]);
i++ //jump to next
b1 = bytes[i];
}
//get the next in the pair if possible
var b2 = bytes.length > (i + 1) ? bytes[i + 1] : -1;
codes = codes.concat(codesForChar(b1, b2, barc.currcs));
//code C takes 2 chars each time
if (barc.currcs == CODESET.C) i++;
}
//calculate checksum according to Code 128 standards
var checksum = codes[0];
for (var weight = 1; weight < codes.length; weight++) {
checksum += (weight * codes[weight]);
}
codes.push(checksum % 103);
codes.push(SET_STOP);
//encoding should now be complete
return codes;
function getBestStartSet(csa1, csa2) {
//tries to figure out the best codeset
//to start with to get the most compact code
var vote = 0;
vote += csa1 == CODESET.A ? 1 : 0;
vote += csa1 == CODESET.B ? -1 : 0;
vote += csa2 == CODESET.A ? 1 : 0;
vote += csa2 == CODESET.B ? -1 : 0;
//tie goes to B due to my own predudices
return vote > 0 ? CODESET.A : CODESET.B;
}
function perhapsCodeC(bytes, codeset) {
for (var i = 0; i < bytes.length; i++) {
var b = bytes[i]
if ((b < 48 || b > 57) && b != CHAR_TILDE)
return codeset;
}
return CODESET.C;
}
//chr1 is current byte
//chr2 is the next byte to process. looks ahead.
function codesForChar(chr1, chr2, currcs) {
var result = [];
var shifter = -1;
if (charCompatible(chr1, currcs)) {
if (currcs == CODESET.C) {
if (chr2 == -1) {
shifter = SET_CODEB;
currcs = CODESET.B;
}
else if ((chr2 != -1) && !charCompatible(chr2, currcs)) {
//need to check ahead as well
if (charCompatible(chr2, CODESET.A)) {
shifter = SET_CODEA;
currcs = CODESET.A;
}
else {
shifter = SET_CODEB;
currcs = CODESET.B;
}
}
}
}
else {
//if there is a next char AND that next char is also not compatible
if ((chr2 != -1) && !charCompatible(chr2, currcs)) {
//need to switch code sets
switch (currcs) {
case CODESET.A:
shifter = SET_CODEB;
currcs = CODESET.B;
break;
case CODESET.B:
shifter = SET_CODEA;
currcs = CODESET.A;
break;
}
}
else {
//no need to shift code sets, a temporary SHIFT will suffice
shifter = SET_SHIFT;
}
}
//ok some type of shift is nessecary
if (shifter != -1) {
result.push(shifter);
result.push(codeValue(chr2));
}
else {
if (currcs == CODESET.C) {
//include next as well
result.push(codeValue(chr1, chr2));
}
else {
result.push(codeValue(chr1));
}
}
barc.currcs = currcs;
return result;
}
}
//reduce the ascii code to fit into the Code128 char table
function codeValue(chr1, chr2) {
if (typeof chr2 == "undefined") {
return chr1 >= 32 ? chr1 - 32 : chr1 + 64;
}
else {
return parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2));
}
}
function charCompatible(chr, codeset) {
var csa = codeSetAllowedFor(chr);
if (csa == CODESET.ANY) return true;
//if we need to change from current
if (csa == CODESET.AB) return true;
if (csa == CODESET.A && codeset == CODESET.A) return true;
if (csa == CODESET.B && codeset == CODESET.B) return true;
return false;
}
function codeSetAllowedFor(chr) {
if (chr >= 48 && chr <= 57) {
//0-9
return CODESET.ANY;
}
else if (chr >= 32 && chr <= 95) {
//0-9 A-Z
return CODESET.AB;
}
else {
//if non printable
return chr < 32 ? CODESET.A : CODESET.B;
}
}
var Graphics = function(ctx, width, height) {
this.width = width;
this.height = height;
this.quiet = Math.round(this.width / 40);
this.border_size = 0;
this.padding_width = 0;
this.area = {
width : width - this.padding_width * 2 - this.quiet * 2,
height: height - this.border_size * 2,
top : this.border_size - 4,
left : this.padding_width + this.quiet
};
this.ctx = ctx;
this.fg = "#000000";
this.bg = "#ffffff";
// fill background
this.fillBgRect(0,0, width, height);
// fill center to create border
this.fillBgRect(0, this.border_size, width, height - this.border_size * 2);
}
//use native color
Graphics.prototype._fillRect = function(x, y, width, height, color) {
this.ctx.setFillStyle(color)
this.ctx.fillRect(x, y, width, height)
}
Graphics.prototype.fillFgRect = function(x,y, width, height) {
this._fillRect(x, y, width, height, this.fg);
}
Graphics.prototype.fillBgRect = function(x,y, width, height) {
this._fillRect(x, y, width, height, this.bg);
}
var PATTERNS = [
[2, 1, 2, 2, 2, 2, 0, 0], // 0
[2, 2, 2, 1, 2, 2, 0, 0], // 1
[2, 2, 2, 2, 2, 1, 0, 0], // 2
[1, 2, 1, 2, 2, 3, 0, 0], // 3
[1, 2, 1, 3, 2, 2, 0, 0], // 4
[1, 3, 1, 2, 2, 2, 0, 0], // 5
[1, 2, 2, 2, 1, 3, 0, 0], // 6
[1, 2, 2, 3, 1, 2, 0, 0], // 7
[1, 3, 2, 2, 1, 2, 0, 0], // 8
[2, 2, 1, 2, 1, 3, 0, 0], // 9
[2, 2, 1, 3, 1, 2, 0, 0], // 10
[2, 3, 1, 2, 1, 2, 0, 0], // 11
[1, 1, 2, 2, 3, 2, 0, 0], // 12
[1, 2, 2, 1, 3, 2, 0, 0], // 13
[1, 2, 2, 2, 3, 1, 0, 0], // 14
[1, 1, 3, 2, 2, 2, 0, 0], // 15
[1, 2, 3, 1, 2, 2, 0, 0], // 16
[1, 2, 3, 2, 2, 1, 0, 0], // 17
[2, 2, 3, 2, 1, 1, 0, 0], // 18
[2, 2, 1, 1, 3, 2, 0, 0], // 19
[2, 2, 1, 2, 3, 1, 0, 0], // 20
[2, 1, 3, 2, 1, 2, 0, 0], // 21
[2, 2, 3, 1, 1, 2, 0, 0], // 22
[3, 1, 2, 1, 3, 1, 0, 0], // 23
[3, 1, 1, 2, 2, 2, 0, 0], // 24
[3, 2, 1, 1, 2, 2, 0, 0], // 25
[3, 2, 1, 2, 2, 1, 0, 0], // 26
[3, 1, 2, 2, 1, 2, 0, 0], // 27
[3, 2, 2, 1, 1, 2, 0, 0], // 28
[3, 2, 2, 2, 1, 1, 0, 0], // 29
[2, 1, 2, 1, 2, 3, 0, 0], // 30
[2, 1, 2, 3, 2, 1, 0, 0], // 31
[2, 3, 2, 1, 2, 1, 0, 0], // 32
[1, 1, 1, 3, 2, 3, 0, 0], // 33
[1, 3, 1, 1, 2, 3, 0, 0], // 34
[1, 3, 1, 3, 2, 1, 0, 0], // 35
[1, 1, 2, 3, 1, 3, 0, 0], // 36
[1, 3, 2, 1, 1, 3, 0, 0], // 37
[1, 3, 2, 3, 1, 1, 0, 0], // 38
[2, 1, 1, 3, 1, 3, 0, 0], // 39
[2, 3, 1, 1, 1, 3, 0, 0], // 40
[2, 3, 1, 3, 1, 1, 0, 0], // 41
[1, 1, 2, 1, 3, 3, 0, 0], // 42
[1, 1, 2, 3, 3, 1, 0, 0], // 43
[1, 3, 2, 1, 3, 1, 0, 0], // 44
[1, 1, 3, 1, 2, 3, 0, 0], // 45
[1, 1, 3, 3, 2, 1, 0, 0], // 46
[1, 3, 3, 1, 2, 1, 0, 0], // 47
[3, 1, 3, 1, 2, 1, 0, 0], // 48
[2, 1, 1, 3, 3, 1, 0, 0], // 49
[2, 3, 1, 1, 3, 1, 0, 0], // 50
[2, 1, 3, 1, 1, 3, 0, 0], // 51
[2, 1, 3, 3, 1, 1, 0, 0], // 52
[2, 1, 3, 1, 3, 1, 0, 0], // 53
[3, 1, 1, 1, 2, 3, 0, 0], // 54
[3, 1, 1, 3, 2, 1, 0, 0], // 55
[3, 3, 1, 1, 2, 1, 0, 0], // 56
[3, 1, 2, 1, 1, 3, 0, 0], // 57
[3, 1, 2, 3, 1, 1, 0, 0], // 58
[3, 3, 2, 1, 1, 1, 0, 0], // 59
[3, 1, 4, 1, 1, 1, 0, 0], // 60
[2, 2, 1, 4, 1, 1, 0, 0], // 61
[4, 3, 1, 1, 1, 1, 0, 0], // 62
[1, 1, 1, 2, 2, 4, 0, 0], // 63
[1, 1, 1, 4, 2, 2, 0, 0], // 64
[1, 2, 1, 1, 2, 4, 0, 0], // 65
[1, 2, 1, 4, 2, 1, 0, 0], // 66
[1, 4, 1, 1, 2, 2, 0, 0], // 67
[1, 4, 1, 2, 2, 1, 0, 0], // 68
[1, 1, 2, 2, 1, 4, 0, 0], // 69
[1, 1, 2, 4, 1, 2, 0, 0], // 70
[1, 2, 2, 1, 1, 4, 0, 0], // 71
[1, 2, 2, 4, 1, 1, 0, 0], // 72
[1, 4, 2, 1, 1, 2, 0, 0], // 73
[1, 4, 2, 2, 1, 1, 0, 0], // 74
[2, 4, 1, 2, 1, 1, 0, 0], // 75
[2, 2, 1, 1, 1, 4, 0, 0], // 76
[4, 1, 3, 1, 1, 1, 0, 0], // 77
[2, 4, 1, 1, 1, 2, 0, 0], // 78
[1, 3, 4, 1, 1, 1, 0, 0], // 79
[1, 1, 1, 2, 4, 2, 0, 0], // 80
[1, 2, 1, 1, 4, 2, 0, 0], // 81
[1, 2, 1, 2, 4, 1, 0, 0], // 82
[1, 1, 4, 2, 1, 2, 0, 0], // 83
[1, 2, 4, 1, 1, 2, 0, 0], // 84
[1, 2, 4, 2, 1, 1, 0, 0], // 85
[4, 1, 1, 2, 1, 2, 0, 0], // 86
[4, 2, 1, 1, 1, 2, 0, 0], // 87
[4, 2, 1, 2, 1, 1, 0, 0], // 88
[2, 1, 2, 1, 4, 1, 0, 0], // 89
[2, 1, 4, 1, 2, 1, 0, 0], // 90
[4, 1, 2, 1, 2, 1, 0, 0], // 91
[1, 1, 1, 1, 4, 3, 0, 0], // 92
[1, 1, 1, 3, 4, 1, 0, 0], // 93
[1, 3, 1, 1, 4, 1, 0, 0], // 94
[1, 1, 4, 1, 1, 3, 0, 0], // 95
[1, 1, 4, 3, 1, 1, 0, 0], // 96
[4, 1, 1, 1, 1, 3, 0, 0], // 97
[4, 1, 1, 3, 1, 1, 0, 0], // 98
[1, 1, 3, 1, 4, 1, 0, 0], // 99
[1, 1, 4, 1, 3, 1, 0, 0], // 100
[3, 1, 1, 1, 4, 1, 0, 0], // 101
[4, 1, 1, 1, 3, 1, 0, 0], // 102
[2, 1, 1, 4, 1, 2, 0, 0], // 103
[2, 1, 1, 2, 1, 4, 0, 0], // 104
[2, 1, 1, 2, 3, 2, 0, 0], // 105
[2, 3, 3, 1, 1, 1, 2, 0] // 106
]
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1768619533628, function(require, module, exports) {
var QR = (function () {
// alignment pattern
var adelta = [
0, 11, 15, 19, 23, 27, 31, // force 1 pat
16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,
26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28
];
// version block
var vpat = [
0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d,
0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9,
0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75,
0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64,
0x541, 0xc69
];
// final format bits with mask: level << 3 | mask
var fmtword = [
0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M
0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q
0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H
];
// 4 per version: number of blocks 1,2; data width; ecc width
var eccblocks = [
1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,
1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,
1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,
1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,
1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,
2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,
2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,
2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,
2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,
2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,
4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,
2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,
4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,
3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,
5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,
5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,
1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,
5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,
3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,
3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,
4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,
2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,
4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,
6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,
8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,
10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,
8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,
3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,
7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,
5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,
13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,
17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,
17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,
13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,
12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,
6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,
17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,
4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,
20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,
19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30
];
// Galois field log table
var glog = [
0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,
0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,
0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,
0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,
0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88,
0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40,
0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d,
0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57,
0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18,
0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e,
0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61,
0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2,
0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6,
0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a,
0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7,
0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
];
// Galios field exponent table
var gexp = [
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,
0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,
0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,
0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,
0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,
0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,
0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,
0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,
0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,
0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,
0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,
0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00
];
// Working buffers:
// data input and ecc append, image working buffer, fixed part of image, run lengths for badness
var strinbuf=[], eccbuf=[], qrframe=[], framask=[], rlens=[];
// Control values - width is based on version, last 4 are from table.
var version, width, neccblk1, neccblk2, datablkw, eccblkwid;
var ecclevel = 2;
// set bit to indicate cell in qrframe is immutable. symmetric around diagonal
function setmask(x, y)
{
var bt;
if (x > y) {
bt = x;
x = y;
y = bt;
}
// y*y = 1+3+5...
bt = y;
bt *= y;
bt += y;
bt >>= 1;
bt += x;
framask[bt] = 1;
}
// enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask)
function putalign(x, y)
{
var j;
qrframe[x + width * y] = 1;
for (j = -2; j < 2; j++) {
qrframe[(x + j) + width * (y - 2)] = 1;
qrframe[(x - 2) + width * (y + j + 1)] = 1;
qrframe[(x + 2) + width * (y + j)] = 1;
qrframe[(x + j + 1) + width * (y + 2)] = 1;
}
for (j = 0; j < 2; j++) {
setmask(x - 1, y + j);
setmask(x + 1, y - j);
setmask(x - j, y - 1);
setmask(x + j, y + 1);
}
}
//========================================================================
// Reed Solomon error correction
// exponentiation mod N
function modnn(x)
{
while (x >= 255) {
x -= 255;
x = (x >> 8) + (x & 255);
}
return x;
}
var genpoly = [];
// Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given.
function appendrs(data, dlen, ecbuf, eclen)
{
var i, j, fb;
for (i = 0; i < eclen; i++)
strinbuf[ecbuf + i] = 0;
for (i = 0; i < dlen; i++) {
fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]];
if (fb != 255) /* fb term is non-zero */
for (j = 1; j < eclen; j++)
strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])];
else
for( j = ecbuf ; j < ecbuf + eclen; j++ )
strinbuf[j] = strinbuf[j + 1];
strinbuf[ ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])];
}
}
//========================================================================
// Frame data insert following the path rules
// check mask - since symmetrical use half.
function ismasked(x, y)
{
var bt;
if (x > y) {
bt = x;
x = y;
y = bt;
}
bt = y;
bt += y * y;
bt >>= 1;
bt += x;
return framask[bt];
}
//========================================================================
// Apply the selected mask out of the 8.
function applymask(m)
{
var x, y, r3x, r3y;
switch (m) {
case 0:
for (y = 0; y < width; y++)
for (x = 0; x < width; x++)
if (!((x + y) & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
break;
case 1:
for (y = 0; y < width; y++)
for (x = 0; x < width; x++)
if (!(y & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
break;
case 2:
for (y = 0; y < width; y++)
for (r3x = 0, x = 0; x < width; x++, r3x++) {
if (r3x == 3)
r3x = 0;
if (!r3x && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
break;
case 3:
for (r3y = 0, y = 0; y < width; y++, r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = r3y, x = 0; x < width; x++, r3x++) {
if (r3x == 3)
r3x = 0;
if (!r3x && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
case 4:
for (y = 0; y < width; y++)
for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++, r3x++) {
if (r3x == 3) {
r3x = 0;
r3y = !r3y;
}
if (!r3y && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
break;
case 5:
for (r3y = 0, y = 0; y < width; y++, r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = 0, x = 0; x < width; x++, r3x++) {
if (r3x == 3)
r3x = 0;
if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
case 6:
for (r3y = 0, y = 0; y < width; y++, r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = 0, x = 0; x < width; x++, r3x++) {
if (r3x == 3)
r3x = 0;
if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
case 7:
for (r3y = 0, y = 0; y < width; y++, r3y++) {
if (r3y == 3)
r3y = 0;
for (r3x = 0, x = 0; x < width; x++, r3x++) {
if (r3x == 3)
r3x = 0;
if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y))
qrframe[x + y * width] ^= 1;
}
}
break;
}
return;
}
// Badness coefficients.
var N1 = 3, N2 = 3, N3 = 40, N4 = 10;
// Using the table of the length of each run, calculate the amount of bad image
// - long runs or those that look like finders; called twice, once each for X and Y
function badruns(length)
{
var i;
var runsbad = 0;
for (i = 0; i <= length; i++)
if (rlens[i] >= 5)
runsbad += N1 + rlens[i] - 5;
// BwBBBwB as in finder
for (i = 3; i < length - 1; i += 2)
if (rlens[i - 2] == rlens[i + 2]
&& rlens[i + 2] == rlens[i - 1]
&& rlens[i - 1] == rlens[i + 1]
&& rlens[i - 1] * 3 == rlens[i]
// white around the black pattern? Not part of spec
&& (rlens[i - 3] == 0 // beginning
|| i + 3 > length // end
|| rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4)
)
runsbad += N3;
return runsbad;
}
// Calculate how bad the masked image is - blocks, imbalance, runs, or finders.
function badcheck()
{
var x, y, h, b, b1;
var thisbad = 0;
var bw = 0;
// blocks of same color.
for (y = 0; y < width - 1; y++)
for (x = 0; x < width - 1; x++)
if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y]
&& qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black
|| !(qrframe[x + width * y] || qrframe[(x + 1) + width * y]
|| qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white
thisbad += N2;
// X runs
for (y = 0; y < width; y++) {
rlens[0] = 0;
for (h = b = x = 0; x < width; x++) {
if ((b1 = qrframe[x + width * y]) == b)
rlens[h]++;
else
rlens[++h] = 1;
b = b1;
bw += b ? 1 : -1;
}
thisbad += badruns(h);
}
// black/white imbalance
if (bw < 0)
bw = -bw;
var big = bw;
var count = 0;
big += big << 2;
big <<= 1;
while (big > width * width)
big -= width * width, count++;
thisbad += count * N4;
// Y runs
for (x = 0; x < width; x++) {
rlens[0] = 0;
for (h = b = y = 0; y < width; y++) {
if ((b1 = qrframe[x + width * y]) == b)
rlens[h]++;
else
rlens[++h] = 1;
b = b1;
}
thisbad += badruns(h);
}
return thisbad;
}
function genframe(instring)
{
var x, y, k, t, v, i, j, m;
// find the smallest version that fits the string
t = instring.length;
version = 0;
do {
version++;
k = (ecclevel - 1) * 4 + (version - 1) * 16;
neccblk1 = eccblocks[k++];
neccblk2 = eccblocks[k++];
datablkw = eccblocks[k++];
eccblkwid = eccblocks[k];
k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9);
if (t <= k)
break;
} while (version < 40);
// FIXME - insure that it fits insted of being truncated
width = 17 + 4 * version;
// allocate, clear and setup data structures
v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
for( t = 0; t < v; t++ )
eccbuf[t] = 0;
strinbuf = instring.slice(0);
for( t = 0; t < width * width; t++ )
qrframe[t] = 0;
for( t = 0 ; t < (width * (width + 1) + 1) / 2; t++)
framask[t] = 0;
// insert finders - black to frame, white to mask
for (t = 0; t < 3; t++) {
k = 0;
y = 0;
if (t == 1)
k = (width - 7);
if (t == 2)
y = (width - 7);
qrframe[(y + 3) + width * (k + 3)] = 1;
for (x = 0; x < 6; x++) {
qrframe[(y + x) + width * k] = 1;
qrframe[y + width * (k + x + 1)] = 1;
qrframe[(y + 6) + width * (k + x)] = 1;
qrframe[(y + x + 1) + width * (k + 6)] = 1;
}
for (x = 1; x < 5; x++) {
setmask(y + x, k + 1);
setmask(y + 1, k + x + 1);
setmask(y + 5, k + x);
setmask(y + x + 1, k + 5);
}
for (x = 2; x < 4; x++) {
qrframe[(y + x) + width * (k + 2)] = 1;
qrframe[(y + 2) + width * (k + x + 1)] = 1;
qrframe[(y + 4) + width * (k + x)] = 1;
qrframe[(y + x + 1) + width * (k + 4)] = 1;
}
}
// alignment blocks
if (version > 1) {
t = adelta[version];
y = width - 7;
for (;;) {
x = width - 7;
while (x > t - 3) {
putalign(x, y);
if (x < t)
break;
x -= t;
}
if (y <= t + 9)
break;
y -= t;
putalign(6, y);
putalign(y, 6);
}
}
// single black
qrframe[8 + width * (width - 8)] = 1;
// timing gap - mask only
for (y = 0; y < 7; y++) {
setmask(7, y);
setmask(width - 8, y);
setmask(7, y + width - 7);
}
for (x = 0; x < 8; x++) {
setmask(x, 7);
setmask(x + width - 8, 7);
setmask(x, width - 8);
}
// reserve mask-format area
for (x = 0; x < 9; x++)
setmask(x, 8);
for (x = 0; x < 8; x++) {
setmask(x + width - 8, 8);
setmask(8, x);
}
for (y = 0; y < 7; y++)
setmask(8, y + width - 7);
// timing row/col
for (x = 0; x < width - 14; x++)
if (x & 1) {
setmask(8 + x, 6);
setmask(6, 8 + x);
}
else {
qrframe[(8 + x) + width * 6] = 1;
qrframe[6 + width * (8 + x)] = 1;
}
// version block
if (version > 6) {
t = vpat[version - 7];
k = 17;
for (x = 0; x < 6; x++)
for (y = 0; y < 3; y++, k--)
if (1 & (k > 11 ? version >> (k - 12) : t >> k)) {
qrframe[(5 - x) + width * (2 - y + width - 11)] = 1;
qrframe[(2 - y + width - 11) + width * (5 - x)] = 1;
}
else {
setmask(5 - x, 2 - y + width - 11);
setmask(2 - y + width - 11, 5 - x);
}
}
// sync mask bits - only set above for white spaces, so add in black bits
for (y = 0; y < width; y++)
for (x = 0; x <= y; x++)
if (qrframe[x + width * y])
setmask(x, y);
// convert string to bitstream
// 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported)
v = strinbuf.length;
// string to array
for( i = 0 ; i < v; i++ )
eccbuf[i] = strinbuf.charCodeAt(i);
strinbuf = eccbuf.slice(0);
// calculate max string length
x = datablkw * (neccblk1 + neccblk2) + neccblk2;
if (v >= x - 2) {
v = x - 2;
if (version > 9)
v--;
}
// shift and repack to insert length prefix
i = v;
if (version > 9) {
strinbuf[i + 2] = 0;
strinbuf[i + 3] = 0;
while (i--) {
t = strinbuf[i];
strinbuf[i + 3] |= 255 & (t << 4);
strinbuf[i + 2] = t >> 4;
}
strinbuf[2] |= 255 & (v << 4);
strinbuf[1] = v >> 4;
strinbuf[0] = 0x40 | (v >> 12);
}
else {
strinbuf[i + 1] = 0;
strinbuf[i + 2] = 0;
while (i--) {
t = strinbuf[i];
strinbuf[i + 2] |= 255 & (t << 4);
strinbuf[i + 1] = t >> 4;
}
strinbuf[1] |= 255 & (v << 4);
strinbuf[0] = 0x40 | (v >> 4);
}
// fill to end with pad pattern
i = v + 3 - (version < 10);
while (i < x) {
strinbuf[i++] = 0xec;
// buffer has room if (i == x) break;
strinbuf[i++] = 0x11;
}
// calculate and append ECC
// calculate generator polynomial
genpoly[0] = 1;
for (i = 0; i < eccblkwid; i++) {
genpoly[i + 1] = 1;
for (j = i; j > 0; j--)
genpoly[j] = genpoly[j]
? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1];
genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)];
}
for (i = 0; i <= eccblkwid; i++)
genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step
// append ecc to data buffer
k = x;
y = 0;
for (i = 0; i < neccblk1; i++) {
appendrs(y, datablkw, k, eccblkwid);
y += datablkw;
k += eccblkwid;
}
for (i = 0; i < neccblk2; i++) {
appendrs(y, datablkw + 1, k, eccblkwid);
y += datablkw + 1;
k += eccblkwid;
}
// interleave blocks
y = 0;
for (i = 0; i < datablkw; i++) {
for (j = 0; j < neccblk1; j++)
eccbuf[y++] = strinbuf[i + j * datablkw];
for (j = 0; j < neccblk2; j++)
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
}
for (j = 0; j < neccblk2; j++)
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
for (i = 0; i < eccblkwid; i++)
for (j = 0; j < neccblk1 + neccblk2; j++)
eccbuf[y++] = strinbuf[x + i + j * eccblkwid];
strinbuf = eccbuf;
// pack bits into frame avoiding masked area.
x = y = width - 1;
k = v = 1; // up, minus
/* inteleaved data and ecc codes */
m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
for (i = 0; i < m; i++) {
t = strinbuf[i];
for (j = 0; j < 8; j++, t <<= 1) {
if (0x80 & t)
qrframe[x + width * y] = 1;
do { // find next fill position
if (v)
x--;
else {
x++;
if (k) {
if (y != 0)
y--;
else {
x -= 2;
k = !k;
if (x == 6) {
x--;
y = 9;
}
}
}
else {
if (y != width - 1)
y++;
else {
x -= 2;
k = !k;
if (x == 6) {
x--;
y -= 8;
}
}
}
}
v = !v;
} while (ismasked(x, y));
}
}
// save pre-mask copy of frame
strinbuf = qrframe.slice(0);
t = 0; // best
y = 30000; // demerit
// for instead of while since in original arduino code
// if an early mask was "good enough" it wouldn't try for a better one
// since they get more complex and take longer.
for (k = 0; k < 8; k++) {
applymask(k); // returns black-white imbalance
x = badcheck();
if (x < y) { // current mask better than previous best?
y = x;
t = k;
}
if (t == 7)
break; // don't increment i to a void redoing mask
qrframe = strinbuf.slice(0); // reset for next pass
}
if (t != k) // redo best mask - none good enough, last wasn't t
applymask(t);
// add in final mask/ecclevel bytes
y = fmtword[t + ((ecclevel - 1) << 3)];
// low byte
for (k = 0; k < 8; k++, y >>= 1)
if (y & 1) {
qrframe[(width - 1 - k) + width * 8] = 1;
if (k < 6)
qrframe[8 + width * k] = 1;
else
qrframe[8 + width * (k + 1)] = 1;
}
// high byte
for (k = 0; k < 7; k++, y >>= 1)
if (y & 1) {
qrframe[8 + width * (width - 7 + k)] = 1;
if (k)
qrframe[(6 - k) + width * 8] = 1;
else
qrframe[7 + width * 8] = 1;
}
// return image
return qrframe;
}
var _canvas = null,
_size = null;
var api = {
get ecclevel () {
return ecclevel;
},
set ecclevel (val) {
ecclevel = val;
},
get size () {
return _size;
},
set size (val) {
_size = val
},
get canvas () {
return _canvas;
},
set canvas (el) {
_canvas = el;
},
getFrame: function (string) {
return genframe(string);
},
draw: function (string, canvas, size, ecc) {
ecclevel = ecc || ecclevel;
canvas = canvas || _canvas;
if (!canvas) {
console.warn('No canvas provided to draw QR code in!')
return;
}
size = size || _size || Math.min(canvas.width, canvas.height);
var frame = genframe(string),
ctx = canvas.ctx,
px = Math.round(size / (width + 8));
var roundedSize = px * (width + 8),
offset = Math.floor((size - roundedSize) / 2);
size = roundedSize;
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.setFillStyle('#000000');
for (var i = 0; i < width; i++) {
for (var j = 0; j < width; j++) {
if (frame[j * width + i]) {
ctx.fillRect(px * (4 + i) + offset, px * (4 + j) + offset, px, px);
}
}
}
ctx.draw();
}
}
module.exports = {
api: api
}
})()
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
return __REQUIRE__(1768619533625);
})()
//miniprogram-npm-outsideDeps=[]
//# sourceMappingURL=index.js.map
================================================
FILE: package.json
================================================
{
"name": "beeorder",
"version": "1.0.0",
"description": "微信小程序——餐饮点餐商城,是针对餐饮行业推出的一套完整的餐饮解决方案,实现了用户在线点餐下单、外卖、叫号排队、支付、配送等功能,完美的使餐饮行业更高效便捷!",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/woniudiancang/bee.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/woniudiancang/bee/issues"
},
"homepage": "https://github.com/woniudiancang/bee#readme",
"dependencies": {
"@vant/weapp": "^1.11.7",
"apifm-wxapi": "^26.2.12",
"wxbarcode": "^1.0.2"
},
"devDependencies": {
"sharp": "^0.34.4"
}
}
================================================
FILE: pages/about/index.js
================================================
const WXAPI = require('apifm-wxapi')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
},
onLoad (e) {
this.data.key = e.key || 'about'
this.cmsPage()
},
async cmsPage() {
const res = await WXAPI.cmsPage(this.data.key)
if (res.code == 0) {
this.setData({
cmsPage: res.data
})
wx.setNavigationBarTitle({
title: res.data.info.title,
})
}
},
})
================================================
FILE: pages/about/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/about/index.wxml
================================================
================================================
FILE: pages/about/index.wxss
================================================
.content {
padding: 32rpx;
line-height: 64rpx;
}
.content image {
max-width: 100%;
}
================================================
FILE: pages/ad/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
addressList: [],
addressEdit: false,
cancelBtn: false,
pickerRegionRange: [],
pickerSelect:[0, 0, 0],
addressData: {}
},
// 添加地址
addAddress: function() {
this.setData({
addressEdit: true,
cancelBtn: true,
id: null,
addressData: {}
})
},
// 取消编辑
editCancel: function(){
this.setData({
addressEdit: false,
})
},
// 编辑地址
async editAddress(e) {
// wx.navigateTo({
// url: "/pages/address-add/index?id=" + e.currentTarget.dataset.id
// })
var id = e.currentTarget.dataset.id
this.setData({
addressEdit: true,
cancelBtn: false,
id:id,
})
if (id) { // 修改初始化数据库数据
const res = await WXAPI.addressDetail(wx.getStorageSync('token'), id)
if (res.code == 0) {
var addressData = res.data.info
console.log(addressData)
var address = addressData.address
var pname = addressData.provinceStr
var cname = addressData.cityStr
var dname = addressData.areaStr
//
var provinceId = addressData.provinceId
var cityId = addressData.cityId
var districtId = addressData.districtId
this.setData({
id: id,
addressData: res.data.info,
address: res.data.info.address,
pname: pname,
cname: cname,
dname: dname,
provinceId: provinceId,
cityId: cityId,
districtId: districtId,
})
// console.log(addressData)
this.initRegionDB(pname,cname,dname)
this.provinces(provinceId,cityId,districtId)
} else {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.ad_index.apiError,
showCancel: false
})
}
} else {
this.initRegionPicker()
}
},
// 选中地址
selectTap: function(e) {
var id = e.currentTarget.dataset.id;
WXAPI.updateAddress({
token: wx.getStorageSync('token'),
id: id,
isDefault: 'true'
}).then(function(res) {
wx.navigateBack({})
})
},
// 删除地址按钮
deleteAddress: function (e) {
const _this = this
const id = e.currentTarget.dataset.id;
console.log(id)
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.ad_index.deleteProfile,
success: function (res) {
if (res.confirm) {
WXAPI.deleteAddress(wx.getStorageSync('token'), id).then(function () {
_this.setData({
addressEdit: false,
cancelBtn: false,
})
_this.initShippingAddress()
})
}
}
})
},
// 微信读取
readFromWx : function () {
const _this = this
wx.chooseAddress({
success: function (res) {
console.log(res)
_this.initRegionDB(res.provinceName, res.cityName, res.countyName)
_this.setData({
wxaddress: res
});
}
})
},
// 获取地址列表
async initShippingAddress() {
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/mmte1o
const res = await WXAPI.queryAddressV2({
token: wx.getStorageSync('token'),
pageSize: 100
})
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
this.setData({
addressList: res.data.result
});
} else {
this.setData({
addressList: null
});
}
},
// 省市选择器 三栏
initRegionPicker () {
// https://www.yuque.com/apifm/nu0f75/anab2a
WXAPI.provinceV2().then(res => {
if (res.code === 0) {
let _pickerRegionRange = []
_pickerRegionRange.push(res.data)
_pickerRegionRange.push([{ name: this.data.$t.common.select }])
_pickerRegionRange.push([{ name: this.data.$t.common.select }])
this.data.pickerRegionRange = _pickerRegionRange
this.bindcolumnchange({ detail: { column: 0, value: 0 } })
}
})
},
async initRegionDB (pname, cname, dname) {
this.data.showRegionStr = pname + cname + dname
let pObject = undefined
let cObject = undefined
let dObject = undefined
if (pname) {
const index = this.data.pickerRegionRange[0].findIndex(ele=>{
return ele.name == pname
})
if (index >= 0) {
this.data.pickerSelect[0] = index
pObject = this.data.pickerRegionRange[0][index]
}
}
if (!pObject) {
return
}
// https://www.yuque.com/apifm/nu0f75/kfukig
const _cRes = await WXAPI.nextRegionV2(pObject.id)
if (_cRes.code === 0) {
this.data.pickerRegionRange[1] = _cRes.data
if (cname) {
const index = this.data.pickerRegionRange[1].findIndex(ele => {
return ele.name == cname
})
if (index >= 0) {
this.data.pickerSelect[1] = index
cObject = this.data.pickerRegionRange[1][index]
}
}
}
if (!cObject) {
return
}
// https://www.yuque.com/apifm/nu0f75/kfukig
const _dRes = await WXAPI.nextRegionV2(cObject.id)
if (_dRes.code === 0) {
this.data.pickerRegionRange[2] = _dRes.data
if (dname) {
const index = this.data.pickerRegionRange[2].findIndex(ele => {
return ele.name == dname
})
if (index >= 0) {
this.data.pickerSelect[2] = index
dObject = this.data.pickerRegionRange[2][index]
}
}
}
this.setData({
pickerRegionRange: this.data.pickerRegionRange,
pickerSelect: this.data.pickerSelect,
showRegionStr: this.data.showRegionStr,
pObject: pObject,
cObject: cObject,
dObject: dObject
})
},
bindchange: function(e) {
const pObject = this.data.pickerRegionRange[0][e.detail.value[0]]
const cObject = this.data.pickerRegionRange[1][e.detail.value[1]]
const dObject = this.data.pickerRegionRange[2][e.detail.value[2]]
const showRegionStr = pObject.name + cObject.name + dObject.name
this.setData({
pObject: pObject,
cObject: cObject,
dObject: dObject,
showRegionStr: showRegionStr
})
},
bindcolumnchange: function(e) {
const column = e.detail.column
const index = e.detail.value
const regionObject = this.data.pickerRegionRange[column][index]
if (column === 2) {
this.setData({
pickerRegionRange: this.data.pickerRegionRange
})
return
}
if (column === 1) {
this.data.pickerRegionRange[2] = [{ name: this.data.$t.common.select }]
}
if (column === 0) {
this.data.pickerRegionRange[1] = [{ name: this.data.$t.common.select }]
this.data.pickerRegionRange[2] = [{ name: this.data.$t.common.select }]
}
// // 后面的数组全部清空
// this.data.pickerRegionRange.splice(column+1)
// 追加后面的一级数组
// https://www.yuque.com/apifm/nu0f75/kfukig
WXAPI.nextRegionV2(regionObject.id).then(res => {
if (res.code === 0) {
this.data.pickerRegionRange[column + 1] = res.data
}
this.bindcolumnchange({ detail: { column: column + 1, value: 0 } })
})
},
//
async provinces(provinceId, cityId, districtId) {
// https://www.yuque.com/apifm/nu0f75/anab2a
const res1 = await WXAPI.provinceV2()
const provinces = res1.data
this.setData({
provinces,
})
var pIndex = provinces.findIndex(ele => {
return ele.id == provinceId
})
const pid = this.data.provinces[pIndex].id
// https://www.yuque.com/apifm/nu0f75/kfukig
const res2 = await WXAPI.nextRegionV2(pid)
const cities = res2.data
this.setData({
cities,
})
var cIndex = cities.findIndex(ele => {
return ele.id == cityId
})
const cid = this.data.cities[cIndex].id
// https://www.yuque.com/apifm/nu0f75/kfukig
const res3 = await WXAPI.nextRegionV2(cid);
const areas = res3.data
this.setData({
areas,
})
var aIndex = areas.findIndex(ele => {
return ele.id == districtId
})
// var pIndex = pIndex + 1
// var cIndex = cIndex + 1
// var aIndex = aIndex + 1
this.setData({
pIndex: pIndex,
cIndex: cIndex,
aIndex: aIndex,
})
},
linkManChange(e) {
const addressData = this.data.addressData
addressData.linkMan = e.detail
this.setData({
addressData
})
},
mobileChange(e) {
const addressData = this.data.addressData
addressData.mobile = e.detail
this.setData({
addressData
})
},
addressChange(e) {
const addressData = this.data.addressData
addressData.address = e.detail
this.setData({
addressData
})
},
// 保存按钮
async bindSave() {
const pObject = this.data.pObject
const cObject = this.data.cObject
const dObject = this.data.dObject
const linkMan = this.data.addressData.linkMan
const address = this.data.addressData.address
const mobile = this.data.addressData.mobile
const latitude = this.data.addressData.latitude
const longitude = this.data.addressData.longitude
if (!linkMan){
wx.showToast({
title: this.data.$t.ad_index.linkManPlaceholder,
icon: 'none',
})
return
}
if (!mobile){
wx.showToast({
title: this.data.$t.ad_index.mobilePlaceholder,
icon: 'none',
})
return
}
if (!this.data.pObject || !this.data.cObject || !this.data.dObject){
wx.showToast({
title: this.data.$t.ad_index.region,
icon: 'none',
})
return
}
if (!latitude){
wx.showToast({
title: this.data.$t.ad_index.location,
icon: 'none',
})
return
}
if (!address){
wx.showToast({
title: this.data.$t.ad_index.address,
icon: 'none',
})
return
}
const postData = {
token: wx.getStorageSync('token'),
linkMan: linkMan,
address: address,
mobile: mobile,
isDefault: 'true',
latitude,
longitude
}
// console.log(this.data.pIndex)
// console.log(this.data.cIndex)
// console.log(this.data.aIndex)
postData.provinceId = pObject.id
postData.cityId = cObject.id
postData.districtId = dObject.id
// if (this.data.pIndex >= 0) {
// postData.provinceId = pObject.id
// }
// if (this.data.cIndex >= 0) {
// postData.cityId = cObject.id
// }
// if (this.data.aIndex >= 0) {
// postData.districtId = dObject.id
// }
let apiResult
console.log(this.data.id)
if (this.data.id) {
postData.id = this.data.id
apiResult = await WXAPI.updateAddress(postData)
} else {
apiResult = await WXAPI.addAddress(postData)
}
if (apiResult.code != 0) {
// 登录错误
wx.hideLoading();
wx.showToast({
title: apiResult.msg,
icon: 'none'
})
return;
} else {
this.setData({
addressEdit: false,
cancelBtn: false,
})
this.initShippingAddress()
}
},
onLoad(e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.ad_index.title,
})
this.setData({
showRegionStr: this.data.$t.ad_index.regionPlaceholder
})
const _this = this
this.initRegionPicker() // 初始化省市区选择器
if (e.id) { // 修改初始化数据库数据
WXAPI.addressDetail(e.id, wx.getStorageSync('token')).then(function (res) {
if (res.code === 0) {
_this.setData({
id: e.id,
addressData: res.data,
showRegionStr: res.data.provinceStr + res.data.cityStr + res.data.areaStr
});
_this.initRegionDB(res.data.provinceStr, res.data.cityStr, res.data.areaStr)
return;
} else {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.ad_index.apiError,
showCancel: false
})
}
})
}
},
onShow: function() {
AUTH.checkHasLogined().then(isLogined => {
if (isLogined) {
this.initShippingAddress();
} else {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.auth.needLogin,
showCancel: false,
success: () => {
wx.navigateBack()
}
})
}
})
},
chooseLocation() {
wx.chooseLocation({
success: (res) => {
const addressData = this.data.addressData
addressData.address = res.address + res.name
addressData.latitude = res.latitude
addressData.longitude = res.longitude
this.setData({
addressData
})
},
fail: (e) => {
console.error(e)
},
})
},
})
================================================
FILE: pages/ad/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/ad/index.wxml
================================================
{{item.linkMan}} {{item.mobile}}
{{item.address}}
{{ $t.ad_index.add }}
{{ $t.ad_index.empty }}
{{ $t.ad_index.pleaseAdd }}
{{ $t.ad_index.add }}
================================================
FILE: pages/ad/index.wxss
================================================
/* 页面整体背景 - 温馨的奶茶色调 */
page {
background: linear-gradient(135deg, #FFF5E4 0%, #FFE8CC 100%);
min-height: 100vh;
}
/* ========== 空地址状态 ========== */
.content-1 {
font-size: 32rpx;
text-align: center;
margin-top: 240rpx;
color: #A0826D;
font-weight: 500;
letter-spacing: 2rpx;
}
.content-2 {
font-size: 28rpx;
text-align: center;
margin-top: 24rpx;
color: #C9A88E;
letter-spacing: 1rpx;
}
.button {
width: 400rpx !important;
height: 100rpx !important;
margin-top: 180rpx;
margin-left: auto;
margin-right: auto;
font-size: 32rpx !important;
font-weight: 500;
border-radius: 50rpx !important;
box-shadow: 0 8rpx 24rpx rgba(230, 144, 115, 0.25);
background: linear-gradient(135deg, #FF9F7F 0%, #E68873 100%) !important;
display: block;
}
/* ========== 地址列表容器 ========== */
.container {
background: transparent;
padding-bottom: 140rpx;
min-height: 100vh;
}
.address-list {
width: 100%;
background-color: transparent;
margin-top: 20rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
/* 地址卡片 - 高级卡片设计 */
.address-list .a-address {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 36rpx 32rpx;
margin-bottom: 24rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(160, 130, 109, 0.08);
border: 2rpx solid rgba(255, 255, 255, 0.8);
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
/* 卡片左侧装饰条 */
.address-list .a-address::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 60%;
background: linear-gradient(180deg, #FF9F7F 0%, #E68873 100%);
border-radius: 0 6rpx 6rpx 0;
}
.a-address .left-text {
flex: 1;
padding-left: 24rpx;
box-sizing: border-box;
}
.a-address .left-text .name-tel {
margin-bottom: 20rpx;
font-size: 32rpx;
font-weight: 600;
color: #5C4A42;
letter-spacing: 1rpx;
}
.a-address .left-text .address-box {
font-size: 26rpx;
color: #A0826D;
line-height: 40rpx;
letter-spacing: 0.5rpx;
}
/* 编辑和删除图标样式 */
.right-edit {
margin-left: 24rpx;
padding: 12rpx;
border-radius: 50%;
background: rgba(255, 159, 127, 0.1);
color: #E68873 !important;
transition: all 0.3s ease;
}
/* ========== 底部添加按钮 ========== */
.bottom-box {
position: fixed;
width: 100vw;
bottom: 0;
left: 0;
font-size: 30rpx;
color: #5C4A42;
height: 112rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 251, 247, 0.98) 100%);
backdrop-filter: blur(20rpx);
line-height: 112rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 40rpx;
box-sizing: border-box;
border-top: 2rpx solid rgba(255, 159, 127, 0.15);
box-shadow: 0 -4rpx 24rpx rgba(160, 130, 109, 0.08);
z-index: 100;
}
.bottom-box .add-btn {
display: flex;
align-items: center;
font-weight: 500;
letter-spacing: 1rpx;
}
.bottom-box .add-btn view {
margin-left: 16rpx;
color: #E68873;
}
/* ========== 地址编辑表单 ========== */
.addressEdit {
width: 100%;
min-height: 100vh;
padding: 32rpx 30rpx;
padding-bottom: 160rpx;
box-sizing: border-box;
}
/* 优化 van-field 和 van-cell 的背景 */
.addressEdit ::deep .van-cell {
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%) !important;
border-radius: 16rpx !important;
margin-bottom: 20rpx !important;
box-shadow: 0 4rpx 16rpx rgba(160, 130, 109, 0.06) !important;
border: 2rpx solid rgba(255, 255, 255, 0.8) !important;
overflow: hidden;
}
.addressEdit ::deep .van-field__label {
color: #7D6A5E !important;
font-weight: 500;
}
.addressEdit ::deep .van-field__input,
.addressEdit ::deep .van-field__value {
color: #5C4A42 !important;
}
.addressEdit ::deep .van-cell__value {
color: #A0826D !important;
}
/* 保存按钮 - 奶茶店主题渐变 */
.save-btn {
margin-top: 80rpx;
height: 96rpx;
width: 100%;
font-size: 32rpx;
line-height: 96rpx;
color: white;
background: linear-gradient(135deg, #FF9F7F 0%, #E68873 100%);
border-radius: 48rpx;
border: none;
box-shadow: 0 8rpx 24rpx rgba(230, 136, 115, 0.3);
font-weight: 600;
letter-spacing: 4rpx;
transition: all 0.3s ease;
}
.save-btn::after {
border: none;
}
/* 取消按钮 */
.cancel-btn {
margin-top: 24rpx;
height: 96rpx;
width: 100%;
font-size: 30rpx;
line-height: 96rpx;
color: #7D6A5E;
background: #FFFFFF;
border-radius: 48rpx;
border: 2rpx solid rgba(125, 106, 94, 0.2);
box-shadow: 0 4rpx 16rpx rgba(160, 130, 109, 0.08);
font-weight: 500;
letter-spacing: 2rpx;
}
.cancel-btn::after {
border: none;
}
/* ========== 其他样式 ========== */
.label {
padding-right: 30rpx;
color: #7D6A5E;
font-weight: 500;
}
.region-box {
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
padding: 0 32rpx;
height: 100rpx;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
border-radius: 16rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(160, 130, 109, 0.06);
}
.row-wrap {
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
padding: 0 32rpx;
height: 100rpx;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
font-size: 30rpx;
border-radius: 16rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(160, 130, 109, 0.06);
}
.baocun {
width: 550rpx;
margin-left: 100rpx;
margin-right: 100rpx;
margin-top: 80rpx;
font-size: 50rpx;
}
.quxiao {
width: 550rpx;
margin-left: 100rpx;
margin-top: 50rpx;
font-size: 45rpx;
color: #7D6A5E !important;
}
.empty-box {
text-align: center;
}
================================================
FILE: pages/all-orders/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
apiOk: false
},
cancelOrderTap: function(e) {
const that = this;
const orderId = e.currentTarget.dataset.id;
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.order.cancelProfile,
success: function(res) {
if (res.confirm) {
WXAPI.orderClose(wx.getStorageSync('token'), orderId).then(function(res) {
if (res.code == 0) {
that.onShow();
}
})
}
}
})
},
toPayTap: function(e) {
// 防止连续点击--开始
if (this.data.payButtonClicked) {
wx.showToast({
title: this.data.$t.common.doubleClick,
icon: 'none'
})
return
}
this.data.payButtonClicked = true
setTimeout(() => {
this.data.payButtonClicked = false
}, 3000) // 可自行修改时间间隔(目前是3秒内只能点击一次支付按钮)
// 防止连续点击--结束
const that = this;
const orderId = e.currentTarget.dataset.id;
let money = e.currentTarget.dataset.money;
const needScore = e.currentTarget.dataset.score;
WXAPI.userAmount(wx.getStorageSync('token')).then(function(res) {
if (res.code == 0) {
// 增加提示框
if (res.data.score < needScore) {
wx.showToast({
title: that.data.$t.order.scoreNotEnough,
icon: 'none'
})
return;
}
let _msg = that.data.$t.order.amountReal + ' ' + money
if (res.data.balance > 0) {
_msg += ' ' + that.data.$t.order.balance + ' ' + res.data.balance
if (money - res.data.balance > 0) {
_msg += ' ' + that.data.$t.order.payAmount + ' ' + (money - res.data.balance)
}
}
if (needScore > 0) {
_msg += ' ' + that.data.$t.order.payScore + ' ' + needScore
}
money = money - res.data.balance
wx.showModal({
content: _msg,
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
success: function (res) {
console.log(res);
if (res.confirm) {
that._toPayTap(orderId, money)
}
}
});
} else {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: that.data.$t.order.noCashAccount,
showCancel: false
})
}
})
},
_toPayTap: function (orderId, money){
const _this = this
if (money <= 0) {
// 直接使用余额支付
WXAPI.orderPay(wx.getStorageSync('token'), orderId).then(function (res) {
_this.onShow();
})
} else {
this.setData({
paymentShow: true,
orderId,
money,
nextAction: {
type: 0,
id: orderId
}
})
}
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false
})
wx.redirectTo({
url: '/pages/all-orders/index',
})
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
onLoad: function(options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.order.title,
})
},
onShow: function() {
AUTH.checkHasLogined().then(isLogined => {
if (isLogined) {
this.doneShow();
} else {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.auth.needLogin,
showCancel: false,
success: () => {
wx.navigateBack()
}
})
}
})
},
async doneShow() {
wx.showLoading({
title: '',
})
const res = await WXAPI.orderList({
token: wx.getStorageSync('token')
})
wx.hideLoading()
if (res.code == 0) {
const orderList = res.data.orderList
orderList.forEach(ele => {
if (ele.status == -1) {
ele.statusStr = this.data.$t.order.status.st01
}
if (ele.status == 1 && ele.isNeedLogistics) {
ele.statusStr = this.data.$t.order.status.st11
}
if (ele.status == 1 && !ele.isNeedLogistics) {
ele.statusStr = this.data.$t.order.status.st10
}
if (ele.status == 3) {
ele.statusStr = this.data.$t.order.status.st3
}
})
this.setData({
orderList: res.data.orderList,
logisticsMap: res.data.logisticsMap,
goodsMap: res.data.goodsMap,
apiOk: true
});
} else {
this.setData({
orderList: null,
logisticsMap: {},
goodsMap: {},
apiOk: true
});
}
},
toIndexPage: function() {
wx.switchTab({
url: "/pages/index/index"
});
},
// 删除订单
deleteOrder: function(e){
const that = this
const id = e.currentTarget.dataset.id;
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.order.deleteProfile,
success: function (res) {
if (res.confirm) {
WXAPI.orderDelete(wx.getStorageSync('token'), id).then(function (res) {
if (res.code == 0) {
that.onShow(); //重新获取订单列表
}
})
}
}
})
},
async callShop(e) {
const shopId = e.currentTarget.dataset.shopid
const res = await WXAPI.shopSubdetail(shopId)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.makePhoneCall({
phoneNumber: res.data.info.linkPhone,
})
},
})
================================================
FILE: pages/all-orders/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/all-orders/index.wxml
================================================
☕
{{ $t.order.empty.t1 }}
{{ $t.order.empty.t2 }}
{{ $t.order.empty.btn }}
{{index + 1}}
📅
{{ $t.order.dateAdd }}
{{item.dateAdd}}
🔖
{{ $t.order.orderNumber }}
{{item.orderNumber}}
================================================
FILE: pages/all-orders/index.wxss
================================================
/* ===========================================
奶茶店订单管理页面 - 高端设计风格
=========================================== */
/* 页面容器 - 奶茶店温暖渐变背景 */
.container {
width: 100%;
min-height: 100vh;
background: linear-gradient(180deg, #FFF9F5 0%, #FFF3EC 50%, #FFEEE5 100%);
padding: 24rpx 0;
box-sizing: border-box;
}
/* ===========================================
空状态设计 - 精致优雅
=========================================== */
.no-order {
margin: 160rpx auto 0;
padding: 100rpx 60rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFFAF7 100%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 40rpx;
width: 660rpx;
box-shadow: 0 16rpx 48rpx rgba(207, 142, 99, 0.12),
0 4rpx 16rpx rgba(207, 142, 99, 0.08);
position: relative;
overflow: hidden;
}
.no-order::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6rpx;
background: linear-gradient(90deg, #E8B899 0%, #CF8E63 50%, #E8B899 100%);
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 32rpx;
opacity: 0.85;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0rpx); }
50% { transform: translateY(-12rpx); }
}
.content-1 {
font-size: 36rpx;
font-weight: 600;
text-align: center;
color: #8B6F47;
margin-bottom: 20rpx;
letter-spacing: 2rpx;
}
.content-2 {
font-size: 28rpx;
text-align: center;
color: #B8977D;
line-height: 1.8;
margin-bottom: 12rpx;
}
.to-index-btn {
margin-top: 56rpx;
background: linear-gradient(135deg, #E8B899 0%, #CF8E63 100%);
border-radius: 56rpx;
width: 360rpx;
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 12rpx 32rpx rgba(207, 142, 99, 0.3);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.to-index-btn:active {
transform: scale(0.96);
box-shadow: 0 8rpx 24rpx rgba(207, 142, 99, 0.25);
}
.btn-text {
color: #FFFFFF;
font-size: 32rpx;
font-weight: 600;
letter-spacing: 3rpx;
}
/* ===========================================
订单列表容器
=========================================== */
.order-list {
width: 100%;
padding: 0 24rpx;
box-sizing: border-box;
}
/* ===========================================
订单卡片 - 高端精致设计
=========================================== */
.a-order {
width: 100%;
background: #FFFFFF;
margin-bottom: 32rpx;
border-radius: 32rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(139, 111, 71, 0.1),
0 2rpx 8rpx rgba(139, 111, 71, 0.06);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
}
.a-order::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6rpx;
background: linear-gradient(90deg, #E8B899 0%, #CF8E63 30%, #E8B899 70%, #CF8E63 100%);
z-index: 10;
}
.order-hover {
opacity: 0.95;
}
/* 订单头部 */
.order-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 32rpx 24rpx;
background: linear-gradient(180deg, #FFFBF8 0%, #FFFFFF 100%);
border-bottom: 2rpx solid #F8F1EB;
}
.shop-info {
display: flex;
align-items: center;
flex: 1;
}
.shop-icon {
font-size: 36rpx;
margin-right: 12rpx;
}
.shop-name {
font-size: 32rpx;
font-weight: 600;
color: #5A4A3A;
letter-spacing: 1rpx;
}
.order-status {
display: flex;
align-items: center;
padding: 8rpx 20rpx;
border-radius: 28rpx;
font-size: 26rpx;
font-weight: 500;
}
.status-pending {
background: linear-gradient(135deg, #FFF3E0 0%, #FFE8CC 100%);
color: #FF9800;
}
.status-cancel {
background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
color: #E53935;
}
.status-success {
background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
color: #43A047;
}
.status-text {
margin-right: 6rpx;
}
.arrow {
font-size: 32rpx;
font-weight: 300;
}
/* ===========================================
商品图片滚动区域
=========================================== */
.goods-scroll {
width: 100%;
padding: 32rpx 0;
box-sizing: border-box;
white-space: nowrap;
}
.goods-container {
padding: 0 24rpx;
display: inline-flex;
gap: 20rpx;
}
.goods-item {
width: 160rpx;
height: 160rpx;
position: relative;
flex-shrink: 0;
}
.goods-img {
width: 100%;
height: 100%;
border-radius: 24rpx;
background: linear-gradient(135deg, #FFF5F0 0%, #FFEBE0 100%);
box-shadow: 0 4rpx 16rpx rgba(207, 142, 99, 0.15);
border: 3rpx solid #FFFFFF;
}
.goods-badge {
position: absolute;
top: -8rpx;
right: -8rpx;
width: 40rpx;
height: 40rpx;
background: linear-gradient(135deg, #E8B899 0%, #CF8E63 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
font-weight: 600;
color: #FFFFFF;
box-shadow: 0 4rpx 12rpx rgba(207, 142, 99, 0.4);
border: 3rpx solid #FFFFFF;
}
/* ===========================================
订单详情信息
=========================================== */
.order-detail {
padding: 24rpx 32rpx;
background: linear-gradient(180deg, #FFFBF8 0%, #FFFFFF 100%);
border-top: 2rpx solid #F8F1EB;
border-bottom: 2rpx solid #F8F1EB;
}
.detail-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
}
.detail-row:last-child {
margin-bottom: 0;
}
.detail-label {
display: flex;
align-items: center;
font-size: 26rpx;
color: #8B7355;
font-weight: 400;
}
.label-icon {
font-size: 28rpx;
margin-right: 8rpx;
}
.detail-value {
font-size: 24rpx;
color: #A08875;
font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
}
/* ===========================================
价格和操作区域
=========================================== */
.order-footer {
padding: 28rpx 32rpx;
background: #FFFFFF;
}
.price-area {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 24rpx;
padding-bottom: 24rpx;
border-bottom: 2rpx dashed #F0E6DB;
}
.price-label {
font-size: 28rpx;
color: #8B7355;
font-weight: 500;
}
.price-value {
display: flex;
align-items: baseline;
}
.currency {
font-size: 32rpx;
color: #CF8E63;
font-weight: 600;
margin-right: 4rpx;
}
.amount {
font-size: 48rpx;
font-weight: 700;
color: #CF8E63;
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
letter-spacing: -1rpx;
}
/* 操作按钮组 */
.action-btns {
display: flex;
justify-content: flex-end;
gap: 16rpx;
flex-wrap: wrap;
}
.order-btn {
padding: 16rpx 32rpx;
border-radius: 48rpx;
font-size: 26rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
border: 2rpx solid transparent;
letter-spacing: 1rpx;
min-width: 140rpx;
}
.order-btn:active {
transform: scale(0.95);
}
.btn-icon {
margin-right: 6rpx;
font-size: 28rpx;
}
/* 主要按钮 - 渐变奶茶色 */
.btn-primary {
background: linear-gradient(135deg, #E8B899 0%, #CF8E63 100%);
color: #FFFFFF;
box-shadow: 0 6rpx 20rpx rgba(207, 142, 99, 0.35);
}
.btn-primary:active {
box-shadow: 0 4rpx 12rpx rgba(207, 142, 99, 0.3);
}
/* 次要按钮 */
.btn-secondary {
background: #FFFFFF;
color: #8B7355;
border-color: #E0D3C5;
}
.btn-secondary:active {
background: #FFF9F5;
}
/* 取消按钮 */
.btn-cancel {
background: #FFFFFF;
color: #999;
border-color: #E5E5E5;
}
.btn-cancel:active {
background: #F8F8F8;
}
/* 危险按钮 */
.btn-danger {
background: linear-gradient(135deg, #FFE5E5 0%, #FFD5D5 100%);
color: #E53935;
border-color: #FFB8B8;
}
.btn-danger:active {
background: linear-gradient(135deg, #FFD5D5 0%, #FFC5C5 100%);
}
/* ===========================================
底部安全区域
=========================================== */
.safeAreaOldMarginBttom,
.safeAreaNewMarginBttom {
height: 40rpx;
}
================================================
FILE: pages/asset/cash-log.js
================================================
const APP = getApp()
const WXAPI = require('apifm-wxapi')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
/**
* 页面的初始数据
*/
data: {
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.cashLog.title,
})
this.cashLogsV2()
},
onShow: function () {
},
async cashLogsV2() {
wx.showLoading({
title: '',
})
const res = await WXAPI.cashLogsV2({
token: wx.getStorageSync('token'),
page:1,
pageSize:500
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
cashLogsV2: res.data.result
})
}
},
})
================================================
FILE: pages/asset/cash-log.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/asset/cash-log.wxml
================================================
{{item.amount >= 0 ? '+' : '-'}}
{{item.typeStr}}
{{item.dateAdd}}
{{item.amount >= 0 ? '+' : ''}}¥{{item.amount}}
💰
{{ $t.common.empty || '暂无资金明细' }}
您的每一笔收支都会记录在这里哦~
================================================
FILE: pages/asset/cash-log.wxss
================================================
/* pages/asset/cash-log.wxss */
page {
background: linear-gradient(180deg, #FFF5E6 0%, #FFFBF5 100%);
min-height: 100vh;
}
.cash-log-container {
min-height: 100vh;
padding-bottom: 40rpx;
position: relative;
}
/* 顶部装饰 */
.header-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 300rpx;
overflow: hidden;
pointer-events: none;
}
.circle-decoration {
position: absolute;
border-radius: 50%;
opacity: 0.15;
}
.circle-1 {
width: 400rpx;
height: 400rpx;
background: linear-gradient(135deg, #FFD4A3 0%, #FFA87D 100%);
top: -200rpx;
right: -100rpx;
}
.circle-2 {
width: 200rpx;
height: 200rpx;
background: linear-gradient(135deg, #FFC4A3 0%, #FF9A7D 100%);
top: 50rpx;
left: -50rpx;
}
.circle-3 {
width: 150rpx;
height: 150rpx;
background: linear-gradient(135deg, #FFE4C4 0%, #FFDAB9 100%);
top: 180rpx;
right: 80rpx;
}
/* 明细列表 */
.cash-log-list {
padding: 32rpx;
position: relative;
z-index: 1;
}
.log-item {
margin-bottom: 24rpx;
animation: slideIn 0.4s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.log-card {
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 4rpx 20rpx rgba(255, 164, 125, 0.08);
overflow: hidden;
transition: all 0.3s ease;
}
.log-card:active {
transform: scale(0.98);
box-shadow: 0 2rpx 12rpx rgba(255, 164, 125, 0.12);
}
.log-content {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
}
/* 左侧内容 */
.log-left {
display: flex;
align-items: center;
flex: 1;
overflow: hidden;
}
.icon-wrapper {
width: 88rpx;
height: 88rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
flex-shrink: 0;
}
.icon-wrapper.income {
background: linear-gradient(135deg, #FFE8D6 0%, #FFD4BB 100%);
}
.icon-wrapper.expense {
background: linear-gradient(135deg, #E8E8E8 0%, #D4D4D4 100%);
}
.icon-wrapper .icon {
font-size: 40rpx;
font-weight: 600;
}
.icon-wrapper.income .icon {
color: #FF8A50;
}
.icon-wrapper.expense .icon {
color: #999999;
}
.log-info {
display: flex;
flex-direction: column;
overflow: hidden;
}
.log-type {
font-size: 32rpx;
font-weight: 500;
color: #333333;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.log-date {
font-size: 24rpx;
color: #999999;
line-height: 1.5;
}
/* 右侧金额 */
.log-right {
margin-left: 24rpx;
flex-shrink: 0;
}
.amount {
font-size: 36rpx;
font-weight: 600;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.amount.income {
color: #FF8A50;
}
.amount.expense {
color: #666666;
}
/* 空状态 */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 60rpx;
position: relative;
z-index: 1;
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 32rpx;
opacity: 0.6;
}
.empty-text {
font-size: 32rpx;
color: #999999;
margin-bottom: 16rpx;
font-weight: 500;
}
.empty-tips {
font-size: 26rpx;
color: #CCCCCC;
text-align: center;
line-height: 1.6;
}
================================================
FILE: pages/asset/index.js
================================================
const APP = getApp()
const WXAPI = require('apifm-wxapi')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
/**
* 页面的初始数据
*/
data: {
balance: 0.00,
ruleSelIndex: 0,
showRechargePop: false
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.asset.title,
})
this.rechargeRule()
},
onShow: function () {
this.getUserAmount()
},
async getUserAmount() {
const res = await WXAPI.userAmount(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
balance: res.data.balance.toFixed(2),
freeze: res.data.freeze.toFixed(2),
score: res.data.score,
growth: res.data.growth
})
}
},
async rechargeRule() {
const res = await WXAPI.rechargeSendRules()
if (res.code == 0) {
this.setData({
rechargeSendRules: res.data
})
}
},
changePersionNum(e) {
if (e.currentTarget.dataset.idx == -1) {
this.data.showRechargePop = true
}
this.setData({
ruleSelIndex: e.currentTarget.dataset.idx,
showRechargePop: this.data.showRechargePop,
amount2: null
})
},
submit1() {
if (this.data.ruleSelIndex == -1) {
this.setData({
showRechargePop: true,
amount2: null
})
return
}
const amount = this.data.rechargeSendRules[this.data.ruleSelIndex].confine
this.wxpay(amount);
},
onClose() {
this.setData({
showRechargePop: false
})
},
submit2() {
if (!this.data.amount2) {
wx.showToast({
title: this.data.$t.asset.amountPlaceholder,
icon: 'none'
})
return
}
this.wxpay(this.data.amount2);
},
wxpay(money) {
this.setData({
paymentShow: true,
money
})
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false,
showRechargePop: false
})
this.getUserAmount()
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
})
================================================
FILE: pages/asset/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/asset/index.wxml
================================================
¥
{{balance}}
🎁
{{ $t.asset.recharge }}
送¥{{item.send}}
¥
{{item.confine}}
{{ $t.asset.confine }}
✏️
{{ $t.asset.other }}
{{ $t.asset.confirmBtn }}
📋
账户记录
💳
{{ $t.asset.rechargeLogs }}
查看充值明细
💸
{{ $t.cashLog.title }}
查看提现记录
================================================
FILE: pages/asset/index.wxss
================================================
/* ========== 页面容器 ========== */
page {
background: linear-gradient(135deg, #FFF5E6 0%, #FFE4C4 100%);
min-height: 100vh;
}
.wallet-container {
padding: 32rpx;
padding-bottom: 40rpx;
}
/* ========== 余额卡片 ========== */
.balance-card {
position: relative;
background: linear-gradient(135deg, #8B6F47 0%, #A0826D 50%, #8B6F47 100%);
border-radius: 32rpx;
padding: 48rpx 40rpx;
margin-bottom: 40rpx;
overflow: hidden;
box-shadow: 0 16rpx 48rpx rgba(139, 111, 71, 0.3);
}
.balance-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
}
.balance-icon {
font-size: 40rpx;
margin-right: 16rpx;
}
.balance-label {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
letter-spacing: 2rpx;
}
.balance-amount {
display: flex;
align-items: baseline;
margin-bottom: 16rpx;
}
.currency {
font-size: 40rpx;
color: #fff;
font-weight: bold;
margin-right: 8rpx;
}
.amount-num {
font-size: 88rpx;
color: #fff;
font-weight: bold;
letter-spacing: 2rpx;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
/* 装饰圆圈 */
.balance-decoration {
position: absolute;
right: 0;
top: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.circle {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
}
.circle-1 {
width: 200rpx;
height: 200rpx;
right: -60rpx;
top: -60rpx;
}
.circle-2 {
width: 120rpx;
height: 120rpx;
right: 60rpx;
bottom: -40rpx;
}
.circle-3 {
width: 80rpx;
height: 80rpx;
right: -20rpx;
top: 50%;
background: rgba(255, 255, 255, 0.08);
}
/* ========== 充值区域 ========== */
.recharge-section {
margin-bottom: 40rpx;
}
.section-title {
display: flex;
align-items: center;
margin-bottom: 32rpx;
position: relative;
}
.title-icon {
font-size: 36rpx;
margin-right: 12rpx;
}
.title-text {
font-size: 32rpx;
font-weight: bold;
color: #5D4037;
letter-spacing: 1rpx;
}
.title-line {
flex: 1;
height: 2rpx;
background: linear-gradient(to right, rgba(139, 111, 71, 0.2), transparent);
margin-left: 20rpx;
}
/* ========== 充值套餐 ========== */
.recharge-plans {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-bottom: 32rpx;
}
.plan-card {
width: 215rpx;
height: 200rpx;
background: #fff;
border-radius: 24rpx;
margin-bottom: 24rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(139, 111, 71, 0.1);
transition: all 0.3s ease;
border: 3rpx solid transparent;
}
.plan-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, #FFF9F0 0%, #FFF 100%);
z-index: 0;
}
.plan-card > view {
position: relative;
z-index: 1;
}
/* 选中状态 */
.plan-active {
border-color: #8B6F47;
box-shadow: 0 12rpx 32rpx rgba(139, 111, 71, 0.25);
transform: translateY(-4rpx);
}
.plan-active::before {
background: linear-gradient(135deg, #FFF9F0 0%, #FFE4C4 100%);
}
/* 赠送标签 */
.plan-badge {
position: absolute;
top: 12rpx;
right: -40rpx;
background: linear-gradient(135deg, #FF6B6B, #FF8E53);
color: #fff;
font-size: 20rpx;
padding: 4rpx 48rpx;
transform: rotate(45deg);
box-shadow: 0 4rpx 8rpx rgba(255, 107, 107, 0.3);
z-index: 2;
font-weight: bold;
}
/* 金额显示 */
.plan-amount {
display: flex;
align-items: baseline;
margin-bottom: 8rpx;
}
.plan-currency {
font-size: 28rpx;
color: #8B6F47;
font-weight: bold;
margin-right: 4rpx;
}
.plan-number {
font-size: 56rpx;
color: #5D4037;
font-weight: bold;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.plan-label {
font-size: 24rpx;
color: #999;
}
/* 选中图标 */
.plan-check {
position: absolute;
top: 12rpx;
left: 12rpx;
width: 32rpx;
height: 32rpx;
background: linear-gradient(135deg, #8B6F47, #A0826D);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 12rpx rgba(139, 111, 71, 0.4);
}
/* 选中光效 */
.plan-shine {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(139, 111, 71, 0.1) 0%, transparent 70%);
animation: shine 2s ease-in-out infinite;
}
@keyframes shine {
0%, 100% { opacity: 0.5; }
50% { opacity: 1; }
}
/* 自定义金额卡片 */
.plan-custom {
background: linear-gradient(135deg, #F5F5F5, #FFF);
}
.custom-icon {
font-size: 56rpx;
margin-bottom: 12rpx;
}
.custom-text {
font-size: 28rpx;
color: #666;
font-weight: bold;
}
/* ========== 确认按钮 ========== */
.action-btn {
padding: 0 8rpx;
}
.submit-btn {
background: linear-gradient(135deg, #8B6F47 0%, #A0826D 100%);
border-radius: 48rpx;
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 12rpx 32rpx rgba(139, 111, 71, 0.3);
transition: all 0.3s ease;
}
.submit-btn:active {
transform: scale(0.98);
box-shadow: 0 8rpx 24rpx rgba(139, 111, 71, 0.25);
}
.submit-btn text {
font-size: 32rpx;
color: #fff;
font-weight: bold;
letter-spacing: 4rpx;
}
/* ========== 功能入口 ========== */
.function-section {
margin-bottom: 32rpx;
}
.function-list {
background: #fff;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(139, 111, 71, 0.08);
}
.function-item {
display: flex;
align-items: center;
padding: 32rpx 28rpx;
position: relative;
transition: background 0.2s;
}
.function-item::after {
content: '';
position: absolute;
left: 28rpx;
right: 28rpx;
bottom: 0;
height: 1rpx;
background: #f5f5f5;
}
.function-item:last-child::after {
display: none;
}
.function-item-hover {
background: #fafafa;
}
.function-icon-box {
width: 88rpx;
height: 88rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
}
.recharge-icon {
background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
}
.cash-icon {
background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
}
.function-emoji {
font-size: 40rpx;
}
.function-content {
flex: 1;
}
.function-title {
font-size: 30rpx;
color: #333;
font-weight: 600;
margin-bottom: 8rpx;
}
.function-desc {
font-size: 24rpx;
color: #999;
}
/* ========== 弹窗样式 ========== */
.popup-content {
padding: 48rpx 32rpx 32rpx;
}
.popup-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 40rpx;
position: relative;
}
.popup-title::after {
content: '';
position: absolute;
bottom: -16rpx;
left: 50%;
transform: translateX(-50%);
width: 80rpx;
height: 6rpx;
background: linear-gradient(to right, transparent, #8B6F47, transparent);
border-radius: 3rpx;
}
.popup-btn {
margin-top: 48rpx;
padding: 0 8rpx;
}
/* ========== 底部留白 ========== */
.bottom-blank {
height: 40rpx;
}
================================================
FILE: pages/asset/recharge-log.js
================================================
const APP = getApp()
const WXAPI = require('apifm-wxapi')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
/**
* 页面的初始数据
*/
data: {
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.asset.rechargeLogs,
})
this.payLogs()
},
onShow: function () {
},
async payLogs() {
wx.showLoading({
title: '',
})
const res = await WXAPI.payLogs({
token: wx.getStorageSync('token'),
page:1,
pageSize:500,
status: 1
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
payLogs: res.data
})
}
},
})
================================================
FILE: pages/asset/recharge-log.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/asset/recharge-log.wxml
================================================
🎉
累计充值
{{payLogs.length}} 次
充值记录
💳
💰
{{item.payGateStr}}
{{item.dateUpdate}}
¥
{{item.money}}
成功
🧋
{{ $t.common.empty || '暂无充值记录' }}
快去充值享受更多优惠吧~
================================================
FILE: pages/asset/recharge-log.wxss
================================================
/* pages/asset/recharge-log.wxss */
page {
background: linear-gradient(180deg, #FFF9F0 0%, #FFFBF7 50%, #FFF5EB 100%);
min-height: 100vh;
}
.recharge-log-container {
min-height: 100vh;
padding-bottom: 40rpx;
position: relative;
overflow: hidden;
}
/* 顶部装饰气泡 */
.header-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 400rpx;
overflow: hidden;
pointer-events: none;
z-index: 0;
}
.bubble-decoration {
position: absolute;
border-radius: 50%;
opacity: 0.12;
animation: float 6s ease-in-out infinite;
}
.bubble-1 {
width: 320rpx;
height: 320rpx;
background: linear-gradient(135deg, #FFD4A3 0%, #FFA87D 100%);
top: -100rpx;
right: -80rpx;
animation-delay: 0s;
}
.bubble-2 {
width: 240rpx;
height: 240rpx;
background: linear-gradient(135deg, #FFDAB9 0%, #FFB499 100%);
top: 80rpx;
left: -60rpx;
animation-delay: 1s;
}
.bubble-3 {
width: 160rpx;
height: 160rpx;
background: linear-gradient(135deg, #FFE4C4 0%, #FFDAB9 100%);
top: 200rpx;
right: 60rpx;
animation-delay: 2s;
}
.bubble-4 {
width: 120rpx;
height: 120rpx;
background: linear-gradient(135deg, #FFC4A3 0%, #FF9A7D 100%);
top: 260rpx;
left: 120rpx;
animation-delay: 1.5s;
}
@keyframes float {
0%, 100% {
transform: translateY(0) rotate(0deg);
}
50% {
transform: translateY(-20rpx) rotate(5deg);
}
}
/* 顶部统计卡片 */
.summary-card {
margin: 32rpx 32rpx 24rpx;
padding: 40rpx;
background: linear-gradient(135deg, #FF9A76 0%, #FF7B51 100%);
border-radius: 28rpx;
box-shadow: 0 8rpx 32rpx rgba(255, 123, 81, 0.25);
display: flex;
align-items: center;
position: relative;
z-index: 1;
overflow: hidden;
animation: slideDown 0.5s ease-out;
}
.summary-card::before {
content: '';
position: absolute;
top: -50%;
right: -20%;
width: 200rpx;
height: 200rpx;
background: rgba(255, 255, 255, 0.15);
border-radius: 50%;
}
.summary-card::after {
content: '';
position: absolute;
bottom: -30%;
left: -10%;
width: 150rpx;
height: 150rpx;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-30rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.summary-icon {
font-size: 64rpx;
margin-right: 24rpx;
filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.1));
z-index: 1;
}
.summary-text {
display: flex;
flex-direction: column;
z-index: 1;
}
.summary-title {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 8rpx;
font-weight: 400;
}
.summary-count {
font-size: 40rpx;
color: #FFFFFF;
font-weight: 700;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
/* 列表标题 */
.recharge-list {
padding: 0 32rpx;
position: relative;
z-index: 1;
}
.list-title {
margin-bottom: 24rpx;
display: flex;
align-items: center;
animation: fadeIn 0.6s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.title-text {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-right: 16rpx;
position: relative;
}
.title-text::before {
content: '';
position: absolute;
left: -12rpx;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: linear-gradient(180deg, #FF9A76 0%, #FF7B51 100%);
border-radius: 3rpx;
}
.title-line {
flex: 1;
height: 2rpx;
background: linear-gradient(90deg, rgba(255, 154, 118, 0.2) 0%, rgba(255, 154, 118, 0) 100%);
}
/* 充值记录项 */
.recharge-item {
margin-bottom: 24rpx;
animation: slideUp 0.5s ease-out backwards;
}
.recharge-item:nth-child(2) { animation-delay: 0.1s; }
.recharge-item:nth-child(3) { animation-delay: 0.15s; }
.recharge-item:nth-child(4) { animation-delay: 0.2s; }
.recharge-item:nth-child(5) { animation-delay: 0.25s; }
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(30rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.recharge-card {
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 4rpx 24rpx rgba(255, 154, 118, 0.08);
position: relative;
overflow: hidden;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.recharge-card:active {
transform: scale(0.98);
box-shadow: 0 2rpx 16rpx rgba(255, 154, 118, 0.12);
}
/* 卡片背景图标 */
.card-bg-icon {
position: absolute;
right: -20rpx;
bottom: -20rpx;
font-size: 160rpx;
opacity: 0.04;
transform: rotate(-15deg);
pointer-events: none;
}
/* 卡片内容 */
.card-content {
padding: 36rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
z-index: 1;
}
/* 左侧内容 */
.recharge-left {
display: flex;
align-items: center;
flex: 1;
overflow: hidden;
}
.icon-circle {
width: 96rpx;
height: 96rpx;
border-radius: 24rpx;
background: linear-gradient(135deg, #FFF4ED 0%, #FFE8DB 100%);
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
flex-shrink: 0;
box-shadow: 0 4rpx 16rpx rgba(255, 154, 118, 0.12);
position: relative;
}
.icon-circle::before {
content: '';
position: absolute;
inset: 0;
border-radius: 24rpx;
padding: 2rpx;
background: linear-gradient(135deg, #FFD4A3, #FFA87D);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0.3;
}
.recharge-icon {
font-size: 48rpx;
filter: drop-shadow(0 2rpx 4rpx rgba(255, 123, 81, 0.2));
}
.recharge-info {
display: flex;
flex-direction: column;
overflow: hidden;
}
.payment-method {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-bottom: 10rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.recharge-time {
font-size: 24rpx;
color: #999999;
line-height: 1.5;
}
/* 右侧金额 */
.recharge-right {
display: flex;
flex-direction: column;
align-items: flex-end;
margin-left: 24rpx;
flex-shrink: 0;
}
.amount-wrapper {
display: flex;
align-items: baseline;
margin-bottom: 8rpx;
}
.amount-symbol {
font-size: 28rpx;
font-weight: 600;
color: #FF7B51;
margin-right: 4rpx;
}
.amount-value {
font-size: 40rpx;
font-weight: 700;
color: #FF7B51;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "DIN Alternate", sans-serif;
}
.success-badge {
padding: 6rpx 16rpx;
background: linear-gradient(135deg, #E8F8F0 0%, #D4F4E6 100%);
border-radius: 20rpx;
border: 1rpx solid rgba(76, 217, 100, 0.15);
}
.badge-text {
font-size: 22rpx;
color: #52C41A;
font-weight: 500;
}
/* 底部装饰线 */
.card-bottom-line {
height: 6rpx;
background: linear-gradient(90deg, #FF9A76 0%, #FF7B51 50%, #FF9A76 100%);
opacity: 0.6;
}
/* 空状态 */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 180rpx 60rpx;
position: relative;
z-index: 1;
}
.empty-animation {
position: relative;
margin-bottom: 40rpx;
animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-20rpx);
}
}
.empty-cup {
font-size: 140rpx;
filter: drop-shadow(0 8rpx 16rpx rgba(0, 0, 0, 0.08));
}
.empty-shine {
position: absolute;
top: 20rpx;
right: 20rpx;
width: 40rpx;
height: 40rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
border-radius: 50%;
animation: shine 2s ease-in-out infinite;
}
@keyframes shine {
0%, 100% {
opacity: 0.3;
transform: scale(0.8);
}
50% {
opacity: 1;
transform: scale(1.2);
}
}
.empty-title {
font-size: 32rpx;
color: #999999;
margin-bottom: 16rpx;
font-weight: 500;
}
.empty-desc {
font-size: 26rpx;
color: #CCCCCC;
text-align: center;
line-height: 1.6;
}
================================================
FILE: pages/booking/index.js
================================================
const APP = getApp()
const AUTH = require('../../utils/auth')
const WXAPI = require('apifm-wxapi')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
data: {
persionNum: { // 每种语言列举
zh_CN: ['1-2人', '3-4人', '5-8人', '8人以上'],
en: ['1-2 Person', '3-4 Person', '5-8 Person', 'More than 8'],
},
persionNumIndex: 0,
showDatetimePop: false,
filter(type, options) {
if (type === 'minute') {
return options.filter((option) => option % 10 === 0);
}
return options;
},
currentDate: new Date().getTime(),
minDate: new Date().getTime(),
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.booking.title,
})
this.setData({
formatter: (type, value) => {
if (type === 'year') {
return `${value}` + this.data.$t.date.year;
} else if (type === 'month') {
return `${value}` + this.data.$t.date.month;
} else if (type === 'day') {
return `${value}` + this.data.$t.date.day;
} else if (type === 'hour') {
return `${value}` + this.data.$t.date.hour;
} else if (type === 'minute') {
return `${value}` + this.data.$t.date.minutes;
}
return value;
}
})
},
onShow: function () {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.auth.needLogin,
showCancel: false,
success: () => {
wx.navigateBack()
}
})
}
})
},
changePersionNum(e) {
this.setData({
persionNumIndex: e.currentTarget.dataset.idx
})
},
async submit() {
if (!this.data.name) {
wx.showToast({
title: this.data.$t.booking.namePlaceholder,
icon: 'none'
})
return
}
if (!this.data.mobile) {
wx.showToast({
title: this.data.$t.booking.mobilePlaceholder,
icon: 'none'
})
return
}
if (!this.data.time) {
wx.showToast({
title: this.data.$t.booking.timePlaceholder,
icon: 'none'
})
return
}
const extJsonStr = {}
extJsonStr['姓名'] = this.data.name
extJsonStr['联系电话'] = this.data.mobile
extJsonStr['到店时间'] = this.data.time
extJsonStr['用餐人数'] = this.data.persionNum['zh_CN'][this.data.persionNumIndex]
const res = await WXAPI.yuyueJoin({
token: wx.getStorageSync('token'),
yuyueId: wx.getStorageSync('zxdz'),
extJsonStr: JSON.stringify(extJsonStr)
})
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
} else {
wx.showToast({
title: this.data.$t.common.submitSuccess,
icon: 'success'
})
setTimeout(() => {
wx.navigateBack()
}, 1000);
}
},
showDatetimePop() {
this.setData({
showDatetimePop: true
})
},
hideDatetimePop() {
this.setData({
showDatetimePop: false
})
},
confirm(e) {
const newDate = new Date(e.detail)
this.setData({
time: newDate.toLocaleString()
})
this.hideDatetimePop()
},
})
================================================
FILE: pages/booking/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/booking/index.wxml
================================================
👤
预订信息
{{ $t.booking.name }}
*
{{ $t.booking.mobile }}
*
{{ $t.booking.time }}
*
👥
{{ $t.booking.person }}
{{persionNumIndex == index ? '✓' : '👥'}}
{{ item }}
{{ $t.booking.title }}
{{ $t.booking.tip }}
================================================
FILE: pages/booking/index.wxss
================================================
/* 页面容器 */
page {
background: linear-gradient(180deg, #FFF5E6 0%, #FFFFFF 100%);
min-height: 100vh;
}
.booking-container {
padding-bottom: 40rpx;
}
/* 顶部横幅区域 */
.header-banner {
position: relative;
height: 420rpx;
overflow: hidden;
margin-bottom: -40rpx;
}
.banner-bg {
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient(135deg, #D4A574 0%, #C89968 50%, #B8855A 100%);
opacity: 0.95;
}
.banner-bg::after {
content: '';
position: absolute;
bottom: -2rpx;
left: 0;
width: 100%;
height: 100rpx;
background: #FFFFFF;
border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.banner-content {
position: relative;
z-index: 2;
padding-top: 50rpx;
padding-bottom: 40rpx;
text-align: center;
color: #FFFFFF;
}
.banner-icon {
font-size: 88rpx;
margin-bottom: 16rpx;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10rpx); }
}
.banner-title {
font-size: 48rpx;
font-weight: 600;
margin-bottom: 8rpx;
letter-spacing: 4rpx;
}
.banner-subtitle {
font-size: 26rpx;
opacity: 0.9;
letter-spacing: 2rpx;
}
/* 表单卡片 */
.form-card {
margin: 30rpx 30rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 40rpx 32rpx;
box-shadow: 0 8rpx 32rpx rgba(196, 153, 104, 0.12);
}
.person-card {
padding-bottom: 32rpx;
}
/* 区块标题 */
.section-title {
display: flex;
align-items: center;
margin-bottom: 32rpx;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.title-icon {
font-size: 40rpx;
margin-right: 12rpx;
}
.title-text {
font-size: 32rpx;
font-weight: 600;
color: #333333;
letter-spacing: 1rpx;
}
/* 输入组 */
.input-group {
margin-bottom: 28rpx;
}
.input-group:last-child {
margin-bottom: 0;
}
.input-label {
display: flex;
align-items: center;
margin-bottom: 12rpx;
padding-left: 4rpx;
}
.label-text {
font-size: 28rpx;
color: #666666;
font-weight: 500;
}
.label-required {
color: #FF6B6B;
margin-left: 4rpx;
font-size: 28rpx;
}
/* 自定义输入框样式 */
.custom-field {
background: #F8F8F8 !important;
border-radius: 16rpx !important;
padding: 24rpx 20rpx !important;
border: 2rpx solid transparent !important;
transition: all 0.3s ease;
}
.custom-field:focus {
background: #FFFFFF !important;
border-color: #D4A574 !important;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.15);
}
/* 人数选择 */
.persion-num {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
margin-top: 24rpx;
}
.person-item {
flex: 0 0 calc(50% - 10rpx);
background: linear-gradient(135deg, #FAFAFA 0%, #F5F5F5 100%);
border-radius: 20rpx;
padding: 32rpx 20rpx;
text-align: center;
border: 3rpx solid transparent;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
overflow: hidden;
}
.person-item::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, #D4A574 0%, #C89968 100%);
opacity: 0;
transition: opacity 0.3s ease;
z-index: 0;
}
.person-item.active::before {
opacity: 1;
}
.person-item.active {
border-color: #D4A574;
transform: translateY(-4rpx);
box-shadow: 0 12rpx 28rpx rgba(212, 165, 116, 0.3);
}
.person-icon {
position: relative;
z-index: 1;
font-size: 48rpx;
margin-bottom: 12rpx;
transition: transform 0.3s ease;
}
.person-item.active .person-icon {
transform: scale(1.2);
}
.person-text {
position: relative;
z-index: 1;
font-size: 28rpx;
color: #666666;
font-weight: 500;
transition: color 0.3s ease;
}
.person-item.active .person-text {
color: #FFFFFF;
font-weight: 600;
}
/* 提交区域 */
.submit-container {
padding: 20rpx 30rpx 0;
}
.btn {
margin-bottom: 20rpx;
}
.submit-btn {
background: linear-gradient(135deg, #D4A574 0%, #C89968 100%) !important;
border: none !important;
border-radius: 48rpx !important;
height: 96rpx !important;
box-shadow: 0 12rpx 32rpx rgba(212, 165, 116, 0.35) !important;
transition: all 0.3s ease !important;
}
.submit-btn:active {
transform: translateY(2rpx);
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.3) !important;
}
.btn-text {
font-size: 32rpx;
font-weight: 600;
letter-spacing: 4rpx;
}
.profile {
text-align: center;
color: #999999;
font-size: 24rpx;
line-height: 1.6;
padding: 0 20rpx;
}
/* 为Vant组件添加全局样式覆盖 */
.van-field__control {
font-size: 28rpx !important;
color: #333333 !important;
}
.van-field__placeholder {
color: #BBBBBB !important;
}
/* 优化动画性能 */
.person-item,
.submit-btn,
.banner-icon {
will-change: transform;
}
================================================
FILE: pages/card/exchange.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
agree: false,
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.card.excharge,
})
},
_agree() {
this.setData({
agree: !this.data.agree
})
},
xieyi() {
wx.navigateTo({
url: '/pages/about/index?key=lipinkaxieyi',
})
},
async submit(){
if (!this.data.number) {
wx.showToast({
title: this.data.$t.card.pleaseInputNumber,
icon: 'none'
})
return
}
if (!this.data.agree) {
wx.showToast({
title: this.data.$t.card.xieyi0,
icon: 'none'
})
return
}
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/twoctygmpqlhnfkm
const res = await WXAPI.cardExchangeFromPwd({
token: wx.getStorageSync('token'),
number: this.data.number
})
wx.hideLoading()
if (res.code == 0) {
wx.showModal({
content: this.data.$t.coupons.Redemption,
showCancel: false,
success: (res) => {
wx.setStorageSync('cardmyrefresh', true)
wx.navigateBack()
}
})
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
},
})
================================================
FILE: pages/card/exchange.json
================================================
{
"usingComponents": {}
}
================================================
FILE: pages/card/exchange.wxml
================================================
🔖
兑换码
请输入完整的礼品卡兑换码
我已阅读并同意
{{ $t.card.xieyi }}
立即兑换
💡 温馨提示
• 每个兑换码仅可使用一次
• 兑换成功后将自动存入您的账户
• 如有疑问请联系客服咨询
================================================
FILE: pages/card/exchange.wxss
================================================
page {
background: linear-gradient(180deg, #F5EDE4 0%, #FDFBF7 100%);
min-height: 100vh;
}
/* 容器 */
.exchange-container {
padding: 40rpx 32rpx;
min-height: 100vh;
}
/* 顶部装饰区域 */
.header-section {
position: relative;
text-align: center;
padding: 60rpx 0 80rpx;
overflow: hidden;
}
/* 装饰圆圈 */
.decoration-circle {
position: absolute;
border-radius: 50%;
opacity: 0.1;
}
.circle-1 {
width: 300rpx;
height: 300rpx;
background: linear-gradient(135deg, #D4A574 0%, #C89666 100%);
top: -100rpx;
left: -80rpx;
}
.circle-2 {
width: 200rpx;
height: 200rpx;
background: linear-gradient(135deg, #E8C4A0 0%, #D4A574 100%);
top: 20rpx;
right: -50rpx;
}
/* 卡片图标 */
.card-icon {
position: relative;
z-index: 1;
margin-bottom: 32rpx;
}
.icon-wrapper {
display: inline-block;
width: 120rpx;
height: 120rpx;
line-height: 120rpx;
font-size: 64rpx;
background: linear-gradient(135deg, #FFF5EB 0%, #FFE8D6 100%);
border-radius: 50%;
box-shadow: 0 8rpx 32rpx rgba(212, 165, 116, 0.2);
}
/* 标题 */
.title {
position: relative;
z-index: 1;
font-size: 48rpx;
font-weight: 700;
color: #5D4E3C;
margin-bottom: 16rpx;
letter-spacing: 2rpx;
}
.subtitle {
position: relative;
z-index: 1;
font-size: 28rpx;
color: #9B8B7A;
font-weight: 400;
}
/* 内容卡片 */
.content-card {
background: #FFFFFF;
border-radius: 32rpx;
padding: 48rpx 40rpx;
box-shadow: 0 8rpx 40rpx rgba(93, 78, 60, 0.08);
position: relative;
overflow: hidden;
}
.content-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6rpx;
background: linear-gradient(90deg, #D4A574 0%, #C89666 50%, #D4A574 100%);
}
/* 输入区域 */
.input-section {
margin-bottom: 40rpx;
}
.input-label {
display: flex;
align-items: center;
margin-bottom: 20rpx;
font-size: 30rpx;
font-weight: 600;
color: #5D4E3C;
}
.label-icon {
font-size: 32rpx;
margin-right: 12rpx;
}
.input-wrapper {
margin-bottom: 16rpx;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 4rpx 16rpx rgba(93, 78, 60, 0.05);
}
.input-tips {
font-size: 24rpx;
color: #B5A393;
padding-left: 8rpx;
margin-top: 12rpx;
}
/* 协议勾选区域 */
.agreement-section {
margin: 40rpx 0;
padding: 24rpx 0;
}
.agreement-checkbox {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
.checkbox {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #D4A574;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 12rpx;
transition: all 0.3s ease;
background: #FFFFFF;
}
.checkbox.checked {
background: linear-gradient(135deg, #D4A574 0%, #C89666 100%);
border-color: #C89666;
}
.agreement-text {
font-size: 26rpx;
color: #7A6B5A;
margin-right: 8rpx;
}
.agreement-link {
font-size: 26rpx;
color: #D4A574;
font-weight: 500;
text-decoration: underline;
}
/* 提交按钮 */
.submit-section {
margin: 48rpx 0 40rpx;
}
.submit-btn {
position: relative;
height: 96rpx;
background: linear-gradient(135deg, #D4A574 0%, #C89666 100%);
border-radius: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-weight: 600;
color: #FFFFFF;
letter-spacing: 4rpx;
box-shadow: 0 12rpx 32rpx rgba(212, 165, 116, 0.35);
overflow: hidden;
transition: all 0.3s ease;
}
.submit-btn::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
}
.submit-btn:active {
transform: scale(0.98);
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.3);
}
.btn-shine {
position: absolute;
top: 0;
left: -100%;
width: 50%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
animation: shine 3s infinite;
}
@keyframes shine {
0% {
left: -100%;
}
50%, 100% {
left: 150%;
}
}
/* 温馨提示 */
.tips-section {
background: linear-gradient(135deg, #FFF9F3 0%, #FFF5EB 100%);
border-radius: 20rpx;
padding: 32rpx;
border: 2rpx solid #F5E8DB;
}
.tips-title {
font-size: 28rpx;
font-weight: 600;
color: #5D4E3C;
margin-bottom: 20rpx;
display: flex;
align-items: center;
}
.tips-item {
font-size: 26rpx;
color: #8A7866;
line-height: 44rpx;
padding-left: 8rpx;
}
================================================
FILE: pages/card/index.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
active: 0
},
onLoad(e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.card.title,
})
this.banners()
this.cardList()
},
onShow() {
const cardmyrefresh = wx.getStorageSync('cardmyrefresh')
if (cardmyrefresh) {
wx.removeStorageSync('cardmyrefresh')
this.setData({
active: 1
})
this.cardMyList()
}
},
tabChange(e) {
this.setData({
active: e.detail.index
})
if (e.detail.index == 1) {
// 我的礼品卡
this.cardMyList()
}
},
onShareAppMessage() {
return {
title: this.data.$t.card.title,
path: '/pages/card/index?inviter_id=' + (wx.getStorageSync('uid') || ''),
imageUrl: wx.getStorageSync('share_pic')
}
},
onShareTimeline() {
return {
title: this.data.$t.card.title,
query: 'inviter_id=' + (wx.getStorageSync('uid') || ''),
imageUrl: wx.getStorageSync('share_pic')
}
},
async banners() {
// https://www.yuque.com/apifm/nu0f75/ms21ki
const res = await WXAPI.banners({
type: 'card'
})
if (res.code == 0) {
this.setData({
banners: res.data
})
}
},
tapBanner(e) {
const url = e.currentTarget.dataset.url
if (url) {
wx.navigateTo({
url
})
}
},
async cardList() {
// https://www.yuque.com/apifm/nu0f75/lx3wdf
const res = await WXAPI.cardList({
status: 0
})
if (res.code == 0) {
this.setData({
cardList: res.data
})
}
},
async cardMyList() {
// https://www.yuque.com/apifm/nu0f75/dcm1fi
wx.showLoading({
title: '',
})
const res = await WXAPI.cardMyList(wx.getStorageSync('token'))
wx.hideLoading()
if (res.code == 0) {
this.setData({
cardMyList: res.data
})
} else {
this.setData({
cardMyList: null
})
}
},
buy(e) {
const item = e.currentTarget.dataset.item
this.setData({
paymentShow: true,
money: item.price,
remark: this.data.$t.card.buy + ': ' + item.name,
nextAction: { // https://www.yuque.com/apifm/doc/aetmlb
type: 10,
id: item.id
}
})
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false,
active: 1
})
this.cardMyList()
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
sendUser(e) {
const item = e.currentTarget.dataset.item
wx.setStorageSync('sendCard', item)
wx.navigateTo({
url: '/pages/card/send',
})
},
async cardShareClose(e) {
const item = e.currentTarget.dataset.item
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/cz1urg3208qiu5um
const res = await WXAPI.cardShareClose({
token: wx.getStorageSync('token'),
id: item.id
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
active: 1
})
this.cardMyList()
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
},
})
================================================
FILE: pages/card/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/card/index.wxml
================================================
{{ item.name }}
🎁
{{ $t.card.excharge }}
输入兑换码领取礼品卡
→
{{ $t.coupons.expire }}: {{ item.dateEnd }}
{{ item.amount }}
¥{{ item.amount }}
{{ $t.card.times }}
{{ $t.card.sending }}
{{ item.cardInfo.name }}
{{ $t.card.cardShareOpen }}
{{ $t.card.cardShareClose }}
{{ $t.card.logs }}
{{ item.fromUser.nick || '微信用户' }}送出
================================================
FILE: pages/card/index.wxss
================================================
/* ==================== 页面容器 ==================== */
page {
background: linear-gradient(180deg, #FFF8F0 0%, #F5EDE4 100%);
min-height: 100vh;
}
.page-container {
position: relative;
min-height: 100vh;
padding-bottom: 40rpx;
}
/* 顶部装饰背景 */
.page-header-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 400rpx;
background: linear-gradient(135deg, #FFE4E1 0%, #FFF0F5 50%, #F5F0E8 100%);
z-index: 0;
opacity: 0.6;
}
/* ==================== 自定义Tab样式 ==================== */
.custom-tabs-wrapper {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10rpx);
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
position: relative;
z-index: 10;
padding-bottom: 32rpx;
}
/* 覆盖van-tabs样式 */
.custom-tabs-wrapper .van-tabs__wrap {
padding: 8rpx 0;
}
.custom-tabs-wrapper .van-tab {
font-size: 32rpx;
font-weight: 500;
padding: 16rpx 32rpx;
}
.custom-tabs-wrapper .van-tab--active {
font-weight: 600;
font-size: 34rpx;
}
.custom-tabs-wrapper .van-tabs__line {
width: 60rpx !important;
height: 6rpx;
border-radius: 3rpx;
background: linear-gradient(90deg, #A0826D 0%, #8B6F47 100%);
bottom: 12rpx;
}
/* ==================== Tab内容区 ==================== */
.tab-content {
position: relative;
z-index: 1;
}
/* ==================== 轮播图样式 ==================== */
.banner-section {
margin: 32rpx 32rpx 40rpx 32rpx;
position: relative;
z-index: 1;
}
.swiper-banner {
width: 100%;
height: 340rpx;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 30rpx rgba(160, 130, 109, 0.15);
}
.banner-wrapper {
width: 100%;
height: 100%;
position: relative;
}
.banner-image {
width: 100%;
height: 100%;
border-radius: 24rpx;
}
/* ==================== 礼品卡列表(购买) ==================== */
.card-list {
padding: 0 32rpx 40rpx 32rpx;
position: relative;
z-index: 1;
}
.gift-card-item {
margin-bottom: 32rpx;
animation: fadeInUp 0.5s ease forwards;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.card-container {
background: #FFFFFF;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(160, 130, 109, 0.12);
transition: all 0.3s ease;
position: relative;
}
.card-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(255, 182, 193, 0.05) 0%, rgba(255, 240, 245, 0.05) 100%);
pointer-events: none;
z-index: 1;
}
.card-image-wrapper {
position: relative;
width: 100%;
height: 420rpx;
overflow: hidden;
background: linear-gradient(135deg, #FFF0F5 0%, #FFE4E1 100%);
}
.card-image {
width: 100%;
height: 100%;
transition: transform 0.6s ease;
}
.card-container:active .card-image {
transform: scale(1.05);
}
/* 光泽效果 */
.card-shine {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
45deg,
transparent 30%,
rgba(255, 255, 255, 0.3) 50%,
transparent 70%
);
transform: rotate(45deg);
animation: shine 3s infinite;
}
@keyframes shine {
0% {
transform: translateX(-100%) translateY(-100%) rotate(45deg);
}
100% {
transform: translateX(100%) translateY(100%) rotate(45deg);
}
}
.card-content {
padding: 32rpx;
position: relative;
z-index: 2;
}
.card-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
line-height: 1.4;
}
.card-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.price-area {
display: flex;
align-items: baseline;
}
.price-symbol {
font-size: 28rpx;
color: #A0826D;
font-weight: 600;
margin-right: 4rpx;
}
.price-value {
font-size: 48rpx;
font-weight: 700;
color: #A0826D;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}
.buy-btn {
background: linear-gradient(135deg, #A0826D 0%, #8B6F47 100%);
color: #FFFFFF;
padding: 16rpx 48rpx;
border-radius: 48rpx;
font-size: 28rpx;
font-weight: 500;
box-shadow: 0 6rpx 20rpx rgba(160, 130, 109, 0.3);
transition: all 0.3s ease;
}
.buy-btn:active {
transform: scale(0.95);
box-shadow: 0 4rpx 12rpx rgba(160, 130, 109, 0.4);
}
/* ==================== 我的礼品卡 ==================== */
.my-card-list {
padding: 32rpx;
position: relative;
z-index: 1;
}
/* 兑换入口 */
.exchange-entry {
background: linear-gradient(135deg, #FFFFFF 0%, #FFF8F0 100%);
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 32rpx;
display: flex;
align-items: center;
box-shadow: 0 6rpx 24rpx rgba(160, 130, 109, 0.1);
border: 2rpx solid rgba(160, 130, 109, 0.15);
transition: all 0.3s ease;
}
.exchange-entry:active {
transform: scale(0.98);
box-shadow: 0 4rpx 16rpx rgba(160, 130, 109, 0.15);
}
.exchange-icon {
font-size: 56rpx;
margin-right: 24rpx;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-8rpx);
}
}
.exchange-info {
flex: 1;
}
.exchange-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
}
.exchange-desc {
font-size: 24rpx;
color: #999;
}
.exchange-arrow {
font-size: 40rpx;
color: #A0826D;
font-weight: 300;
}
/* 我的礼品卡卡片 */
.my-gift-card {
margin-bottom: 32rpx;
animation: fadeInUp 0.5s ease forwards;
}
.my-card-wrapper {
background: #FFFFFF;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(160, 130, 109, 0.12);
position: relative;
}
.my-card-wrapper::after {
content: '';
position: absolute;
top: 0;
right: 0;
width: 200rpx;
height: 200rpx;
background: radial-gradient(circle, rgba(255, 182, 193, 0.1) 0%, transparent 70%);
pointer-events: none;
}
.my-card-image-box {
position: relative;
width: 100%;
height: 380rpx;
overflow: hidden;
}
.my-card-image {
width: 100%;
height: 100%;
}
.card-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
padding: 40rpx 32rpx 24rpx 32rpx;
}
.card-amount-box {
display: flex;
justify-content: space-between;
align-items: flex-end;
}
.expire-date {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.9);
line-height: 1.5;
}
.card-amount {
font-size: 56rpx;
font-weight: 700;
color: #FFFFFF;
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.3);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
line-height: 1;
}
.card-amount .unit {
font-size: 28rpx;
font-weight: 500;
margin-left: 8rpx;
}
.card-status-tag {
position: absolute;
top: 32rpx;
right: 0;
background: linear-gradient(135deg, rgba(255, 107, 107, 0.95) 0%, rgba(255, 66, 66, 0.95) 100%);
color: #FFFFFF;
padding: 12rpx 28rpx;
border-radius: 32rpx 0 0 32rpx;
font-size: 24rpx;
font-weight: 500;
box-shadow: 0 4rpx 12rpx rgba(255, 66, 66, 0.4);
}
.my-card-info {
padding: 32rpx;
}
.card-name {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
}
/* 操作按钮 */
.card-actions {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.action-btn {
padding: 20rpx 0;
border-radius: 48rpx;
font-size: 28rpx;
font-weight: 500;
text-align: center;
transition: all 0.3s ease;
}
.action-btn.primary {
background: linear-gradient(135deg, #A0826D 0%, #8B6F47 100%);
color: #FFFFFF;
box-shadow: 0 6rpx 20rpx rgba(160, 130, 109, 0.3);
}
.action-btn.primary:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(160, 130, 109, 0.4);
}
.action-btn.danger {
background: linear-gradient(135deg, #FF9AA2 0%, #FF6B6B 100%);
color: #FFFFFF;
box-shadow: 0 6rpx 20rpx rgba(255, 107, 107, 0.3);
}
.action-btn.danger:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.4);
}
.action-btn.outline {
background: #FFFFFF;
color: #A0826D;
border: 2rpx solid #A0826D;
box-shadow: 0 4rpx 12rpx rgba(160, 130, 109, 0.15);
}
.action-btn.outline:active {
background: rgba(160, 130, 109, 0.05);
transform: scale(0.98);
}
/* 送礼人信息 */
.gift-from {
display: flex;
align-items: center;
margin-top: 16rpx;
padding: 20rpx;
background: linear-gradient(135deg, #FFF8F0 0%, #FFF0F5 100%);
border-radius: 16rpx;
border: 1rpx solid rgba(160, 130, 109, 0.1);
}
.from-avatar {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
margin-right: 16rpx;
border: 2rpx solid #FFFFFF;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.from-name {
font-size: 26rpx;
color: #666;
}
/* ==================== 空状态优化 ==================== */
van-empty {
padding: 120rpx 0;
background: transparent;
}
================================================
FILE: pages/card/logs.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
page: 1 // 读取第几页
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.card.logs,
})
this.data.cardId = options.cardId
this.cardMyLogs()
},
async cardMyLogs(){
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/gp7sey
const res = await WXAPI.cardMyLogs({
token: wx.getStorageSync('token'),
cardId: this.data.cardId,
page: this.data.page
})
wx.hideLoading()
if (res.code == 0) {
if (this.data.page == 1) {
this.setData({
list: res.data.result,
})
} else {
this.setData({
list: this.data.list.concat(res.data.result),
})
}
} else {
if (this.data.page == 1) {
this.setData({
list: null,
})
}
}
},
onPullDownRefresh: function () {
this.data.page = 1
this.cardMyLogs()
wx.stopPullDownRefresh()
},
onReachBottom() {
this.data.page++
this.cardMyLogs()
},
})
================================================
FILE: pages/card/logs.json
================================================
{
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
================================================
FILE: pages/card/logs.wxml
================================================
☕
消费记录
Card Consumption Record
📋
暂无消费记录
使用礼品卡消费后,记录会显示在这里哦~
消费金额
-
{{ item.amount }}
剩余余额
{{ item.balance }}
================================================
FILE: pages/card/logs.wxss
================================================
/* pages/card/logs.wxss */
page {
background: linear-gradient(180deg, #F5F0EB 0%, #FDFBF9 100%);
min-height: 100vh;
}
.page-container {
position: relative;
min-height: 100vh;
padding-bottom: 40rpx;
}
/* ========== 顶部装饰 ========== */
.header-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 280rpx;
background: linear-gradient(135deg, #D4B5A0 0%, #A0826D 100%);
overflow: hidden;
z-index: 0;
}
.decoration-circle {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
}
.circle-1 {
width: 300rpx;
height: 300rpx;
top: -100rpx;
right: -50rpx;
animation: float 6s ease-in-out infinite;
}
.circle-2 {
width: 200rpx;
height: 200rpx;
bottom: -80rpx;
left: -40rpx;
animation: float 8s ease-in-out infinite reverse;
}
.decoration-wave {
position: absolute;
bottom: -2rpx;
left: 0;
right: 0;
height: 60rpx;
background: #F5F0EB;
border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
@keyframes float {
0%, 100% {
transform: translateY(0) scale(1);
}
50% {
transform: translateY(-20rpx) scale(1.05);
}
}
/* ========== 卡片概览区域 ========== */
.card-overview {
position: relative;
z-index: 1;
padding: 40rpx 32rpx 32rpx;
}
.overview-content {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10rpx);
border-radius: 24rpx;
padding: 32rpx 28rpx;
box-shadow: 0 8rpx 32rpx rgba(160, 130, 109, 0.12);
}
.overview-icon {
font-size: 68rpx;
margin-right: 24rpx;
animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-8rpx);
}
}
.overview-text {
flex: 1;
display: flex;
flex-direction: column;
}
.overview-title {
font-size: 36rpx;
font-weight: 600;
color: #3D2F26;
line-height: 1.3;
margin-bottom: 8rpx;
}
.overview-subtitle {
font-size: 22rpx;
color: #A0826D;
letter-spacing: 1rpx;
text-transform: uppercase;
}
/* ========== 空状态 ========== */
.empty-container {
position: relative;
z-index: 1;
margin: 120rpx 32rpx;
padding: 100rpx 40rpx 80rpx;
background: #fff;
border-radius: 32rpx;
text-align: center;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.04);
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 32rpx;
opacity: 0.8;
animation: swing 3s ease-in-out infinite;
}
@keyframes swing {
0%, 100% {
transform: rotate(-5deg);
}
50% {
transform: rotate(5deg);
}
}
.empty-text {
font-size: 32rpx;
font-weight: 500;
color: #666;
margin-bottom: 16rpx;
}
.empty-tips {
font-size: 26rpx;
color: #999;
line-height: 1.6;
padding: 0 20rpx;
}
/* ========== 消费记录列表 ========== */
.records-container {
position: relative;
z-index: 1;
padding: 0 32rpx;
}
.timeline-item {
position: relative;
padding-left: 60rpx;
margin-bottom: 32rpx;
}
.timeline-item:not(:last-child)::before {
content: '';
position: absolute;
left: 22rpx;
top: 60rpx;
bottom: -32rpx;
width: 2rpx;
background: linear-gradient(180deg, #D4B5A0 0%, rgba(212, 181, 160, 0.3) 100%);
}
/* ========== 时间轴点 ========== */
.timeline-dot {
position: absolute;
left: 0;
top: 24rpx;
width: 46rpx;
height: 46rpx;
background: linear-gradient(135deg, #D4B5A0, #A0826D);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 12rpx rgba(160, 130, 109, 0.3);
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% {
box-shadow: 0 4rpx 12rpx rgba(160, 130, 109, 0.3);
}
50% {
box-shadow: 0 4rpx 20rpx rgba(160, 130, 109, 0.5);
}
}
.dot-inner {
width: 16rpx;
height: 16rpx;
background: #fff;
border-radius: 50%;
}
/* ========== 记录卡片 ========== */
.record-card {
position: relative;
background: #fff;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
overflow: hidden;
}
.record-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4rpx;
background: linear-gradient(90deg, #D4B5A0, #A0826D);
}
/* ========== 卡片头部 ========== */
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
.type-badge {
display: flex;
align-items: center;
background: linear-gradient(135deg, #FFF5EE, #F5EBE0);
padding: 12rpx 20rpx;
border-radius: 40rpx;
border: 1rpx solid rgba(160, 130, 109, 0.15);
}
.badge-icon {
font-size: 28rpx;
margin-right: 8rpx;
}
.badge-text {
font-size: 28rpx;
font-weight: 500;
color: #A0826D;
}
.date-text {
font-size: 24rpx;
color: #999;
}
/* ========== 卡片主体 ========== */
.card-body {
background: linear-gradient(135deg, #FDFBF9 0%, #F9F6F3 100%);
border-radius: 16rpx;
padding: 28rpx 24rpx;
}
.amount-section {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
.amount-label {
font-size: 26rpx;
color: #666;
}
.amount-value {
display: flex;
align-items: baseline;
}
.amount-symbol {
font-size: 32rpx;
font-weight: 600;
color: #FF6B6B;
margin-right: 4rpx;
}
.amount-number {
font-size: 44rpx;
font-weight: 700;
color: #FF6B6B;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
.divider {
height: 1rpx;
background: linear-gradient(90deg,
rgba(160, 130, 109, 0) 0%,
rgba(160, 130, 109, 0.2) 50%,
rgba(160, 130, 109, 0) 100%
);
margin: 24rpx 0;
}
.balance-section {
display: flex;
justify-content: space-between;
align-items: center;
}
.balance-item {
display: flex;
flex-direction: column;
gap: 8rpx;
}
.balance-label {
font-size: 24rpx;
color: #999;
}
.balance-value {
font-size: 36rpx;
font-weight: 600;
color: #52C41A;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
/* ========== 卡片装饰 ========== */
.card-decoration {
margin-top: 24rpx;
padding-top: 20rpx;
border-top: 1rpx dashed rgba(160, 130, 109, 0.2);
}
.deco-line {
height: 6rpx;
background: linear-gradient(90deg,
#D4B5A0 0%,
#A0826D 50%,
#D4B5A0 100%
);
border-radius: 3rpx;
opacity: 0.3;
}
/* ========== 底部空间 ========== */
.footer-space {
height: 60rpx;
}
================================================
FILE: pages/card/receive.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
},
onLoad (e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.card.shareplaceholder,
})
this.setData({
id: e.id,
shareToken: e.shareToken
})
this.cardShareFetch(true)
},
submit() {
this.cardShareFetch(false)
},
async cardShareFetch(calculate) {
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/gmfdsdag0gxv8tp0
const res = await WXAPI.cardShareFetch({
token: wx.getStorageSync('token'),
id: this.data.id,
shareToken: this.data.shareToken,
calculate
})
wx.hideLoading()
if (res.code == 0) {
if (calculate) {
this.setData({
user: res.data.user,
cardUser: res.data.cardUser,
cardInfo: res.data.cardInfo,
})
} else {
wx.showModal({
content: this.data.$t.card.fetchSuccess,
showCancel: false,
confirmText: this.data.$t.common.gotIt,
success: (res) => {
wx.reLaunch({
url: '/pages/home/index',
})
}
})
}
} else {
wx.showModal({
content: this.data.$t.card.receiveEmpty,
showCancel: false,
confirmText: this.data.$t.common.gotIt,
success: (res) => {
wx.reLaunch({
url: '/pages/home/index',
})
}
})
}
},
})
================================================
FILE: pages/card/receive.json
================================================
{
"usingComponents": {}
}
================================================
FILE: pages/card/receive.wxml
================================================
🎁
{{ user.nick || $t.card.friend }}
{{ $t.card.shareplaceholder }}
💌
{{ cardInfo.shareContent }}
"
"
{{ cardInfo.name }}
{{ cardUser.amount }}
{{ $t.card.times }}
¥
{{ cardUser.amount }}
✨
✨
✨
{{ $t.card.cardShareFetch }}
☕
领取后可在"我的"-"礼品卡"中查看
================================================
FILE: pages/card/receive.wxss
================================================
/* 页面整体样式 - 奶茶店温馨渐变背景 */
page {
background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 50%, #f8d7da 100%);
min-height: 100vh;
padding-bottom: 40rpx;
}
/* 页面容器 */
.page-container {
position: relative;
min-height: 100vh;
overflow: hidden;
}
/* 顶部波浪装饰 */
.wave-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 200rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
border-radius: 0 0 50% 50%;
z-index: 0;
}
/* 主卡片容器 */
.main-card {
position: relative;
margin: 40rpx 32rpx;
background: linear-gradient(135deg, #ffffff 0%, #fffbf7 100%);
padding: 48rpx 32rpx 56rpx;
border-radius: 40rpx;
box-shadow: 0 20rpx 60rpx rgba(252, 182, 159, 0.3),
0 8rpx 20rpx rgba(255, 236, 210, 0.2);
z-index: 1;
overflow: hidden;
}
/* 礼物图标装饰 */
.gift-icon {
position: absolute;
top: -20rpx;
right: 40rpx;
font-size: 80rpx;
animation: float 3s ease-in-out infinite;
z-index: 2;
}
@keyframes float {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-10rpx) rotate(5deg); }
}
/* 赠送人信息区域 */
.sender-section {
display: flex;
align-items: center;
padding: 20rpx 0;
margin-bottom: 32rpx;
}
.sender-avatar-wrapper {
position: relative;
margin-right: 24rpx;
}
.sender-avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 4rpx solid #fff;
box-shadow: 0 8rpx 20rpx rgba(252, 182, 159, 0.3);
}
.avatar-border {
position: absolute;
top: -6rpx;
left: -6rpx;
right: -6rpx;
bottom: -6rpx;
border-radius: 50%;
border: 2rpx solid transparent;
background: linear-gradient(135deg, #fcb69f, #ffecd2);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
padding: 2rpx;
}
.sender-info {
flex: 1;
}
.sender-name {
font-size: 36rpx;
font-weight: bold;
color: #5c3317;
margin-bottom: 8rpx;
letter-spacing: 1rpx;
}
.sender-label {
font-size: 26rpx;
color: #a67c52;
opacity: 0.8;
}
/* 祝福留言卡片 */
.blessing-card {
position: relative;
background: linear-gradient(135deg, #fff9f3 0%, #ffe8d6 100%);
border-radius: 24rpx;
padding: 32rpx 40rpx;
margin: 32rpx 0 40rpx;
border: 2rpx dashed rgba(166, 124, 82, 0.3);
box-shadow: 0 4rpx 12rpx rgba(252, 182, 159, 0.15);
}
.blessing-icon {
position: absolute;
top: -16rpx;
left: 24rpx;
font-size: 48rpx;
background: #fff;
padding: 0 8rpx;
}
.blessing-text {
font-size: 28rpx;
line-height: 48rpx;
color: #5c3317;
font-style: italic;
text-align: center;
position: relative;
z-index: 1;
}
.blessing-quote-left,
.blessing-quote-right {
position: absolute;
font-size: 80rpx;
color: rgba(252, 182, 159, 0.2);
font-family: Georgia, serif;
font-weight: bold;
}
.blessing-quote-left {
top: 10rpx;
left: 10rpx;
}
.blessing-quote-right {
bottom: -20rpx;
right: 10rpx;
}
/* 礼品卡展示区 */
.gift-card-display {
position: relative;
margin: 48rpx 0;
}
.card-glow {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400rpx;
height: 400rpx;
background: radial-gradient(circle, rgba(252, 182, 159, 0.3) 0%, transparent 70%);
border-radius: 50%;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
}
.card-wrapper {
position: relative;
width: 100%;
height: 380rpx;
border-radius: 28rpx;
overflow: hidden;
box-shadow: 0 16rpx 40rpx rgba(92, 51, 23, 0.15);
background: #fff;
}
.card-image {
width: 100%;
height: 100%;
}
.card-shine {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg,
transparent 30%,
rgba(255, 255, 255, 0.3) 50%,
transparent 70%);
animation: shine 3s ease-in-out infinite;
}
@keyframes shine {
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
/* 卡片信息区 */
.card-info-section {
margin-top: 36rpx;
text-align: center;
}
.card-title {
font-size: 38rpx;
font-weight: bold;
color: #5c3317;
margin-bottom: 20rpx;
letter-spacing: 2rpx;
}
.card-divider {
width: 100rpx;
height: 4rpx;
background: linear-gradient(90deg, transparent, #fcb69f, transparent);
margin: 20rpx auto;
border-radius: 2rpx;
}
.card-amount-wrapper {
margin-top: 24rpx;
}
.card-amount {
display: inline-flex;
align-items: baseline;
padding: 16rpx 40rpx;
background: linear-gradient(135deg, #fff3e6 0%, #ffe8cc 100%);
border-radius: 60rpx;
box-shadow: 0 4rpx 16rpx rgba(252, 182, 159, 0.2);
}
.amount-symbol {
font-size: 32rpx;
color: #d4744f;
font-weight: bold;
margin-right: 4rpx;
}
.amount-number {
font-size: 64rpx;
font-weight: bold;
color: #d4744f;
line-height: 1;
}
.amount-unit {
font-size: 28rpx;
color: #a67c52;
margin-left: 8rpx;
font-weight: 500;
}
/* 闪光装饰元素 */
.sparkle {
position: absolute;
font-size: 48rpx;
opacity: 0.6;
animation: sparkle 2s ease-in-out infinite;
}
.sparkle-1 {
top: 15%;
left: 10%;
animation-delay: 0s;
}
.sparkle-2 {
top: 25%;
right: 15%;
animation-delay: 0.7s;
}
.sparkle-3 {
bottom: 35%;
left: 15%;
animation-delay: 1.4s;
}
@keyframes sparkle {
0%, 100% { opacity: 0.3; transform: scale(0.8) rotate(0deg); }
50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}
/* 领取按钮区域 */
.receive-button-wrapper {
position: relative;
margin-top: 56rpx;
margin-bottom: 32rpx;
}
.button-glow {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100rpx;
background: radial-gradient(ellipse, rgba(252, 182, 159, 0.4) 0%, transparent 70%);
filter: blur(20rpx);
}
.receive-button {
position: relative;
z-index: 1;
background: linear-gradient(135deg, #fcb69f 0%, #f8997f 100%) !important;
border: none !important;
box-shadow: 0 8rpx 24rpx rgba(248, 153, 127, 0.4),
0 4rpx 8rpx rgba(252, 182, 159, 0.3) !important;
font-size: 32rpx !important;
font-weight: bold !important;
letter-spacing: 4rpx !important;
transition: all 0.3s ease;
}
.receive-button:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(248, 153, 127, 0.3) !important;
}
/* 温馨提示 */
.warm-tips {
text-align: center;
font-size: 24rpx;
color: #a67c52;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.8;
margin-top: 16rpx;
}
.tips-icon {
font-size: 32rpx;
margin-right: 8rpx;
}
.tips-text {
line-height: 1.6;
}
/* 底部装饰 */
.bottom-decoration {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 120rpx;
background: linear-gradient(0deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
border-radius: 50% 50% 0 0;
pointer-events: none;
z-index: 0;
}
================================================
FILE: pages/card/send.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
autosize: {
minHeight: 100
},
},
onLoad (e) {
wx.hideShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.card.cardShareOpen,
})
this.setData({
cardUser: wx.getStorageSync('sendCard'),
remark: this.data.$t.card.shareplaceholder
})
this.cardShareOpen()
wx.setStorageSync('cardmyrefresh', true)
},
async cardShareOpen() {
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/xevcthfroio6xnc0
const res = await WXAPI.cardShareOpen({
token: wx.getStorageSync('token'),
id: this.data.cardUser.id,
remark: this.data.remark,
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
shareToken: res.data
})
}
},
onShareAppMessage(e) {
const promise = new Promise(resolve => {
WXAPI.cardShareOpen({
token: wx.getStorageSync('token'),
id: this.data.cardUser.id,
remark: this.data.remark,
}).then( res => {
if (res.code == 0) {
this.setData({
shareToken: res.data
})
resolve({
title: this.data.remark,
path: '/pages/card/receive?inviter_id=' + (wx.getStorageSync('uid') || '') + '&id='+ this.data.cardUser.id +'&shareToken=' + this.data.shareToken,
imageUrl: this.data.cardUser.cardInfo.pic,
})
}
})
})
return {
title: this.data.remark,
path: '/pages/card/receive?inviter_id=' + (wx.getStorageSync('uid') || '') + '&id='+ this.data.cardUser.id +'&shareToken=' + this.data.shareToken,
imageUrl: this.data.cardUser.cardInfo.pic,
promise
}
},
})
================================================
FILE: pages/card/send.json
================================================
{
"usingComponents": {}
}
================================================
FILE: pages/card/send.wxml
================================================
{{ cardUser.cardInfo.name }}
{{ cardUser.amount }}
{{ $t.card.times }}
¥
{{ cardUser.amount }}
💌
赠送留言
✨
{{ $t.card.cardShareOpen }}
================================================
FILE: pages/card/send.wxss
================================================
/* 页面整体背景 - 奶茶渐变 */
page {
background: linear-gradient(180deg,
#F5E6D3 0%,
#E8D4C0 50%,
#DCC5B0 100%);
min-height: 100vh;
}
/* 页面容器 */
.page-container {
position: relative;
min-height: 100vh;
overflow: hidden;
padding: 40rpx 32rpx 60rpx;
}
/* ========== 顶部装饰 ========== */
.top-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 400rpx;
overflow: hidden;
pointer-events: none;
z-index: 0;
}
.deco-circle {
position: absolute;
border-radius: 50%;
opacity: 0.1;
background: linear-gradient(135deg, #8B6F47 0%, #A0826D 100%);
}
.deco-circle-1 {
width: 400rpx;
height: 400rpx;
top: -200rpx;
right: -100rpx;
}
.deco-circle-2 {
width: 300rpx;
height: 300rpx;
top: 100rpx;
left: -150rpx;
}
/* ========== 礼品卡容器 ========== */
.gift-card-wrapper {
position: relative;
z-index: 1;
}
/* ========== 标题区域 ========== */
.header-section {
text-align: center;
margin-bottom: 48rpx;
animation: fadeInDown 0.6s ease-out;
}
.header-icon {
font-size: 80rpx;
margin-bottom: 16rpx;
animation: bounce 2s infinite;
}
.header-title {
font-size: 48rpx;
font-weight: 700;
color: #5D4037;
margin-bottom: 12rpx;
letter-spacing: 2rpx;
}
.header-subtitle {
font-size: 26rpx;
color: #8D6E63;
letter-spacing: 1rpx;
}
/* ========== 礼品卡主体 ========== */
.gift-card {
position: relative;
background: linear-gradient(135deg, #FFFFFF 0%, #FFF8F0 100%);
border-radius: 32rpx;
overflow: hidden;
box-shadow:
0 20rpx 60rpx rgba(141, 110, 99, 0.15),
0 8rpx 20rpx rgba(141, 110, 99, 0.1);
margin-bottom: 40rpx;
animation: fadeInUp 0.6s ease-out 0.2s both;
}
/* 卡片光泽效果 */
.card-shine {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
45deg,
transparent 30%,
rgba(255, 255, 255, 0.3) 50%,
transparent 70%
);
animation: shine 3s infinite;
pointer-events: none;
z-index: 2;
}
/* 卡片背景图案 */
.card-bg-pattern {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(circle at 20% 80%, rgba(139, 111, 71, 0.03) 0%, transparent 50%),
radial-gradient(circle at 80% 20%, rgba(160, 130, 109, 0.03) 0%, transparent 50%);
pointer-events: none;
z-index: 1;
}
.card-content {
position: relative;
z-index: 3;
padding: 40rpx;
}
/* 卡片图片区域 */
.card-image-wrapper {
position: relative;
width: 100%;
height: 380rpx;
border-radius: 24rpx;
overflow: hidden;
margin-bottom: 32rpx;
box-shadow: 0 8rpx 24rpx rgba(141, 110, 99, 0.12);
}
.card-image {
width: 100%;
height: 100%;
display: block;
}
.card-image-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
180deg,
transparent 0%,
rgba(93, 64, 55, 0.05) 100%
);
}
/* 卡片信息 */
.card-info {
text-align: center;
}
.card-name {
font-size: 40rpx;
font-weight: 700;
color: #4E342E;
margin-bottom: 24rpx;
letter-spacing: 1rpx;
line-height: 1.5;
}
.card-value {
display: flex;
justify-content: center;
align-items: baseline;
}
.value-container {
display: inline-flex;
align-items: baseline;
justify-content: center;
background: linear-gradient(135deg, #8B6F47 0%, #A0826D 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
padding: 16rpx 40rpx;
border-radius: 60rpx;
background-color: rgba(139, 111, 71, 0.08);
background-image: none;
}
.value-symbol {
font-size: 40rpx;
font-weight: 600;
color: #8B6F47;
margin-right: 8rpx;
}
.value-number {
font-size: 72rpx;
font-weight: 700;
color: #8B6F47;
line-height: 1;
}
.value-unit {
font-size: 32rpx;
font-weight: 500;
color: #A0826D;
margin-left: 8rpx;
}
/* ========== 留言区域 ========== */
.message-section {
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
margin-bottom: 40rpx;
box-shadow: 0 8rpx 32rpx rgba(141, 110, 99, 0.08);
animation: fadeInUp 0.6s ease-out 0.4s both;
}
.message-label {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.label-icon {
font-size: 36rpx;
margin-right: 12rpx;
}
.label-text {
font-size: 30rpx;
font-weight: 600;
color: #5D4037;
letter-spacing: 1rpx;
}
.message-input-wrapper {
background: #FFF8F0;
border-radius: 16rpx;
padding: 8rpx;
border: 2rpx solid #F5E6D3;
transition: all 0.3s ease;
}
.message-input-wrapper:focus-within {
border-color: #A0826D;
box-shadow: 0 0 0 4rpx rgba(160, 130, 109, 0.1);
}
.message-input {
background: transparent !important;
padding: 20rpx !important;
font-size: 28rpx !important;
color: #4E342E !important;
line-height: 1.6 !important;
min-height: 160rpx !important;
}
/* ========== 分享按钮 ========== */
.share-button-wrapper {
animation: fadeInUp 0.6s ease-out 0.6s both;
}
.share-button {
background: linear-gradient(135deg, #8B6F47 0%, #A0826D 100%) !important;
border: none !important;
box-shadow:
0 12rpx 40rpx rgba(139, 111, 71, 0.3),
0 4rpx 12rpx rgba(139, 111, 71, 0.2) !important;
height: 96rpx !important;
transition: all 0.3s ease;
}
.share-button:active {
transform: translateY(4rpx);
box-shadow:
0 8rpx 24rpx rgba(139, 111, 71, 0.2),
0 2rpx 8rpx rgba(139, 111, 71, 0.15) !important;
}
.button-content {
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
letter-spacing: 2rpx;
}
.button-icon {
font-size: 36rpx;
margin-right: 12rpx;
}
.button-text {
color: #FFFFFF;
}
/* ========== 底部装饰 ========== */
.bottom-decoration {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 200rpx;
overflow: hidden;
pointer-events: none;
z-index: 0;
}
.wave {
position: absolute;
bottom: 0;
left: 0;
width: 200%;
height: 100%;
background-repeat: repeat-x;
animation: wave 12s linear infinite;
}
.wave-1 {
background-image: linear-gradient(to right, transparent 50%, rgba(139, 111, 71, 0.05) 50%);
background-size: 400rpx 100%;
animation-duration: 15s;
}
.wave-2 {
background-image: linear-gradient(to right, transparent 50%, rgba(160, 130, 109, 0.03) 50%);
background-size: 600rpx 100%;
animation-duration: 20s;
animation-direction: reverse;
}
/* ========== 动画定义 ========== */
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-40rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(40rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-20rpx);
}
60% {
transform: translateY(-10rpx);
}
}
@keyframes shine {
0% {
transform: translateX(-100%) translateY(-100%) rotate(45deg);
}
100% {
transform: translateX(100%) translateY(100%) rotate(45deg);
}
}
@keyframes wave {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-50%);
}
}
================================================
FILE: pages/cart/index.js
================================================
const APP = getApp()
const WXAPI = require('apifm-wxapi')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
data: {
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.cart.title,
})
},
onShow: function () {
this.shippingCarInfo()
},
onPullDownRefresh() {
this.shippingCarInfo()
wx.stopPullDownRefresh()
},
async shippingCarInfo() {
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfo(wx.getStorageSync('token'))
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
this.setData({
shippingCarInfo: res.data
})
} else {
this.setData({
shippingCarInfo: null,
showCartPop: false
})
}
},
async cartStepChange(e) {
const token = wx.getStorageSync('token')
const index = e.currentTarget.dataset.idx
const item = this.data.shippingCarInfo.items[index]
if (e.detail < item.minBuyNumber) {
// 删除商品
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfoRemoveItem(token, item.key)
wx.hideLoading()
if (res.code != 0 && res.code != 700) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.shippingCarInfo()
} else {
// 修改数量
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfoModifyNumber(token, item.key, e.detail)
wx.hideLoading()
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.shippingCarInfo()
}
},
async clearCart() {
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfoRemoveAll(wx.getStorageSync('token'))
wx.hideLoading()
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.shippingCarInfo()
},
async goCreateOrder() {
const goodsJsonStr = []
this.data.shippingCarInfo.items.forEach(ele => {
let propertyChildIds = ''
if (ele.sku) {
ele.sku.forEach(_sku => {
propertyChildIds += `,${_sku.optionId}:${_sku.optionValueId}`
})
}
goodsJsonStr.push({
goodsId: ele.goodsId,
number: ele.number,
propertyChildIds,
})
})
wx.showLoading({
title: '',
})
const res = await WXAPI.cyTableAddOrder({
token: wx.getStorageSync('token'),
goodsJsonStr: JSON.stringify(goodsJsonStr)
})
wx.hideLoading()
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
await this.clearCart()
wx.redirectTo({
url: '/pages/cart/order',
})
},
})
================================================
FILE: pages/cart/index.json
================================================
{
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
================================================
FILE: pages/cart/index.wxml
================================================
🛒
{{ $t.cart.empty }}
去添加您喜欢的饮品吧
{{ item.name }}
{{option.optionValueName}}
+{{option.name}}
¥
{{ item.price }}
合计
¥
{{ shippingCarInfo.price }}
共{{shippingCarInfo.number}}{{ $t.cart.num }}
{{ $t.cart.btn }}
================================================
FILE: pages/cart/index.wxss
================================================
/* 页面容器 */
.cart-container {
min-height: 100vh;
background: linear-gradient(180deg, #faf8f5 0%, #f5f1eb 100%);
padding-bottom: 20rpx;
}
/* ==================== 空状态样式 ==================== */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 0;
text-align: center;
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 30rpx;
opacity: 0.6;
}
.empty-text {
font-size: 32rpx;
color: #999;
margin-bottom: 16rpx;
font-weight: 500;
}
.empty-tip {
font-size: 26rpx;
color: #bbb;
}
/* ==================== 顶部操作栏 ==================== */
.cart-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 32rpx;
background: #fff;
margin-bottom: 20rpx;
border-bottom: 1rpx solid #f0ebe5;
}
.cart-title {
display: flex;
align-items: center;
gap: 12rpx;
}
.title-icon {
font-size: 36rpx;
}
.title-text {
font-size: 34rpx;
font-weight: 600;
color: #333;
}
.item-count {
background: linear-gradient(135deg, #d4a574 0%, #c89860 100%);
color: #fff;
font-size: 22rpx;
padding: 4rpx 16rpx;
border-radius: 20rpx;
font-weight: 500;
}
.clear-btn {
display: flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 20rpx;
border-radius: 30rpx;
background: #f8f6f3;
font-size: 26rpx;
color: #999;
transition: all 0.3s;
}
/* ==================== 商品列表 ==================== */
.goods-list {
padding: 0 24rpx;
}
.goods-item {
margin-bottom: 24rpx;
animation: slideIn 0.4s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.item-card {
background: #fff;
border-radius: 24rpx;
padding: 24rpx;
display: flex;
gap: 24rpx;
box-shadow: 0 4rpx 20rpx rgba(212, 165, 116, 0.08);
transition: all 0.3s;
}
/* 商品图片 */
.item-image {
width: 180rpx;
height: 180rpx;
border-radius: 20rpx;
overflow: hidden;
flex-shrink: 0;
background: linear-gradient(135deg, #f8f6f3 0%, #f0ebe5 100%);
}
.goods-img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* 商品信息 */
.item-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.goods-name {
font-size: 30rpx;
font-weight: 600;
color: #333;
line-height: 1.4;
margin-bottom: 12rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
/* 规格标签 */
.goods-specs {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
margin-bottom: 16rpx;
}
.spec-tag {
background: linear-gradient(135deg, #f8f6f3 0%, #f0ebe5 100%);
color: #8b7355;
font-size: 22rpx;
padding: 6rpx 16rpx;
border-radius: 8rpx;
border: 1rpx solid #e8dfd5;
font-weight: 500;
}
.addition-tag {
background: linear-gradient(135deg, #fef5e7 0%, #fdecd0 100%);
color: #d4a574;
border-color: #f9e5c8;
}
/* 价格和数量 */
.item-bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
.goods-price {
display: flex;
align-items: baseline;
}
.price-symbol {
font-size: 24rpx;
color: #d4a574;
font-weight: 600;
margin-right: 4rpx;
}
.price-num {
font-size: 36rpx;
font-weight: 700;
color: #d4a574;
font-family: 'DIN Alternate', 'Arial', sans-serif;
}
.goods-stepper {
transform: scale(0.95);
}
/* ==================== 底部占位 ==================== */
.bottom-placeholder {
height: 180rpx;
}
/* ==================== 底部结算栏 ==================== */
.submit-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
z-index: 999;
padding: env(safe-area-inset-bottom);
}
.bar-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 32rpx;
}
.total-info {
flex: 1;
}
.total-label {
font-size: 24rpx;
color: #999;
margin-bottom: 8rpx;
}
.total-price {
display: flex;
align-items: baseline;
margin-bottom: 4rpx;
}
.currency {
font-size: 28rpx;
color: #333;
font-weight: 600;
margin-right: 4rpx;
}
.amount {
font-size: 48rpx;
font-weight: 700;
color: #333;
font-family: 'DIN Alternate', 'Arial', sans-serif;
}
.total-tip {
font-size: 22rpx;
color: #999;
}
.submit-btn {
background: linear-gradient(135deg, #d4a574 0%, #c89860 100%);
color: #fff;
font-size: 32rpx;
font-weight: 600;
padding: 24rpx 60rpx;
border-radius: 50rpx;
display: flex;
align-items: center;
gap: 8rpx;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.3);
transition: all 0.3s;
}
.submit-btn:active {
transform: scale(0.96);
box-shadow: 0 4rpx 12rpx rgba(212, 165, 116, 0.3);
}
/* ==================== Vant组件自定义样式 ==================== */
.van-stepper {
--stepper-background-color: #f8f6f3;
--stepper-button-icon-color: #d4a574;
--stepper-button-disabled-color: #e8dfd5;
--stepper-button-disabled-icon-color: #ccc;
--stepper-input-text-color: #333;
--stepper-input-font-size: 28rpx;
}
================================================
FILE: pages/cart/order.js
================================================
const APP = getApp()
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
data: {
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.cart.ordered,
})
},
onShow: function () {
this.fetchOrder()
},
onPullDownRefresh() {
this.fetchOrder()
wx.stopPullDownRefresh()
},
async fetchOrder() {
wx.showLoading({
title: '',
})
const res = await WXAPI.orderList({
token: wx.getStorageSync('token'),
status: 0
})
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
this.setData({
orderInfo: res.data.orderList[0],
goodsList: res.data.goodsMap[res.data.orderList[0].id],
})
}
},
async goPayOrder() {
// token 需要使用买单这个用户的token,而不是当前餐桌的token
const code = await AUTH.wxaCode()
let res = await WXAPI.authorize({
code
})
if (res.code != 0) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
return
}
wx.setStorageSync('payToken', res.data.token) // 支付用户的token
this.setData({
paymentShow: true,
money: this.data.orderInfo.amountReal,
nextAction: {
// https://www.yuque.com/apifm/doc/aetmlb#8tiFW
type: 9,
orderId: this.data.orderInfo.id
}
})
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false,
paySuccess: true
})
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
})
================================================
FILE: pages/cart/order.json
================================================
{
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
================================================
FILE: pages/cart/order.wxml
================================================
{{$t.cart.ordered }}
{{$t.cart.Tobeconfirmed }}
{{$t.cart.Cooked }}
{{$t.cart.Served }}
{{ item.goodsName }}
{{ item.property }}
¥{{ item.amount }}
x{{ item.number }}
{{$t.cart.Numofdishes }}
{{ orderInfo.goodsNumber }} 份
{{$t.cart.Consumptionamount }}
¥{{ orderInfo.amount }}
{{$t.cart.Payableamount }}
¥{{ orderInfo.amountReal }}
{{ $t.PickingUp.total }}
¥{{ orderInfo.amountReal }}
{{ $t.cart.Check }}
{{ $t.asset.success }}
感谢您的光临
================================================
FILE: pages/cart/order.wxss
================================================
page {
background: linear-gradient(180deg, #FFF5EB 0%, #FFFFFF 40%);
min-height: 100vh;
padding-bottom: 0;
}
/* ========== 顶部桌号区域 ========== */
.header-section {
padding: 32rpx 32rpx 24rpx;
}
.table-card {
background: linear-gradient(135deg, #FFE4D1 0%, #FFD4B8 100%);
border-radius: 24rpx;
padding: 32rpx;
display: flex;
align-items: center;
box-shadow: 0 8rpx 32rpx rgba(255, 178, 130, 0.2);
}
.table-icon {
font-size: 56rpx;
margin-right: 24rpx;
}
.table-info {
flex: 1;
}
.table-label {
font-size: 24rpx;
color: #8B5A3C;
opacity: 0.8;
margin-bottom: 8rpx;
}
.table-number {
font-size: 40rpx;
font-weight: 600;
color: #5C3D2E;
letter-spacing: 2rpx;
}
/* ========== 标题装饰 ========== */
.section-title {
display: flex;
align-items: center;
padding: 40rpx 32rpx 24rpx;
gap: 16rpx;
}
.title-line {
flex: 1;
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #E6C4A8 50%, transparent 100%);
}
.title-text {
font-size: 28rpx;
color: #8B5A3C;
font-weight: 500;
padding: 0 16rpx;
letter-spacing: 2rpx;
}
/* ========== 菜品列表 ========== */
.goods-container {
padding: 0 32rpx;
margin-bottom: 24rpx;
}
.goods-item {
background: #FFFFFF;
border-radius: 24rpx;
padding: 24rpx;
margin-bottom: 24rpx;
display: flex;
box-shadow: 0 4rpx 24rpx rgba(139, 90, 60, 0.06);
transition: all 0.3s ease;
}
.goods-item:active {
transform: scale(0.98);
box-shadow: 0 2rpx 16rpx rgba(139, 90, 60, 0.08);
}
.goods-image-wrap {
position: relative;
margin-right: 24rpx;
flex-shrink: 0;
}
.goods-image {
width: 160rpx;
height: 160rpx;
border-radius: 16rpx;
background: #F5F5F5;
}
.status-badge {
position: absolute;
top: -8rpx;
right: -8rpx;
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 20rpx;
font-weight: 500;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}
.status-0 {
background: linear-gradient(135deg, #FFF4E6 0%, #FFE7BA 100%);
color: #D97706;
}
.status-1 {
background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
color: #2E7D32;
}
.status-2 {
background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
color: #1976D2;
}
.goods-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
min-width: 0;
}
.goods-name {
font-size: 32rpx;
font-weight: 600;
color: #333333;
line-height: 1.4;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.goods-property {
font-size: 24rpx;
color: #999999;
line-height: 1.5;
margin-bottom: 12rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.goods-bottom {
display: flex;
align-items: flex-end;
justify-content: space-between;
}
.goods-price {
font-size: 36rpx;
font-weight: 700;
color: #D97706;
font-family: -apple-system, 'DIN Alternate', 'Helvetica Neue', sans-serif;
}
.goods-quantity {
font-size: 28rpx;
color: #666666;
padding: 4rpx 16rpx;
background: #F5F5F5;
border-radius: 12rpx;
}
/* ========== 价格统计区域 ========== */
.price-summary {
margin: 24rpx 32rpx 24rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F5 100%);
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 24rpx rgba(139, 90, 60, 0.06);
}
.summary-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
}
.summary-label {
font-size: 28rpx;
color: #666666;
}
.summary-value {
font-size: 28rpx;
color: #333333;
font-weight: 500;
}
.summary-divider {
height: 1rpx;
background: linear-gradient(90deg, transparent 0%, #E6C4A8 20%, #E6C4A8 80%, transparent 100%);
margin: 16rpx 0;
}
.summary-total {
padding: 24rpx 0 8rpx;
}
.summary-total .summary-label {
font-size: 32rpx;
color: #333333;
font-weight: 600;
}
.summary-value-total {
font-size: 44rpx;
font-weight: 700;
color: #D97706;
font-family: -apple-system, 'DIN Alternate', 'Helvetica Neue', sans-serif;
}
/* ========== 底部安全区域 ========== */
.bottom-safe {
height: 180rpx;
}
/* ========== 底部结账栏 ========== */
.checkout-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #FFFFFF;
padding: 20rpx 32rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 -4rpx 24rpx rgba(0, 0, 0, 0.06);
z-index: 100;
}
.checkout-total {
flex: 1;
}
.checkout-label {
font-size: 24rpx;
color: #999999;
margin-bottom: 4rpx;
}
.checkout-price {
font-size: 40rpx;
font-weight: 700;
color: #D97706;
font-family: -apple-system, 'DIN Alternate', 'Helvetica Neue', sans-serif;
}
.checkout-button {
background: linear-gradient(135deg, #FF9A62 0%, #FF7A45 100%);
color: #FFFFFF;
padding: 28rpx 64rpx;
border-radius: 56rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 8rpx 24rpx rgba(255, 122, 69, 0.3);
transition: all 0.3s ease;
}
.checkout-button:active {
transform: scale(0.96);
box-shadow: 0 4rpx 16rpx rgba(255, 122, 69, 0.4);
}
/* ========== 支付成功页面 ========== */
.pay-success-page {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
background: linear-gradient(180deg, #FFF5EB 0%, #FFFFFF 100%);
padding: 64rpx 32rpx;
}
.success-animation {
margin-bottom: 48rpx;
animation: scaleIn 0.5s ease-out;
}
@keyframes scaleIn {
0% {
transform: scale(0);
opacity: 0;
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
opacity: 1;
}
}
.success-circle {
width: 200rpx;
height: 200rpx;
border-radius: 50%;
background: linear-gradient(135deg, #52C41A 0%, #73D13D 100%);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 16rpx 48rpx rgba(82, 196, 26, 0.3);
}
.success-title {
font-size: 48rpx;
font-weight: 700;
color: #333333;
margin-bottom: 16rpx;
animation: fadeInUp 0.6s ease-out 0.2s both;
}
.success-subtitle {
font-size: 28rpx;
color: #999999;
animation: fadeInUp 0.6s ease-out 0.4s both;
}
@keyframes fadeInUp {
0% {
transform: translateY(30rpx);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
================================================
FILE: pages/coupons/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
var sliderWidth = 96; // 需要设置slider的宽度,用于计算中间位置
Page({
/**
* 页面的初始数据
*/
data: {
tabs: {
zh_CN: ['可领', '已领', '失效', '口令'],
en: ['Can Fetch', 'Available', 'Invalid', 'Exchange'],
},
activeIndex: 0,
showPwdPop: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.coupons.title,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.data.activeIndex == 0) {
this.sysCoupons()
}
AUTH.checkHasLogined().then(isLogined => {
this.setData({
isLogined
})
if (isLogined) {
if (this.data.activeIndex == 1) {
this.getMyCoupons()
}
if (this.data.activeIndex == 2) {
this.invalidCoupons()
}
}
})
},
onReachBottom: function () {
},
tabClick: function (e) {
this.setData({
activeIndex: e.detail.index
});
if (this.data.activeIndex == 0) {
this.sysCoupons()
}
if (this.data.activeIndex == 1) {
this.getMyCoupons()
}
if (this.data.activeIndex == 2) {
this.invalidCoupons()
}
},
sysCoupons() { // 读取可领取券列表
var _this = this;
wx.showLoading({
title: '',
})
WXAPI.coupons().then(function (res) {
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
_this.setData({
coupons: res.data
});
} else {
_this.setData({
coupons: null
});
}
})
},
getCounpon2(){
if (!this.data.couponPwd) {
wx.showToast({
title: this.data.$t.coupons.inputpassword,
icon: 'none'
})
return
}
const e = {
kl: true,
currentTarget: {
dataset: {
id: this.data.pwdCounponId
}
}
}
this.getCounpon(e)
},
getCounpon: function (e) {
const that = this
if (e.currentTarget.dataset.pwd) {
this.setData({
pwdCounponId: e.currentTarget.dataset.id,
showPwdPop: true
})
return
} else {
if (!e.kl) {
this.data.couponPwd = ''
}
}
this.setData({
showPwdPop: false
})
WXAPI.fetchCoupons({
id: e.currentTarget.dataset.id,
token: wx.getStorageSync('token'),
pwd: this.data.couponPwd
}).then(function (res) {
if (res.code == 20001 || res.code == 20002) {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: that.data.$t.coupons.Cominglate,
showCancel: false
})
return;
}
if (res.code == 20003) {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: that.data.$t.coupons.receivedgreedy,
showCancel: false
})
return;
}
if (res.code == 30001) {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: that.data.$t.coupons.pointsinsufficient,
showCancel: false
})
return;
}
if (res.code == 20004) {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: that.data.$t.coupons.Expired,
showCancel: false
})
return;
}
if (res.code == 0) {
wx.showToast({
title: that.data.$t.coupons.Successfullyclaimed,
icon: 'success'
})
} else {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
}
})
},
getMyCoupons: function () {
var _this = this;
wx.showLoading({
title: '',
})
WXAPI.myCoupons({
token: wx.getStorageSync('token'),
status: 0
}).then(function (res) {
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
res.data.forEach(ele => {
if (ele.dateEnd) {
ele.dateEnd = ele.dateEnd.split(" ")[0]
}
})
_this.setData({
coupons: res.data
})
} else {
_this.setData({
coupons: null
})
}
})
},
invalidCoupons: function () {
var _this = this;
wx.showLoading({
title: '',
})
WXAPI.myCoupons({
token: wx.getStorageSync('token'),
status: '1,2,3'
}).then(function (res) {
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
_this.setData({
coupons: res.data
})
} else {
_this.setData({
coupons: null
})
}
})
},
async touse(e) {
const item = e.currentTarget.dataset.item
const res = await WXAPI.couponDetail(item.pid)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
if (!res.data.couponRefs || res.data.couponRefs.length == 0) {
wx.switchTab({
url: "/pages/index/index"
})
return
}
let categoryId, goodsId
res.data.couponRefs.forEach(ele => {
if (ele.type == 0) {
categoryId = ele.refId
}
if (ele.type == 1) {
goodsId = ele.refId
}
})
if (categoryId) {
wx.navigateTo({
url: '/pages/goods/list?categoryId=' + categoryId,
})
return
}
if (goodsId) {
wx.navigateTo({
url: '/pages/goods-details/index?id=' + goodsId,
})
return
}
},
pwdCouponChange(e){
this.setData({
couponPwd: e.detail.value
})
},
onPullDownRefresh() {
if (this.data.activeIndex == 0) {
this.sysCoupons()
}
if (this.data.activeIndex == 1) {
this.getMyCoupons()
}
if (this.data.activeIndex == 2) {
this.invalidCoupons()
}
wx.stopPullDownRefresh()
},
closePwd() {
this.setData({
showPwdPop: false
})
},
async exchangeCoupons() {
if (!this.data.number) {
wx.showToast({
title: this.data.$t.coupons.enternum,
icon: 'none'
})
return
}
if (!this.data.pwd) {
wx.showToast({
title: this.data.$t.coupons.password,
icon: 'none'
})
return
}
this.setData({
exchangeCouponsLoading: true
})
wx.showLoading({
title: '',
})
const res = await WXAPI.exchangeCoupons(wx.getStorageSync('token'), this.data.number, this.data.pwd)
wx.hideLoading({
success: (res) => {},
})
this.setData({
exchangeCouponsLoading: false
})
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
} else {
wx.showToast({
title: this.data.$t.coupons.Redemption,
})
}
},
onShareAppMessage: function() {
return {
title: wx.getStorageSync('mallName') + this.data.$t.coupons.Invitingcoupons,
path: '/pages/coupons/index?inviter_id=' + wx.getStorageSync('uid')
}
},
onShareTimeline() {
return {
title: wx.getStorageSync('mallName') + this.data.$t.coupons.Invitingcoupons,
query: 'inviter_id=' + wx.getStorageSync('uid'),
imageUrl: wx.getStorageSync('share_pic')
}
},
})
================================================
FILE: pages/coupons/index.json
================================================
{
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
================================================
FILE: pages/coupons/index.wxml
================================================
{{ $t.common.empty }}
¥
{{item.moneyMin}}
{{item.moneyMin}}
折
满{{item.moneyHreshold}}可用
{{ $t.coupons.Vouchers }}
{{item.name}}
{{ $t.coupons.over }} {{item.moneyHreshold}} 元可用
{{ $t.coupons.btn }}
¥
{{item.money}}
{{item.money}}
折
满{{item.moneyHreshold}}可用
{{ $t.coupons.Vouchers }}
{{item.name}}
有效期至 {{item.dateEnd}}
{{ $t.coupons.toUse }}
¥
{{item.money}}
{{item.money}}
折
满{{item.moneyHreshold}}可用
{{ $t.coupons.Vouchers }}
{{item.name}}
{{ item.statusStr }}
{{ item.statusStr }}
兑换优惠券
输入口令码,领取专属优惠
{{ $t.coupons.change }}
兑换中...
================================================
FILE: pages/coupons/index.wxss
================================================
/* 页面基础样式 */
page {
background: linear-gradient(180deg, #FFF8F0 0%, #F5F5F5 100%);
min-height: 100vh;
}
.page-container {
min-height: 100vh;
padding-bottom: 32rpx;
}
/* 顶部标签栏样式 */
.tabs-wrapper {
background: #FFFFFF;
box-shadow: 0 4rpx 12rpx rgba(139, 111, 71, 0.08);
}
/* 优惠券列表容器 */
.coupons-container {
padding: 24rpx 32rpx;
}
/* 空状态样式 */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 120rpx 0;
}
.empty-icon {
width: 240rpx;
opacity: 0.6;
margin-bottom: 32rpx;
}
.empty-text {
font-size: 28rpx;
color: #999999;
}
/* 优惠券卡片样式 */
.coupon-card {
margin-bottom: 32rpx;
position: relative;
}
.coupon-card-inner {
display: flex;
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(139, 111, 71, 0.12);
position: relative;
}
/* 左侧金额区域 */
.coupon-left {
width: 240rpx;
background: linear-gradient(135deg, #D4A574 0%, #B8935F 100%);
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 40rpx 0;
}
.active-left {
background: linear-gradient(135deg, #F4A460 0%, #D2691E 100%);
}
.disabled-left {
background: linear-gradient(135deg, #CCCCCC 0%, #999999 100%);
}
.coupon-amount-wrapper {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 2;
}
.coupon-amount {
display: flex;
align-items: baseline;
margin-bottom: 12rpx;
}
.coupon-amount .currency {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
margin-right: 4rpx;
}
.coupon-amount .amount-num {
font-size: 72rpx;
font-weight: bold;
color: #FFFFFF;
line-height: 1;
font-family: DIN, Helvetica, Arial, sans-serif;
}
.coupon-amount .percent {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
margin-left: 4rpx;
}
.coupon-condition {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.9);
text-align: center;
padding: 8rpx 16rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
}
/* 圆形镂空效果 */
.circle-top,
.circle-bottom {
position: absolute;
right: -12rpx;
width: 24rpx;
height: 24rpx;
background: linear-gradient(180deg, #FFF8F0 0%, #F5F5F5 100%);
border-radius: 50%;
z-index: 1;
}
.circle-top {
top: -12rpx;
}
.circle-bottom {
bottom: -12rpx;
}
/* 虚线分割 */
.coupon-left::after {
content: '';
position: absolute;
right: 0;
top: 24rpx;
bottom: 24rpx;
width: 2rpx;
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 50%, transparent 50%);
background-size: 2rpx 12rpx;
}
/* 右侧信息区域 */
.coupon-right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 36rpx 32rpx;
position: relative;
}
.coupon-info {
flex: 1;
}
.coupon-badge {
display: inline-block;
background: linear-gradient(135deg, #F4A460 0%, #D2691E 100%);
color: #FFFFFF;
font-size: 20rpx;
padding: 6rpx 16rpx;
border-radius: 20rpx;
font-weight: 500;
margin-bottom: 16rpx;
letter-spacing: 1rpx;
}
.active-badge {
background: linear-gradient(135deg, #FF8C42 0%, #FF6B35 100%);
}
.disabled-badge {
background: #CCCCCC;
}
.coupon-name {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-bottom: 12rpx;
line-height: 1.4;
}
.coupon-desc {
font-size: 24rpx;
color: #999999;
line-height: 1.5;
}
.disabled-text {
color: #CCCCCC !important;
}
.disabled-amount {
opacity: 0.6;
}
/* 按钮样式 */
.coupon-action {
display: flex;
justify-content: flex-end;
margin-top: 20rpx;
}
.action-btn {
padding: 16rpx 40rpx;
background: linear-gradient(135deg, #D4A574 0%, #B8935F 100%);
color: #FFFFFF;
font-size: 26rpx;
font-weight: 500;
border-radius: 40rpx;
text-align: center;
box-shadow: 0 4rpx 12rpx rgba(180, 147, 95, 0.3);
transition: all 0.3s ease;
}
.active-btn {
background: linear-gradient(135deg, #FF8C42 0%, #FF6B35 100%);
box-shadow: 0 4rpx 12rpx rgba(255, 107, 53, 0.3);
}
.disabled-btn {
background: #EEEEEE;
color: #CCCCCC;
box-shadow: none;
}
/* 已领取卡片特殊样式 */
.active-card .coupon-card-inner {
background: linear-gradient(135deg, #FFFBF7 0%, #FFF5E8 100%);
border: 2rpx solid rgba(255, 140, 66, 0.2);
}
/* 失效卡片特殊样式 */
.disabled-card .coupon-card-inner {
background: #F5F5F5;
opacity: 0.7;
}
/* 口令兑换区域 */
.exchange-container {
padding: 24rpx 0;
}
.exchange-card {
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
border-radius: 24rpx;
padding: 48rpx 40rpx;
box-shadow: 0 8rpx 32rpx rgba(139, 111, 71, 0.15);
}
.exchange-title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
text-align: center;
margin-bottom: 12rpx;
}
.exchange-subtitle {
font-size: 26rpx;
color: #999999;
text-align: center;
margin-bottom: 48rpx;
}
.exchange-form {
margin-bottom: 48rpx;
}
.exchange-btn-wrapper {
display: flex;
justify-content: center;
}
.exchange-btn {
width: 100%;
padding: 28rpx 0;
background: linear-gradient(135deg, #F4A460 0%, #D2691E 100%);
color: #FFFFFF;
font-size: 32rpx;
font-weight: 600;
text-align: center;
border-radius: 48rpx;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.4);
transition: all 0.3s ease;
}
/* 密码弹窗样式 */
.pwd-mask {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.pwd-dialog {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 600rpx;
background: #FFFFFF;
border-radius: 24rpx;
z-index: 1000;
overflow: hidden;
animation: slideUp 0.3s ease;
}
@keyframes slideUp {
from {
transform: translate(-50%, -40%);
opacity: 0;
}
to {
transform: translate(-50%, -50%);
opacity: 1;
}
}
.pwd-dialog-header {
position: relative;
padding: 48rpx 32rpx 24rpx;
border-bottom: 1rpx solid #F0F0F0;
}
.pwd-dialog-title {
font-size: 34rpx;
font-weight: 600;
color: #333333;
text-align: center;
}
.pwd-dialog-close {
position: absolute;
top: 32rpx;
right: 32rpx;
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
color: #999999;
}
.pwd-dialog-body {
padding: 48rpx 40rpx;
}
.pwd-input {
width: 100%;
padding: 28rpx 32rpx;
background: #F7F8FA;
border-radius: 16rpx;
font-size: 30rpx;
color: #333333;
border: 2rpx solid transparent;
transition: all 0.3s ease;
}
.pwd-input:focus {
background: #FFFFFF;
border-color: #D4A574;
}
.pwd-dialog-footer {
display: flex;
border-top: 1rpx solid #F0F0F0;
}
.pwd-cancel-btn,
.pwd-confirm-btn {
flex: 1;
padding: 32rpx 0;
text-align: center;
font-size: 32rpx;
transition: all 0.3s ease;
}
.pwd-cancel-btn {
color: #999999;
border-right: 1rpx solid #F0F0F0;
}
.pwd-confirm-btn {
color: #D4A574;
font-weight: 600;
}
.pwd-cancel-btn:active {
background: #F7F8FA;
}
.pwd-confirm-btn:active {
background: #FFF8F0;
}
/* 底部安全区 */
.bottom-safe {
height: 32rpx;
}
/* 优化动画效果 */
.coupon-card {
animation: cardSlideIn 0.4s ease;
animation-fill-mode: both;
}
.coupon-card:nth-child(1) {
animation-delay: 0.05s;
}
.coupon-card:nth-child(2) {
animation-delay: 0.1s;
}
.coupon-card:nth-child(3) {
animation-delay: 0.15s;
}
@keyframes cardSlideIn {
from {
opacity: 0;
transform: translateY(30rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
================================================
FILE: pages/goods/list.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
Page({
/**
* 页面的初始数据
*/
data: {
listType: 2, // 1为1个商品一行,2为2个商品一行
name: '', // 搜索关键词
orderBy: '', // 排序规则
page: 1 // 读取第几页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.goodsList.t,
})
this.setData({
name: options.name,
categoryId: options.categoryId
})
this.search()
this.readConfigVal()
// 补偿写法
getApp().configLoadOK = () => {
this.readConfigVal()
}
},
onShow: function () {
},
readConfigVal() {
const show_seller_number = wx.getStorageSync('show_seller_number')
const goods_search_show_type = wx.getStorageSync('goods_search_show_type')
let listType = 2
if (goods_search_show_type == 2) {
listType = 2
}
this.setData({
show_seller_number,
listType
})
},
async search(){
wx.showLoading({
title: '',
})
const _data = {
orderBy: this.data.orderBy,
page: this.data.page,
pageSize: 20,
}
if (this.data.name) {
_data.k = this.data.name
}
if (this.data.categoryId) {
_data.categoryId = this.data.categoryId
}
const res = await WXAPI.goodsv2(_data)
wx.hideLoading()
if (res.code == 0) {
if (this.data.page == 1) {
this.setData({
goods: res.data.result,
})
} else {
this.setData({
goods: this.data.goods.concat(res.data.result),
})
}
} else {
if (this.data.page == 1) {
this.setData({
goods: null,
})
}
}
},
onReachBottom() {
this.setData({
page: this.data.page + 1
});
this.search()
},
changeShowType(){
if (this.data.listType == 1) {
this.setData({
listType: 2
})
} else {
this.setData({
listType: 1
})
}
},
bindinput(e){
this.setData({
name: e.detail.value
})
},
bindconfirm(e){
this.setData({
page: 1,
name: e.detail.value
})
this.search()
},
filter(e){
this.setData({
page: 1,
orderBy: e.currentTarget.dataset.val
})
this.search()
},
async addShopCar(e) {
const curGood = this.data.goods.find(ele => {
return ele.id == e.currentTarget.dataset.id
})
if (!curGood) {
return
}
if (curGood.stores <= 0) {
wx.showToast({
title: this.data.$t.goodsDetail.noStores,
icon: 'none'
})
return
}
this.addShopCarCheck({
goodsId: curGood.id,
buyNumber: 1,
sku: []
})
},
async addShopCarCheck(options) {
AUTH.checkHasLogined().then(isLogined => {
this.setData({
wxlogin: isLogined
})
if (isLogined) {
// 处理加入购物车的业务逻辑
this.addShopCarDone(options)
}
})
},
async addShopCarDone(options) {
const res = await WXAPI.shippingCarInfoAddItem(wx.getStorageSync('token'), options.goodsId, options.buyNumber, options.sku)
if (res.code == 30002) {
// 需要选择规格尺寸
const skuCurGoodsRes = await WXAPI.goodsDetail(options.goodsId)
if (skuCurGoodsRes.code != 0) {
wx.showToast({
title: skuCurGoodsRes.msg,
icon: 'none'
})
return
}
const skuCurGoods = skuCurGoodsRes.data
skuCurGoods.basicInfo.storesBuy = 1
this.setData({
skuCurGoods
})
return
}
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.showToast({
title: this.data.$t.goodsDetail.addCartSuccess,
icon: 'success'
})
this.setData({
skuCurGoods: null
})
},
storesJia() {
const skuCurGoods = this.data.skuCurGoods
if (skuCurGoods.basicInfo.storesBuy < skuCurGoods.basicInfo.stores) {
skuCurGoods.basicInfo.storesBuy++
this.setData({
skuCurGoods
})
}
},
storesJian() {
const skuCurGoods = this.data.skuCurGoods
if (skuCurGoods.basicInfo.storesBuy > 1) {
skuCurGoods.basicInfo.storesBuy--
this.setData({
skuCurGoods
})
}
},
closeSku() {
this.setData({
skuCurGoods: null
})
wx.showTabBar()
},
skuSelect(e) {
const pid = e.currentTarget.dataset.pid
const id = e.currentTarget.dataset.id
// 处理选中
const skuCurGoods = this.data.skuCurGoods
const property = skuCurGoods.properties.find(ele => { return ele.id == pid })
property.childsCurGoods.forEach(ele => {
if (ele.id == id) {
ele.active = true
} else {
ele.active = false
}
})
this.setData({
skuCurGoods
})
},
addCarSku() {
const skuCurGoods = this.data.skuCurGoods
const propertySize = skuCurGoods.properties.length // 有几组SKU
const sku = []
skuCurGoods.properties.forEach(p => {
const o = p.childsCurGoods.find(ele => { return ele.active })
if (!o) {
return
}
sku.push({
optionId: o.propertyId,
optionValueId: o.id
})
})
if (sku.length != propertySize) {
wx.showToast({
title: this.data.$t.goodsDetail.noSelectSku,
icon: 'none'
})
return
}
const options = {
goodsId: skuCurGoods.basicInfo.id,
buyNumber: skuCurGoods.basicInfo.storesBuy,
sku
}
this.addShopCarDone(options)
},
})
================================================
FILE: pages/goods/list.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/goods/list.wxml
================================================
{{ $t.goodsList.sort.zh }}
{{ $t.goodsList.sort.xp }}
{{ $t.goodsList.sort.xl }}
{{ $t.goodsList.sort.jg }}
module.exports = {
url : function(item) {
if (item.supplyType == 'cps_jd') {
return '/packageCps/pages/goods-details/cps-jd?id=' + item.id
} else if (item.supplyType == 'vop_jd') {
return '/pages/goods-details/vop?id=' + item.yyId + '&goodsId=' + item.id
} else if (item.supplyType == 'cps_pdd') {
return '/packageCps/pages/goods-details/cps-pdd?id=' + item.id
} else if (item.supplyType == 'cps_taobao') {
return '/packageCps/pages/goods-details/cps-taobao?id=' + item.id
} else {
return '/pages/goods-details/index?id=' + item.id
}
}
}
{{item.name}}
{{item.characteristic}}
¥{{item.minPrice}}
¥{{item.originalPrice}}
已售 {{item.numberSells}}
{{item.name}}
{{item.characteristic}}
¥{{item.minPrice}}
¥{{item.originalPrice}}
已售 {{item.numberSells}}
{{item.name}}
{{small.name}}
{{ $t.goodsDetail.buyNumber }}
-
{{skuCurGoods.basicInfo.storesBuy}}
+
{{ $t.goodsDetail.addCartBtn }}
================================================
FILE: pages/goods/list.wxss
================================================
page {
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8D6 100%);
min-height: 100vh;
}
page,view,image,input {
display: block;
box-sizing: border-box;
}
.header {
padding: 24rpx 32rpx 20rpx;
background: linear-gradient(135deg, #FFD4A3 0%, #FFC78E 100%);
display: flex;
align-items: center;
box-shadow: 0 4rpx 20rpx rgba(255, 180, 100, 0.15);
}
.header .search {
position: relative;
width: 650rpx;
height: 72rpx;
}
.header .search input {
border: none;
width: 100%;
height: 100%;
border-radius: 36rpx;
padding-left: 48rpx;
padding-right: 72rpx;
background: rgba(255, 255, 255, 0.95);
font-size: 28rpx;
color: #6B4E3D;
box-shadow: 0 2rpx 12rpx rgba(255, 180, 100, 0.1);
}
.header .search input::placeholder {
color: #C4A57B;
}
.header .search image {
width: 38rpx;
height: 38rpx;
position: absolute;
top: 17rpx;
right: 24rpx;
z-index: 9999;
opacity: 0.7;
}
.header .show-type {
width: 44rpx;
height: 44rpx;
margin-left: 20rpx;
opacity: 0.8;
}
.line {
width: 100vw;
height: 2rpx;
background: #dfdfdf;
}
.filters {
width: 100vw;
height: 96rpx;
background: linear-gradient(135deg, #FFECD6 0%, #FFE5C8 100%);
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 16rpx;
box-shadow: 0 2rpx 16rpx rgba(255, 180, 100, 0.08);
}
.filters .item {
height: 60rpx;
line-height: 60rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #8B6F47;
border-radius: 30rpx;
transition: all 0.3s ease;
position: relative;
}
.filters .active {
color: #fff;
background: linear-gradient(135deg, #D4A574 0%, #C89A6A 100%);
font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(200, 154, 106, 0.3);
transform: scale(1.05);
}
.list1 {
margin: 20rpx 16rpx;
width: 718rpx;
display: flex;
background: #fff;
border-radius: 24rpx;
position: relative;
overflow: hidden;
box-shadow: 0 6rpx 24rpx rgba(139, 111, 71, 0.08);
transition: all 0.3s ease;
}
.list1:active {
transform: scale(0.98);
box-shadow: 0 4rpx 16rpx rgba(139, 111, 71, 0.12);
}
.list1 .img {
width: 240rpx;
height: 240rpx;
flex-shrink: 0;
border-radius: 20rpx 0 0 20rpx;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8D6 50%);
}
.list1 .goods-info {
padding: 20rpx 32rpx 16rpx 24rpx;
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.list1 .goods-info .title {
color: #3D2817;
font-size: 30rpx;
font-weight: 500;
line-height: 1.4;
margin-bottom: 8rpx;
}
.ellipsis {
display: -webkit-box;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
word-break: break-all;
}
.list1 .goods-info .characteristic {
font-size: 24rpx;
color: #A08B6F;
margin: 6rpx 0;
}
.list1 .goods-info .price {
color: #D4A574;
font-size: 38rpx;
font-weight: 700;
margin-top: auto;
padding-top: 12rpx;
}
.list1 .goods-info .price .price-symbol {
font-size: 28rpx;
font-weight: 600;
margin-right: 2rpx;
}
.list1 .goods-info .buy-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 8rpx;
}
.list1 .goods-info .buy-info .num {
font-size: 24rpx;
color: #C4A57B;
font-weight: 400;
}
.list1 .goods-info .buy-info .car {
position: absolute;
right: 20rpx;
bottom: 20rpx;
width: 60rpx;
height: 60rpx;
background: linear-gradient(135deg, #D4A574 0%, #C89A6A 100%);
border-radius: 50%;
padding: 14rpx;
box-shadow: 0 6rpx 16rpx rgba(200, 154, 106, 0.35);
transition: all 0.2s ease;
}
.list1 .goods-info .buy-info .car:active {
transform: scale(0.9);
}
.list2-box {
margin: 0 16rpx;
width: 718rpx;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.list2 {
margin: 20rpx 0;
width: 345rpx;
background: #fff;
border-radius: 24rpx;
overflow: hidden;
position: relative;
box-shadow: 0 8rpx 28rpx rgba(139, 111, 71, 0.1);
transition: all 0.3s ease;
}
.list2:active {
transform: translateY(-4rpx);
box-shadow: 0 12rpx 32rpx rgba(139, 111, 71, 0.15);
}
.list2 .img {
width: 345rpx;
height: 345rpx;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8D6 50%);
}
.list2 .goods-info {
padding: 20rpx 20rpx 80rpx 20rpx;
position: relative;
}
.list2 .goods-info .title {
color: #3D2817;
font-size: 28rpx;
font-weight: 500;
line-height: 1.4;
min-height: 78rpx;
}
.list2 .goods-info .characteristic {
font-size: 24rpx;
color: #A08B6F;
margin-top: 8rpx;
}
.list2 .goods-info .price {
color: #D4A574;
font-size: 36rpx;
font-weight: 700;
margin-top: 12rpx;
}
.list2 .goods-info .price .price-symbol {
font-size: 26rpx;
font-weight: 600;
margin-right: 2rpx;
}
.list2 .goods-info .buy-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 8rpx;
}
.list2 .goods-info .buy-info .num {
font-size: 22rpx;
color: #C4A57B;
font-weight: 400;
}
.list2 .goods-info .buy-info .car {
width: 64rpx;
height: 64rpx;
position: absolute;
right: 20rpx;
bottom: 20rpx;
background: linear-gradient(135deg, #D4A574 0%, #C89A6A 100%);
border-radius: 50%;
padding: 16rpx;
box-shadow: 0 8rpx 20rpx rgba(200, 154, 106, 0.4);
transition: all 0.2s ease;
}
.list2 .goods-info .buy-info .car:active {
transform: scale(0.9);
}
.sku-mask {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background: rgba(61, 40, 23, 0.5);
backdrop-filter: blur(4rpx);
}
.sku-container {
position: fixed;
width: 100vw;
bottom: 100rpx;
left: 0;
background: linear-gradient(180deg, #FFF9F0 0%, #FFFFFF 100%);
padding: 40rpx 32rpx 24rpx 32rpx;
border-radius: 32rpx 32rpx 0 0;
box-shadow: 0 -8rpx 32rpx rgba(139, 111, 71, 0.15);
}
.sku-container .close {
position: absolute;
width: 56rpx;
height: 56rpx;
top: 20rpx;
right: 20rpx;
background: rgba(139, 111, 71, 0.08);
border-radius: 50%;
padding: 12rpx;
opacity: 0.8;
}
.sku-container .sku {
border-bottom: 1rpx solid rgba(212, 165, 116, 0.2);
padding-bottom: 24rpx;
margin-bottom: 20rpx;
}
.sku-container .sku .t {
color: #3D2817;
font-size: 30rpx;
font-weight: 600;
margin-bottom: 16rpx;
}
.sku-container .sku .items {
display: flex;
flex-wrap: wrap;
}
.sku-container .sku .items text {
padding: 12rpx 24rpx;
border: 2rpx solid #E5D4C1;
color: #8B6F47;
margin: 16rpx 16rpx 0 0;
font-size: 26rpx;
border-radius: 16rpx;
background: #FFFBF5;
transition: all 0.2s ease;
}
.sku-container .sku .items text.active {
border: 2rpx solid #D4A574;
color: #fff;
background: linear-gradient(135deg, #D4A574 0%, #C89A6A 100%);
font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(200, 154, 106, 0.3);
}
.sku-container .num {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
}
.sku-container .num .t {
color: #3D2817;
font-size: 30rpx;
font-weight: 600;
}
.sku-container .num .num-box {
display: flex;
align-items: center;
background: #FFFBF5;
border-radius: 16rpx;
overflow: hidden;
border: 2rpx solid #E5D4C1;
}
.sku-container .num .num-box .a {
width: 72rpx;
height: 64rpx;
text-align: center;
line-height: 64rpx;
font-size: 40rpx;
color: #8B6F47;
background: transparent;
transition: all 0.2s ease;
}
.sku-container .num .num-box .a:active {
background: rgba(212, 165, 116, 0.15);
}
.sku-container .num .num-box .b {
color: #3D2817;
line-height: 64rpx;
padding: 0 32rpx;
font-size: 32rpx;
font-weight: 600;
min-width: 80rpx;
text-align: center;
}
.sku-btn {
width: 100vw;
height: 100rpx;
line-height: 100rpx;
background: linear-gradient(135deg, #D4A574 0%, #C89A6A 100%);
color: #fff;
position: fixed;
bottom: 0;
left: 0;
text-align: center;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 -4rpx 24rpx rgba(200, 154, 106, 0.25);
transition: all 0.2s ease;
}
.sku-btn:active {
background: linear-gradient(135deg, #C89A6A 0%, #B88A5F 100%);
}
.originalPrice {
color: #C4A57B;
text-decoration: line-through;
margin-left: 16rpx;
font-size: 24rpx;
font-weight: 400;
}
/* 空状态样式优化 */
.van-empty {
padding: 120rpx 0;
background: transparent;
}
/* 页面整体优化 */
page::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 300rpx;
background: linear-gradient(180deg, rgba(255, 212, 163, 0.3) 0%, transparent 100%);
pointer-events: none;
z-index: 0;
}
/* 商品卡片进入动画 */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(40rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.list1, .list2 {
animation: fadeInUp 0.4s ease-out;
}
/* 优化导航链接样式 */
navigator {
display: block;
}
/* 特殊标签样式(如新品、热销等) */
.goods-tag {
position: absolute;
top: 16rpx;
left: 16rpx;
background: linear-gradient(135deg, #FF9A76 0%, #FF6B9D 100%);
color: #fff;
padding: 6rpx 16rpx;
border-radius: 20rpx;
font-size: 22rpx;
font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 157, 0.3);
z-index: 10;
}
/* 优化滚动性能 */
.list1, .list2 {
will-change: transform;
transform: translateZ(0);
}
/* 搜索框聚焦效果 */
.header .search input:focus {
box-shadow: 0 4rpx 16rpx rgba(255, 180, 100, 0.2);
transform: scale(1.01);
transition: all 0.2s ease;
}
================================================
FILE: pages/goods-details/index.js
================================================
const WXAPI = require('apifm-wxapi')
const TOOLS = require('../../utils/tools.js')
const AUTH = require('../../utils/auth')
import Poster from 'wxa-plugin-canvas/poster/poster'
Page({
data: {
goodsDetail: {},
hasMoreSelect: false,
selectSizePrice: 0,
selectSizeOPrice: 0,
totalScoreToPay: 0,
shopNum: 0,
hideShopPopup: true,
buyNumber: 0,
buyNumMin: 1,
buyNumMax: 0,
propertyChildIds: "",
propertyChildNames: "",
canSubmit: false, // 选中规格尺寸时候是否允许加入购物车
},
onLoad(e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.goodsDetail.title,
})
// e.id = 122843
// 读取分享链接中的邀请人编号
if (e && e.inviter_id) {
wx.setStorageSync('referrer', e.inviter_id)
}
// 读取小程序码中的邀请人编号
if (e && e.scene) {
const scene = decodeURIComponent(e.scene) // 处理扫码进商品详情页面的逻辑
if (scene && scene.split(',').length >= 2) {
e.id = scene.split(',')[0]
wx.setStorageSync('referrer', scene.split(',')[1])
}
}
this.data.goodsId = e.id
this.data.kjJoinUid = e.kjJoinUid
let goodsDetailSkuShowType = wx.getStorageSync('goodsDetailSkuShowType')
if (!goodsDetailSkuShowType) {
goodsDetailSkuShowType = 0
}
// 补偿写法
getApp().configLoadOK = () => {
this.readConfigVal()
}
this.setData({
goodsDetailSkuShowType,
curuid: wx.getStorageSync('uid')
})
this.readConfigVal()
this.getGoodsDetailAndKanjieInfo(this.data.goodsId)
this.shippingCartInfo()
this.goodsAddition()
},
readConfigVal() {
},
async _goodsTimesSchedule() {
const res = await WXAPI.goodsTimesSchedule(this.data.goodsId, '') // todo sku
if (res.code == 0) {
const goodsTimesSchedule = res.data
res.data.forEach(ele => {
ele.active = false
})
goodsTimesSchedule[0].active = true
goodsTimesSchedule[0].items[0].active = true
this.setData({
goodsTimesSchedule
})
this.calculateGoodsPrice()
} else {
this.setData({
goodsTimesSchedule: null
})
}
},
async goodsAddition() {
const res = await WXAPI.goodsAddition(this.data.goodsId)
if (res.code == 0) {
this.setData({
goodsAddition: res.data,
hasMoreSelect: true,
})
}
},
async shippingCartInfo() {
const number = await TOOLS.showTabBarBadge(true)
this.setData({
shopNum: number
})
},
onShow() {
AUTH.checkHasLogined().then(isLogin => {
if (isLogin) {
AUTH.bindSeller()
} else {
AUTH.authorize().then(res => {
AUTH.bindSeller()
})
}
})
},
async getGoodsDetailAndKanjieInfo(goodsId) {
const token = wx.getStorageSync('token')
const that = this;
const goodsDetailRes = await WXAPI.goodsDetail(goodsId, token ? token : '')
const goodsKanjiaSetRes = await WXAPI.kanjiaSet(goodsId)
if (goodsDetailRes.code == 0) {
if (!goodsDetailRes.data.pics || goodsDetailRes.data.pics.length == 0) {
goodsDetailRes.data.pics = [{
pic: goodsDetailRes.data.basicInfo.pic
}]
}
if (goodsDetailRes.data.properties) {
that.setData({
hasMoreSelect: true,
selectSizePrice: goodsDetailRes.data.basicInfo.minPrice,
selectSizeOPrice: goodsDetailRes.data.basicInfo.originalPrice,
totalScoreToPay: goodsDetailRes.data.basicInfo.minScore
});
}
if (goodsDetailRes.data.basicInfo.shopId) {
this.shopSubdetail(goodsDetailRes.data.basicInfo.shopId)
}
that.data.goodsDetail = goodsDetailRes.data;
if (goodsDetailRes.data.basicInfo.videoId) {
that.getVideoSrc(goodsDetailRes.data.basicInfo.videoId);
}
let _data = {
goodsDetail: goodsDetailRes.data,
selectSizePrice: goodsDetailRes.data.basicInfo.minPrice,
selectSizeOPrice: goodsDetailRes.data.basicInfo.originalPrice,
totalScoreToPay: goodsDetailRes.data.basicInfo.minScore,
buyNumMax: goodsDetailRes.data.basicInfo.stores,
buyNumber: (goodsDetailRes.data.basicInfo.stores > 0) ? 1 : 0
}
if (goodsKanjiaSetRes.code == 0) {
_data.curGoodsKanjia = goodsKanjiaSetRes.data[0]
that.data.kjId = _data.curGoodsKanjia.id
// 获取当前砍价进度
if (!that.data.kjJoinUid) {
that.data.kjJoinUid = wx.getStorageSync('uid')
}
const curKanjiaprogress = await WXAPI.kanjiaDetail(_data.curGoodsKanjia.id, that.data.kjJoinUid)
const myHelpDetail = await WXAPI.kanjiaHelpDetail(wx.getStorageSync('token'), _data.curGoodsKanjia.id, that.data.kjJoinUid)
if (curKanjiaprogress.code == 0) {
_data.curKanjiaprogress = curKanjiaprogress.data
}
if (myHelpDetail.code == 0) {
_data.myHelpDetail = myHelpDetail.data
}
//砍价商品 tabs栏显示砍价情况
// var tabs = that.data.tabs
// tabs[2].tabs_name=that.data.$t.goodsDetail.kanjiaLogs
// tabs[2].view_id="kanjia"
// that.setData({
// tabs:tabs
// })
}
that.setData(_data)
that._goodsTimesSchedule()
}
},
async shopSubdetail(shopId) {
const res = await WXAPI.shopSubdetail(shopId)
if (res.code == 0) {
this.setData({
shopSubdetail: res.data
})
}
},
goShopCar: function () {
wx.reLaunch({
url: "/pages/shop-cart/index"
});
},
async toAddShopCar() {
this.bindGuiGeTap();
},
/**
* 规格选择弹出框
*/
async bindGuiGeTap() {
this.setData({
hideShopPopup: false,
selectSizePrice: this.data.goodsDetail.basicInfo.minPrice,
selectSizeOPrice: this.data.goodsDetail.basicInfo.originalPrice,
skuGoodsPic: this.data.goodsDetail.basicInfo.pic
})
await this._goodsTimesSchedule()
},
/**
* 规格选择弹出框隐藏
*/
closePopupTap: function () {
this.setData({
hideShopPopup: true
})
},
stepChange(event) {
this.setData({
buyNumber: event.detail
})
},
/**
* 选择商品规格
*/
async labelItemTap(e) {
const propertyindex = e.currentTarget.dataset.propertyindex
const propertychildindex = e.currentTarget.dataset.propertychildindex
const property = this.data.goodsDetail.properties[propertyindex]
const child = property.childsCurGoods[propertychildindex]
// 取消该分类下的子栏目所有的选中状态
property.childsCurGoods.forEach(child => {
child.active = false
})
// 设置当前选中状态
property.optionValueId = child.id
child.active = true
// 获取所有的选中规格尺寸数据
const needSelectNum = this.data.goodsDetail.properties.length
let curSelectNum = 0;
let propertyChildIds = "";
let propertyChildNames = "";
this.data.goodsDetail.properties.forEach(p => {
p.childsCurGoods.forEach(c => {
if (c.active) {
curSelectNum++;
propertyChildIds = propertyChildIds + p.id + ":" + c.id + ",";
propertyChildNames = propertyChildNames + p.name + ":" + c.name + " ";
}
})
})
let canSubmit = false;
if (needSelectNum == curSelectNum) {
canSubmit = true;
}
let skuGoodsPic = this.data.skuGoodsPic
if (this.data.goodsDetail.subPics && this.data.goodsDetail.subPics.length > 0) {
const _subPic = this.data.goodsDetail.subPics.find(ele => {
return ele.optionValueId == child.id
})
if (_subPic) {
skuGoodsPic = _subPic.pic
}
}
this.setData({
goodsDetail: this.data.goodsDetail,
canSubmit,
skuGoodsPic,
propertyChildIds,
propertyChildNames,
})
this.calculateGoodsPrice()
},
async calculateGoodsPrice() {
// 计算最终的商品价格
let price = this.data.goodsDetail.basicInfo.minPrice
let originalPrice = this.data.goodsDetail.basicInfo.originalPrice
let totalScoreToPay = this.data.goodsDetail.basicInfo.minScore
let buyNumMax = this.data.goodsDetail.basicInfo.stores
let buyNumber = this.data.goodsDetail.basicInfo.minBuyNumber
// 计算 sku 价格
if (this.data.canSubmit) {
const token = wx.getStorageSync('token')
const res = await WXAPI.goodsPriceV2({
token: token ? token : '',
goodsId: this.data.goodsDetail.basicInfo.id,
propertyChildIds: this.data.propertyChildIds
})
if (res.code == 0) {
price = res.data.price
originalPrice = res.data.originalPrice
totalScoreToPay = res.data.score
buyNumMax = res.data.stores
}
}
// 计算时段定价的价格
if (this.data.goodsTimesSchedule) {
const a = this.data.goodsTimesSchedule.find(ele => ele.active)
if (a) {
const b = a.items.find(ele => ele.active)
if (b) {
price = b.price
buyNumMax = b.stores
}
}
}
// 计算配件价格
if (this.data.goodsAddition) {
this.data.goodsAddition.forEach(big => {
big.items.forEach(small => {
if (small.active) {
price = (price * 100 + small.price * 100) / 100
}
})
})
}
this.setData({
selectSizePrice: price,
selectSizeOPrice: originalPrice,
totalScoreToPay: totalScoreToPay,
buyNumMax,
buyNumber: (buyNumMax > buyNumber) ? buyNumber : 0
});
},
/**
* 选择可选配件
*/
async labelItemTap2(e) {
const propertyindex = e.currentTarget.dataset.propertyindex
const propertychildindex = e.currentTarget.dataset.propertychildindex
const goodsAddition = this.data.goodsAddition
const property = goodsAddition[propertyindex]
const child = property.items[propertychildindex]
if (child.active) {
// 该操作为取消选择
child.active = false
this.setData({
goodsAddition
})
this.calculateGoodsPrice()
return
}
// 单选配件取消所有子栏目选中状态
if (property.type == 0) {
property.items.forEach(child => {
child.active = false
})
}
// 设置当前选中状态
child.active = true
this.setData({
goodsAddition
})
this.calculateGoodsPrice()
},
async skuClick3(e) {
const propertyindex = e.currentTarget.dataset.idx1
const propertychildindex = e.currentTarget.dataset.idx2
const goodsTimesSchedule = this.data.goodsTimesSchedule
const property = goodsTimesSchedule[propertyindex]
const child = property.items[propertychildindex]
if (child.stores <= 0) {
wx.showToast({
title: this.data.$t.goodsDetail.noStores,
icon: 'none'
})
return
}
goodsTimesSchedule.forEach(a => {
a.active = false
a.items.forEach(b => {
b.active = false
})
})
property.active = true
child.active = true
this.setData({
goodsTimesSchedule
})
this.calculateGoodsPrice()
},
/**
* 加入购物车
*/
async addShopCar() {
if (this.data.goodsDetail.properties && !this.data.canSubmit) {
if (!this.data.canSubmit) {
wx.showToast({
title: this.data.$t.goodsDetail.noSelectSku,
icon: 'none'
})
}
this.bindGuiGeTap()
return
}
const goodsAddition = []
if (this.data.goodsAddition) {
let canSubmit = true
this.data.goodsAddition.forEach(ele => {
if (ele.required) {
const a = ele.items.find(item => {
return item.active
})
if (!a) {
canSubmit = false
}
}
ele.items.forEach(item => {
if (item.active) {
goodsAddition.push({
id: item.id,
pid: item.pid
})
}
})
})
if (!canSubmit) {
wx.showToast({
title: this.data.$t.goodsDetail.noSelectAddtion,
icon: 'none'
})
this.bindGuiGeTap()
return
}
}
if (this.data.buyNumber < 1) {
wx.showToast({
title: this.data.$t.goodsDetail.noSelectNumber,
icon: 'none'
})
return
}
const isLogined = await AUTH.checkHasLogined()
if (!isLogined) {
return
}
const token = wx.getStorageSync('token')
const goodsId = this.data.goodsDetail.basicInfo.id
const sku = []
if (this.data.goodsDetail.properties) {
this.data.goodsDetail.properties.forEach(p => {
sku.push({
optionId: p.id,
optionValueId: p.optionValueId
})
})
}
// 砍价的话先清空现有购物车
if (this.data.curKanjiaprogress && this.data.curKanjiaprogress.kanjiaInfo.uid == this.data.curuid) {
await WXAPI.shippingCarInfoRemoveAll(token)
}
const d = {
token,
goodsId,
number: this.data.buyNumber,
sku: sku && sku.length > 0 ? JSON.stringify(sku) : '',
addition: goodsAddition && goodsAddition.length > 0 ? JSON.stringify(goodsAddition) : '',
}
if (this.data.goodsTimesSchedule) {
const a = this.data.goodsTimesSchedule.find(ele => ele.active)
if (a) {
const b = a.items.find(ele => ele.active)
if (b) {
d.goodsTimesDay = a.day
d.goodsTimesItem = b.name
}
}
}
const res = await WXAPI.shippingCarInfoAddItemV2(d)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.closePopupTap();
wx.showToast({
title: this.data.$t.goodsDetail.addCartSuccess,
icon: 'success'
})
this.shippingCartInfo()
// 砍价的话跳转到下单页面
if (this.data.curKanjiaprogress && this.data.curKanjiaprogress.kanjiaInfo.uid == this.data.curuid) {
wx.navigateTo({
url: '/pages/pay/index?kjId=' + this.data.curGoodsKanjia.id,
})
}
},
onShareAppMessage() {
let _data = {
title: this.data.goodsDetail.basicInfo.name,
path: '/pages/goods-details/index?id=' + this.data.goodsDetail.basicInfo.id + '&inviter_id=' + wx.getStorageSync('uid'),
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
if (this.data.kjJoinUid) {
_data.title = this.data.curKanjiaprogress.joiner.nick + ' ' + this.data.$t.goodsDetail.inviteKanJia
_data.path += '&kjJoinUid=' + this.data.kjJoinUid
}
return _data
},
getVideoSrc: function (videoId) {
var that = this;
WXAPI.videoDetail(videoId).then(function (res) {
if (res.code == 0) {
that.setData({
videoMp4Src: res.data.fdMp4
});
}
})
},
goIndex() {
wx.switchTab({
url: '/pages/index/index',
});
},
helpKanjia() {
const _this = this;
AUTH.checkHasLogined().then(isLogined => {
if (isLogined) {
_this.helpKanjiaDone()
}
})
},
helpKanjiaDone() {
const _this = this;
WXAPI.kanjiaHelp(wx.getStorageSync('token'), _this.data.kjId, _this.data.kjJoinUid, '').then(function (res) {
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return;
}
_this.setData({
myHelpDetail: res.data
});
wx.showModal({
confirmText: _this.data.$t.common.confirm,
cancelText: _this.data.$t.common.cancel,
content: _this.data.$t.goodsDetail.kanJiaAmount + ' ' + res.data.cutPrice,
showCancel: false
})
_this.getGoodsDetailAndKanjieInfo(_this.data.goodsDetail.basicInfo.id)
})
},
closePop() {
this.setData({
posterShow: false
})
},
async drawSharePic() {
const _this = this
const qrcodeRes = await WXAPI.wxaQrcode({
scene: _this.data.goodsDetail.basicInfo.id + ',' + wx.getStorageSync('uid'),
page: 'pages/goods-details/index',
is_hyaline: true,
autoColor: true,
expireHours: 1
})
if (qrcodeRes.code != 0) {
wx.showToast({
title: qrcodeRes.msg,
icon: 'none'
})
return
}
const qrcode = qrcodeRes.data
const pic = _this.data.goodsDetail.basicInfo.pic
wx.getImageInfo({
src: pic,
success(res) {
const height = 490 * res.height / res.width
_this.drawSharePicDone(height, qrcode)
},
fail(e) {
console.error(e)
}
})
},
drawSharePicDone(picHeight, qrcode) {
const _this = this
const _baseHeight = 74 + (picHeight + 120)
this.setData({
posterConfig: {
width: 750,
height: picHeight + 660,
backgroundColor: '#fff',
debug: false,
blocks: [{
x: 76,
y: 74,
width: 604,
height: picHeight + 120,
borderWidth: 2,
borderColor: '#c2aa85',
borderRadius: 8
}],
images: [{
x: 133,
y: 133,
url: _this.data.goodsDetail.basicInfo.pic, // 商品图片
width: 490,
height: picHeight
},
{
x: 76,
y: _baseHeight + 199,
url: qrcode, // 二维码
width: 222,
height: 222
}
],
texts: [{
x: 375,
y: _baseHeight + 80,
width: 650,
lineNum: 2,
text: _this.data.goodsDetail.basicInfo.name,
textAlign: 'center',
fontSize: 40,
color: '#333'
},
{
x: 375,
y: _baseHeight + 180,
text: '¥' + _this.data.goodsDetail.basicInfo.minPrice,
textAlign: 'center',
fontSize: 50,
color: '#e64340'
},
{
x: 352,
y: _baseHeight + 320,
text: _this.data.$t.goodsDetail.longTapQrcode,
fontSize: 28,
color: '#999'
}
],
}
}, () => {
Poster.create();
});
},
onPosterSuccess(e) {
console.log('success:', e)
this.setData({
posterImg: e.detail,
showposterImg: true
})
},
onPosterFail(e) {
console.error('fail:', e)
},
savePosterPic() {
const _this = this
wx.saveImageToPhotosAlbum({
filePath: this.data.posterImg,
success: (res) => {
wx.showModal({
content: _this.data.$t.goodsDetail.qrcodeSaved,
showCancel: false,
confirmText: _this.data.$t.common.gotIt,
confirmColor: '#333'
})
},
complete: () => {
_this.setData({
showposterImg: false
})
},
fail: (res) => {
wx.showToast({
title: res.errMsg,
icon: 'none',
duration: 2000
})
}
})
},
previewImage(e) {
const url = e.currentTarget.dataset.url
wx.previewImage({
current: url, // 当前显示图片的http链接
urls: [url] // 需要预览的图片http链接列表
})
},
onTabsChange(e) {
var index = e.detail.index
this.setData({
toView: this.data.tabs[index].view_id
})
},
backToHome() {
wx.switchTab({
url: '/pages/index/index',
})
},
joinKanjia() {
AUTH.checkHasLogined().then(isLogined => {
if (isLogined) {
this.doneJoinKanjia();
}
})
},
doneJoinKanjia: function () { // 报名参加砍价活动
const _this = this;
if (!_this.data.curGoodsKanjia) {
return;
}
wx.showLoading({
title: ''
})
WXAPI.kanjiaJoin(wx.getStorageSync('token'), _this.data.curGoodsKanjia.id).then(function (res) {
wx.hideLoading()
if (res.code == 0) {
_this.setData({
kjJoinUid: wx.getStorageSync('uid'),
myHelpDetail: null
})
_this.getGoodsDetailAndKanjieInfo(_this.data.goodsDetail.basicInfo.id)
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
})
================================================
FILE: pages/goods-details/index.json
================================================
{
"navigationBarTitleText": "",
"usingComponents": {
"poster": "wxa-plugin-canvas/poster"
}
}
================================================
FILE: pages/goods-details/index.wxml
================================================
¥
{{selectSizePrice}}
¥{{selectSizeOPrice}}
{{goodsDetail.basicInfo.name}}
✦
{{goodsDetail.basicInfo.characteristic}}
💰
{{ $t.goodsDetail.commission1 }} {{goodsDetail.basicInfo.commission}} {{ $t.goodsDetail.commission2 }}
💰
{{ $t.goodsDetail.commission1 }} {{goodsDetail.basicInfo.commission}} {{ $t.goodsDetail.commission3 }}
{{ $t.goodsDetail.help }}
{{curKanjiaprogress.joiner.nick}} {{ $t.goodsDetail.kanjia }}!
{{ $t.common.select }}
{{item.name}}
{{item.name}}
›
{{property.name}}
{{item.name}}
{{ $t.goodsDetail.buyNumber }}
{{shopSubdetail.info.name}}
📍 {{shopSubdetail.info.address}}
{{myHelpDetail ? $t.goodsDetail.helped : $t.goodsDetail.helphe}}
{{ $t.goodsDetail.buyUseCurPrice }}
{{ $t.goodsDetail.saveImage }}
================================================
FILE: pages/goods-details/index.wxss
================================================
/* 页面基础样式 */
page {
background: linear-gradient(180deg, #FDF8F3 0%, #F5EFE7 100%);
padding-bottom: 32rpx;
}
view,
image,
input,
textarea {
display: block;
box-sizing: border-box;
}
/* ======================== 容器样式 ======================== */
.container {
min-height: 100vh;
padding-bottom: 120rpx;
background: linear-gradient(180deg, #FDF8F3 0%, #F5EFE7 100%);
}
/* ======================== 商品图片区域 ======================== */
.swiper-container {
width: 100%;
position: relative;
overflow: hidden;
}
.swiper_box {
width: 100%;
height: 750rpx;
border-radius: 0 0 48rpx 48rpx;
overflow: hidden;
}
swiper-item image {
width: 100%;
height: 750rpx;
display: block;
}
.slide-image {
width: 100%;
height: 100%;
object-fit: cover;
}
/* ======================== 商品信息卡片 ======================== */
.goods-info-card {
margin: 24rpx 24rpx 24rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
border-radius: 32rpx;
padding: 40rpx 32rpx;
box-shadow: 0 8rpx 32rpx rgba(212, 165, 116, 0.15);
position: relative;
z-index: 10;
}
.goods-info-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6rpx;
background: linear-gradient(90deg, #D4A574 0%, #C9935E 100%);
border-radius: 32rpx 32rpx 0 0;
}
/* 价格区域 */
.price-section {
display: flex;
align-items: baseline;
margin-bottom: 24rpx;
}
.current-price {
display: flex;
align-items: baseline;
color: #C9935E;
}
.currency {
font-size: 32rpx;
font-weight: 600;
margin-right: 4rpx;
}
.price-num {
font-size: 56rpx;
font-weight: 700;
letter-spacing: -1rpx;
}
.original-price {
margin-left: 16rpx;
font-size: 28rpx;
color: #B8B8B8;
text-decoration: line-through;
}
/* 商品标题 */
.goods-title {
font-size: 36rpx;
font-weight: 600;
color: #333333;
line-height: 1.5;
margin-bottom: 16rpx;
letter-spacing: 0.5rpx;
}
/* 特性标签 */
.characteristic-tag {
display: inline-flex;
align-items: center;
background: linear-gradient(135deg, #FFF5E8 0%, #FFE8CC 100%);
padding: 12rpx 24rpx;
border-radius: 40rpx;
margin-bottom: 16rpx;
}
.tag-icon {
font-size: 24rpx;
color: #D4A574;
margin-right: 8rpx;
}
.tag-text {
font-size: 26rpx;
color: #8B6F47;
font-weight: 500;
}
/* 佣金提示 */
.commission-tip {
display: flex;
align-items: center;
font-size: 26rpx;
color: #D4A574;
padding: 16rpx 24rpx;
background: linear-gradient(135deg, #FFF9F0 0%, #FFF3E0 100%);
border-radius: 16rpx;
margin-top: 16rpx;
border: 1rpx solid #FFE8CC;
}
.tip-icon {
margin-right: 8rpx;
font-size: 28rpx;
}
/* ======================== 规格选择卡片 ======================== */
.spec-select-card {
margin: 0 24rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 28rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.1);
transition: all 0.3s ease;
}
.spec-select-card:active {
transform: scale(0.98);
}
.spec-title {
font-size: 28rpx;
font-weight: 600;
color: #666666;
margin-right: 16rpx;
}
.spec-content {
flex: 1;
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
.spec-tag {
font-size: 26rpx;
color: #999999;
padding: 8rpx 16rpx;
background: #F8F8F8;
border-radius: 8rpx;
}
.spec-arrow {
font-size: 48rpx;
color: #D4A574;
font-weight: 300;
margin-left: 16rpx;
}
/* ======================== 展开式规格选择 ======================== */
.spec-select-expanded {
margin: 0 24rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.1);
}
.section-header {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 32rpx;
}
.header-line {
flex: 1;
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #E8D5C4 50%, transparent 100%);
}
.header-text {
font-size: 28rpx;
color: #8B6F47;
font-weight: 600;
padding: 0 24rpx;
letter-spacing: 2rpx;
}
.spec-options-wrapper {
margin-bottom: 32rpx;
}
.spec-group {
margin-bottom: 32rpx;
}
.spec-label {
font-size: 28rpx;
color: #666666;
font-weight: 600;
margin-bottom: 16rpx;
}
.spec-items {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.spec-item {
font-size: 28rpx;
color: #666666;
padding: 16rpx 32rpx;
background: #F8F8F8;
border-radius: 16rpx;
border: 2rpx solid transparent;
transition: all 0.3s ease;
}
.spec-item.active {
color: #C9935E;
background: linear-gradient(135deg, #FFF5E8 0%, #FFE8CC 100%);
border-color: #D4A574;
font-weight: 600;
}
/* 数量选择器 */
.quantity-selector {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 24rpx;
border-top: 2rpx solid #F5F5F5;
}
.quantity-label {
font-size: 28rpx;
color: #666666;
font-weight: 600;
}
/* ======================== 店铺信息卡片 ======================== */
.shop-info-card {
margin: 0 24rpx 24rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF7 100%);
border-radius: 24rpx;
padding: 28rpx 32rpx;
display: flex;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.1);
}
.shop-badge {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
overflow: hidden;
margin-right: 24rpx;
box-shadow: 0 4rpx 12rpx rgba(212, 165, 116, 0.2);
}
.shop-avatar {
width: 100%;
height: 100%;
object-fit: cover;
}
.shop-details {
flex: 1;
}
.shop-name {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-bottom: 8rpx;
}
.shop-address {
font-size: 26rpx;
color: #999999;
line-height: 1.5;
}
/* ======================== 商品详情卡片 ======================== */
.goods-detail-card {
margin: 0 24rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 40rpx 32rpx;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.1);
}
.detail-header {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 32rpx;
}
.header-decorator {
width: 80rpx;
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #D4A574 100%);
}
.header-decorator:last-child {
background: linear-gradient(90deg, #D4A574 0%, transparent 100%);
}
.header-title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
padding: 0 24rpx;
letter-spacing: 2rpx;
}
.detail-content {
font-size: 28rpx;
color: #666666;
line-height: 1.8;
}
.detail-content image {
width: 100%;
border-radius: 16rpx;
margin: 16rpx 0;
}
/* ======================== 砍价相关样式 ======================== */
.curKanjiaprogress {
width: 100%;
background: #FFFFFF;
border-radius: 24rpx;
margin: 0 24rpx 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.1);
}
.curKanjiaprogress .name {
font-size: 32rpx;
padding: 0 0 24rpx 0;
text-align: center;
color: #333333;
}
.van-progress {
margin: 32rpx 0;
}
.flex {
display: flex;
width: 100%;
}
.kjbutton {
flex: 1;
padding: 0 30rpx;
}
.kjbutton button {
border-radius: 40rpx;
background: linear-gradient(135deg, #D4A574 0%, #C9935E 100%);
}
.kjBuyButton {
position: fixed;
left: 0;
bottom: calc(env(safe-area-inset-bottom) / 2);
width: 100%;
display: flex;
padding: 16rpx 24rpx;
background: #FFFFFF;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
}
.kjBuyButton .item {
flex: 1;
}
.kjlj {
display: flex;
background: #FFFFFF;
padding: 16rpx 32rpx;
align-items: center;
}
.kjlj-l {
width: 88rpx;
height: 88rpx;
border-radius: 50%;
flex-shrink: 0;
margin-right: 16rpx;
}
/* ======================== 弹窗样式 ======================== */
.popup-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 9998;
}
.popup-goods-card {
display: flex;
padding: 0 32rpx 32rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.popup-goods-image {
width: 160rpx;
height: 160rpx;
border-radius: 16rpx;
margin-right: 24rpx;
object-fit: cover;
box-shadow: 0 4rpx 12rpx rgba(212, 165, 116, 0.15);
}
.popup-goods-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.popup-goods-name {
font-size: 30rpx;
font-weight: 600;
color: #333333;
line-height: 1.4;
margin-bottom: 12rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.popup-price-row {
display: flex;
align-items: baseline;
}
.popup-current-price {
font-size: 36rpx;
font-weight: 700;
color: #C9935E;
margin-right: 12rpx;
}
.popup-original-price {
font-size: 26rpx;
color: #B8B8B8;
text-decoration: line-through;
}
/* 弹窗规格选择 */
.popup-spec-area {
padding: 32rpx;
max-height: 600rpx;
overflow-y: auto;
}
.popup-spec-group {
margin-bottom: 32rpx;
}
.popup-spec-label {
font-size: 28rpx;
font-weight: 600;
color: #666666;
margin-bottom: 16rpx;
}
.popup-spec-items {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.popup-spec-item {
font-size: 28rpx;
color: #666666;
padding: 16rpx 32rpx;
background: #F8F8F8;
border-radius: 16rpx;
border: 2rpx solid transparent;
transition: all 0.3s ease;
}
.popup-spec-item.active {
color: #C9935E;
background: linear-gradient(135deg, #FFF5E8 0%, #FFE8CC 100%);
border-color: #D4A574;
font-weight: 600;
}
/* 弹窗数量选择 */
.popup-quantity {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 32rpx;
border-top: 2rpx solid #F5F5F5;
}
.popup-quantity-label {
font-size: 28rpx;
font-weight: 600;
color: #666666;
}
/* 弹窗确认按钮 */
.popup-action-area {
padding: 24rpx 32rpx 32rpx;
}
.popup-confirm-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
background: linear-gradient(135deg, #D4A574 0%, #C9935E 100%);
border-radius: 44rpx;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.4);
transition: all 0.3s ease;
}
.popup-confirm-btn:active {
transform: scale(0.96);
box-shadow: 0 4rpx 12rpx rgba(212, 165, 116, 0.3);
}
.popup-confirm-btn.premium {
background: linear-gradient(135deg, #C9935E 0%, #A87C4F 100%);
}
/* ======================== 海报相关样式 ======================== */
.poster-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
z-index: 9999;
}
.poster {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10000;
}
.canvas {
width: 686rpx;
}
.poster-btn {
position: fixed;
bottom: 100rpx;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 24rpx;
z-index: 10001;
}
.poster-btn button {
border-radius: 40rpx;
}
.posterImg-box {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 686rpx;
background: #FFFFFF;
border-radius: 24rpx;
overflow: hidden;
z-index: 10000;
}
.posterImg {
width: 100%;
}
.btn-create {
margin: 32rpx;
height: 88rpx;
line-height: 88rpx;
background: linear-gradient(135deg, #D4A574 0%, #C9935E 100%);
color: #FFFFFF;
text-align: center;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.4);
}
/* ======================== 底部操作栏 ======================== */
.van-goods-action {
background: #FFFFFF;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
}
/* ======================== Vant组件样式覆盖 ======================== */
.van-cell {
padding: 24rpx 32rpx;
background: #FFFFFF;
border-radius: 16rpx;
}
.van-cell-group {
margin: 0 24rpx 24rpx;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.1);
}
.van-button--primary {
background: linear-gradient(135deg, #D4A574 0%, #C9935E 100%);
border: none;
border-radius: 40rpx;
}
.van-button--danger {
background: linear-gradient(135deg, #C9935E 0%, #A87C4F 100%);
border: none;
border-radius: 40rpx;
}
.van-button--warning {
background: linear-gradient(135deg, #FFB84D 0%, #FF9E2C 100%);
border: none;
border-radius: 40rpx;
}
.van-stepper {
font-size: 28rpx;
}
/* ======================== 通用样式 ======================== */
.clearfix:after {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* ======================== 响应式优化 ======================== */
@media (prefers-color-scheme: dark) {
/* 暗色模式下保持亮色主题 */
page {
background: linear-gradient(180deg, #FDF8F3 0%, #F5EFE7 100%);
}
}
================================================
FILE: pages/home/index.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
},
onLoad(e) {
getApp().initLanguage(this)
getApp().getUserDetailOK = (apiUserInfoMap) => {
this.processGotUserDetail(apiUserInfoMap)
}
this.banners()
},
onShow() {
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
},
async processGotUserDetail(apiUserInfoMap) {
if (!apiUserInfoMap) {
return
}
this.setData({
apiUserInfoMap,
nick: apiUserInfoMap.base.nick
})
},
async banners() {
// https://www.yuque.com/apifm/nu0f75/ms21ki
const res = await WXAPI.banners({
type: 'shouye'
})
if (res.code == 0) {
this.setData({
banners: res.data
})
}
},
tapBanner(e) {
const url = e.currentTarget.dataset.url
if (url) {
wx.navigateTo({
url
})
}
},
onShareAppMessage() {
return {
title: wx.getStorageSync('mallName') + ' ' + wx.getStorageSync('share_profile'),
path: '/pages/home/index?inviter_id=' + (wx.getStorageSync('uid') || ''),
imageUrl: wx.getStorageSync('share_pic')
}
},
onShareTimeline() {
return {
title: wx.getStorageSync('mallName') + ' ' + wx.getStorageSync('share_profile'),
query: 'inviter_id=' + (wx.getStorageSync('uid') || ''),
imageUrl: wx.getStorageSync('share_pic')
}
},
changeLang() {
getApp().changeLang(this)
},
huiyuan() {
wx.navigateTo({
url: '/pages/member-center/index',
})
},
coupon() {
wx.navigateTo({
url: '/pages/coupons/index',
})
},
changePeisongType(e) {
const peisongType = e.currentTarget.dataset.type
wx.setStorageSync('peisongType', peisongType)
wx.switchTab({
url: '/pages/index/index',
})
},
about() {
wx.navigateTo({
url: '/pages/about/index',
})
},
about() {
wx.navigateTo({
url: '/pages/about/index',
})
},
touming() {
wx.navigateTo({
url: '/pages/about/index?key=toumingshicai',
})
},
card() {
wx.navigateTo({
url: '/pages/card/index',
})
},
})
================================================
FILE: pages/home/index.json
================================================
{
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
================================================
FILE: pages/home/index.wxml
================================================
{{ nick ? nick : $t.my.nickSet }}
{{ apiUserInfoMap.userLevel.name || $t.home.huiyuan }}
{{ $t.coupons.title }}
配送方式
{{ $t.home.zq }}
到店自取
{{ $t.home.ps }}
外卖配送
更多服务
{{ $t.home.sc }}
{{ $t.home.lpk }}
{{ $t.home.tg }}
{{ $t.home.bh }}
TEA WORK
================================================
FILE: pages/home/index.wxss
================================================
/* 全局容器 */
.home-container {
min-height: 100vh;
background: linear-gradient(180deg, #fef8f4 0%, #fff5ed 100%);
padding-bottom: 60rpx;
}
/* ==================== 轮播图区域 ==================== */
.banner-section {
position: relative;
width: 100%;
overflow: hidden;
}
.banner-swiper {
width: 100%;
height: 420rpx;
border-radius: 0 0 48rpx 48rpx;
overflow: hidden;
}
.banner-image {
width: 100%;
height: 100%;
}
/* ==================== 用户信息卡片 ==================== */
.user-card {
margin: 32rpx 32rpx 0;
padding: 32rpx;
background: linear-gradient(135deg, #ffffff 0%, #fff9f6 100%);
border-radius: 28rpx;
box-shadow: 0 8rpx 32rpx rgba(255, 107, 157, 0.12);
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
z-index: 10;
}
.user-main {
display: flex;
align-items: center;
flex: 1;
}
.user-avatar {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
border: 4rpx solid #ffe8f0;
box-shadow: 0 4rpx 16rpx rgba(255, 107, 157, 0.2);
}
.user-info {
margin-left: 24rpx;
display: flex;
flex-direction: column;
gap: 8rpx;
}
.user-nick {
font-size: 32rpx;
font-weight: 600;
color: #333;
letter-spacing: 1rpx;
}
.user-member {
display: flex;
}
.user-actions {
display: flex;
align-items: center;
gap: 16rpx;
}
.language-btn {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 50%;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
}
.language-icon {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
}
.coupon-btn {
display: flex;
align-items: center;
padding: 12rpx 24rpx;
background: linear-gradient(135deg, #ff6b9d 0%, #ff8fab 100%);
border-radius: 40rpx;
color: #fff;
font-size: 26rpx;
box-shadow: 0 4rpx 16rpx rgba(255, 107, 157, 0.3);
transition: all 0.3s;
}
.coupon-btn text {
margin-right: 4rpx;
}
/* ==================== 配送方式区域 ==================== */
.delivery-section {
margin: 40rpx 32rpx 0;
}
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
padding-left: 12rpx;
border-left: 6rpx solid #ff6b9d;
}
.delivery-types {
display: flex;
gap: 24rpx;
}
.delivery-card {
flex: 1;
background: linear-gradient(135deg, #fff 0%, #fffbf8 100%);
border-radius: 24rpx;
padding: 36rpx 24rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 6rpx 24rpx rgba(255, 141, 107, 0.08);
border: 2rpx solid #ffe8f0;
transition: all 0.3s;
position: relative;
overflow: hidden;
}
.delivery-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4rpx;
background: linear-gradient(90deg, #ff6b9d 0%, #ff8fab 100%);
transform: scaleX(0);
transition: transform 0.3s;
}
.delivery-card:active::before {
transform: scaleX(1);
}
.delivery-card:active {
transform: translateY(-4rpx);
box-shadow: 0 12rpx 32rpx rgba(255, 141, 107, 0.16);
}
.delivery-icon-wrapper {
width: 96rpx;
height: 96rpx;
background: linear-gradient(135deg, #fff0f5 0%, #ffe8f0 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
.delivery-icon {
width: 60rpx;
height: 60rpx;
}
.delivery-text {
font-size: 30rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
}
.delivery-desc {
font-size: 24rpx;
color: #999;
}
/* ==================== 功能入口区域 ==================== */
.features-section {
margin: 48rpx 32rpx 0;
}
.features-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24rpx;
}
.feature-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 24rpx 12rpx;
background: linear-gradient(135deg, #fff 0%, #fffbf8 100%);
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(255, 141, 107, 0.06);
transition: all 0.3s;
}
.feature-item:active {
transform: translateY(-4rpx);
box-shadow: 0 8rpx 24rpx rgba(255, 141, 107, 0.12);
}
.feature-icon-box {
width: 80rpx;
height: 80rpx;
background: linear-gradient(135deg, #fff5f0 0%, #ffebe8 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12rpx;
}
.feature-icon {
width: 48rpx;
height: 48rpx;
}
.feature-name {
font-size: 24rpx;
color: #666;
text-align: center;
line-height: 1.4;
}
/* ==================== 品牌底部 ==================== */
.brand-footer {
margin-top: 64rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 24rpx;
padding: 0 64rpx;
}
.brand-line {
flex: 1;
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #e8d5c8 50%, transparent 100%);
}
.brand-name {
font-size: 28rpx;
font-weight: 600;
color: #a67c52;
letter-spacing: 4rpx;
font-family: 'Georgia', serif;
}
/* ==================== 响应式优化 ==================== */
@media (min-width: 375px) {
.banner-swiper {
height: 460rpx;
}
}
@media (min-width: 414px) {
.banner-swiper {
height: 500rpx;
}
}
/* ==================== 动画效果 ==================== */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.user-card,
.delivery-section,
.features-section {
animation: fadeInUp 0.6s ease-out;
}
================================================
FILE: pages/index/index.js
================================================
const APP = getApp()
const AUTH = require('../../utils/auth')
const WXAPI = require('apifm-wxapi')
Page({
data: {
page: 1,
peisongType: 'zq', // zq 自取,kd 配送
showCartPop: false, // 是否显示购物车列表
showGoodsDetailPOP: false, // 是否显示商品详情
showCouponPop: false, // 是否弹出优惠券领取提示
shopIsOpened: false, // 是否营业
showPingtuanPop: false,
share_goods_id: undefined,
share_pingtuan_open_id: undefined,
lijipingtuanbuy: false,
pingtuan_open_id: undefined,
menuButtonBoundingClientRect: wx.getMenuButtonBoundingClientRect(),
// 连续滚动模式相关数据
isContinuousMode: true, // 是否启用连续滚动模式
categoryIndex: 0, // 当前激活的分类索引
goodsByCategory: [], // 按分类分组的商品数据,用于跟踪每个分类的商品范围
scrollTop: 0, // 当前滚动位置
currentCategoryIndex: 0, // 当前滚动到的分类索引
},
onLoad: function (e) {
getApp().initLanguage(this)
const _data = {}
// 测试拼团入口
// e = {
// share_goods_id: 521055,
// share_pingtuan_open_id: 11267
// }
// 测试扫码点餐
// shopId=36,id=111,key=Y6RoIT 进行 url编码,3个值分别为 门店id,餐桌id,餐桌密钥
// e = {
// scene: 'shopId%3d12879%2cid%3d111%2ckey%3dY6RoIT'
// }
let mod = 0 // 0 普通模式; 1 扫码点餐模式
if (e && e.scene) {
const scene = decodeURIComponent(e.scene) // 处理扫码进商品详情页面的逻辑
if (scene && scene.split(',').length == 3) {
// 扫码点餐
const scanDining = {}
if (scene.indexOf('key=') != -1) {
// 原来shopId=36,id=111,key=Y6RoIT的参数
scene.split(',').forEach(ele => {
scanDining[ele.split('=')[0]] = ele.split('=')[1]
})
} else {
// 新的 1007292,1015,zsT1U3 模式
const _scene = scene.split(',')
scanDining.shopId = _scene[0]
scanDining.id = _scene[1]
scanDining.key = _scene[2]
}
wx.setStorageSync('scanDining', scanDining)
_data.scanDining = scanDining
this.cyTableToken(scanDining.id, scanDining.key)
mod = 1
} else {
wx.removeStorageSync('scanDining')
}
}
if (wx.getStorageSync('scanDining')) {
mod = 1
_data.scanDining = wx.getStorageSync('scanDining')
wx.hideTabBar()
}
this.setData(_data)
if (e.share_goods_id) {
this.data.share_goods_id = e.share_goods_id
this._showGoodsDetailPOP(e.share_goods_id)
}
if (e.share_pingtuan_open_id) {
this.data.share_pingtuan_open_id = e.share_pingtuan_open_id
} else {
this._showCouponPop()
}
// 静默式授权注册/登陆
if (mod == 0) {
AUTH.checkHasLogined().then(isLogin => {
if (isLogin) {
AUTH.bindSeller()
} else {
AUTH.authorize().then(res => {
AUTH.bindSeller()
})
}
})
}
// 设置标题
const mallName = wx.getStorageSync('mallName')
if (mallName) {
this.setData({
mallName
})
wx.setNavigationBarTitle({
title: mallName
})
}
APP.configLoadOK = () => {
const mallName = wx.getStorageSync('mallName')
if (mallName) {
wx.setNavigationBarTitle({
title: mallName
})
}
}
// 读取默认配送方式
let peisongType = wx.getStorageSync('peisongType')
if (!peisongType) {
peisongType = 'zq'
wx.setStorageSync('peisongType', peisongType)
}
this.setData({
peisongType
})
this.noticeLastOne()
this.getshopInfo()
this.banners()
},
onShow: function(){
const peisongType = wx.getStorageSync('peisongType')
if (peisongType) {
this.setData({
peisongType
})
}
this.shippingCarInfo()
const refreshIndex = wx.getStorageSync('refreshIndex')
if (refreshIndex) {
this.getshopInfo()
wx.removeStorageSync('refreshIndex')
}
},
async cyTableToken(tableId, key) {
const res = await WXAPI.cyTableToken(tableId, key)
if (res.code != 0) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
return
}
wx.hideTabBar()
wx.setStorageSync('uid', res.data.uid)
wx.setStorageSync('token', res.data.token)
},
async getshopInfo(){
let shopInfo = wx.getStorageSync('shopInfo')
if (shopInfo) {
this.setData({
shopInfo: shopInfo,
shopIsOpened: this.checkIsOpened(shopInfo.openingHours)
})
this.categories()
return
}
wx.getLocation({
type: 'wgs84', //wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
success: (res) => {
// console.log(res)
this.data.latitude = res.latitude
this.data.longitude = res.longitude
this.fetchShops(res.latitude, res.longitude, '')
},
fail: (e) => {
console.log(e);
if (e.errMsg.indexOf('fail auth deny') != -1) {
AUTH.checkAndAuthorize('scope.userLocation')
} else if (e.errMsg.indexOf('fail privacy permission is not authorized') != -1) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.common.privacyPermission,
showCancel: false,
success: () => {
wx.reLaunch({
url: '/pages/index/index',
})
}
})
} else {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: e.errMsg,
showCancel: false
})
}
}
})
},
async fetchShops(latitude, longitude, kw){
const res = await WXAPI.fetchShops({
curlatitude: latitude,
curlongitude: longitude,
nameLike: kw,
pageSize: 1
})
if (res.code != 0) {
wx.showModal({
content: this.data.$t.common.empty,
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
showCancel: false
})
return
}
res.data.forEach(ele => {
ele.distance = ele.distance.toFixed(1) // 距离保留3位小数
})
this.setData({
shopInfo: res.data[0],
shopIsOpened: this.checkIsOpened(res.data[0].openingHours)
})
wx.setStorageSync('shopInfo', res.data[0])
this.categories()
},
async _showCouponPop() {
const a = wx.getStorageSync('has_pop_coupons')
if (a) {
return
}
// 检测是否需要弹出优惠券的福袋
const res = await WXAPI.coupons({
token: wx.getStorageSync('token')
})
if (res.code == 0) {
this.data.showCouponPop = true
wx.setStorageSync('has_pop_coupons', true)
} else {
this.data.showCouponPop = false
}
this.setData({
showCouponPop: this.data.showCouponPop
})
},
changePeisongType(e) {
const peisongType = e.currentTarget.dataset.type
this.setData({
peisongType
})
wx.setStorageSync('peisongType', peisongType)
},
// 获取分类
async categories() {
const shopInfo = wx.getStorageSync('shopInfo')
const shop_goods_split = wx.getStorageSync('shop_goods_split')
let shopId = '0'
if (shopInfo) {
shopId = '0,' + shopInfo.id
}
if (shop_goods_split != '1') {
shopId = ''
}
// https://www.yuque.com/apifm/nu0f75/racmle
const res = await WXAPI.goodsCategoryV2(shopId)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.setData({
page: 1,
categories: res.data,
categorySelected: res.data[0],
categoryIndex: 0,
currentCategoryIndex: 0, // 初始化为第一个分类
goodsByCategory: []
})
if (shop_goods_split == '1') {
wx.setStorageSync('shopIds', shopInfo.id)
} else {
wx.removeStorageSync('shopIds')
}
this.data.page = 1
this.getGoodsList()
},
async getGoodsList() {
if (!this.data.isContinuousMode) {
// 原有的单分类模式
this._getGoodsListSingleCategory()
return
}
// 连续滚动模式
await this._getGoodsListContinuous()
},
// 原有的单分类商品加载逻辑
async _getGoodsListSingleCategory() {
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/wg5t98
const res = await WXAPI.goodsv2({
page: this.data.page,
categoryId: this.data.categorySelected.id,
pageSize: 10000
})
wx.hideLoading()
if (res.code == 700) {
if (this.data.page == 1) {
this.setData({
goods: null
})
}
return
}
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
res.data.result.forEach(ele => {
if (ele.miaosha) {
// 秒杀商品,显示倒计时
const _now = new Date().getTime()
ele.dateStartInt = new Date(ele.dateStart.replace(/-/g, '/')).getTime() - _now
ele.dateEndInt = new Date(ele.dateEnd.replace(/-/g, '/')).getTime() -_now
}
})
if (this.data.page == 1) {
this.setData({
goods: res.data.result
})
} else {
this.setData({
goods: this.data.goods.concat(res.data.result)
})
}
this.processBadge()
},
// 连续滚动模式的商品加载逻辑
async _getGoodsListContinuous() {
wx.showLoading({
title: '',
})
const categories = this.data.categories
const categoryIndex = this.data.categoryIndex
let allGoods = this.data.goods || []
let goodsByCategory = this.data.goodsByCategory || []
// 如果是首次加载,重置数据
if (this.data.page == 1) {
allGoods = []
goodsByCategory = []
}
// 循环加载所有分类的商品
for (let i = categoryIndex; i < categories.length; i++) {
const category = categories[i]
const res = await WXAPI.goodsv2({
page: 1, // 每个分类都从第一页开始
categoryId: category.id,
pageSize: 10000
})
if (res.code == 0 && res.data.result && res.data.result.length > 0) {
// 处理秒杀商品倒计时
res.data.result.forEach(ele => {
if (ele.miaosha) {
const _now = new Date().getTime()
ele.dateStartInt = new Date(ele.dateStart.replace(/-/g, '/')).getTime() - _now
ele.dateEndInt = new Date(ele.dateEnd.replace(/-/g, '/')).getTime() - _now
}
})
// 记录该分类的商品范围
const startIndex = allGoods.length
const endIndex = startIndex + res.data.result.length - 1
goodsByCategory.push({
categoryId: category.id,
categoryName: category.name,
startIndex: startIndex,
endIndex: endIndex,
goodsCount: res.data.result.length
})
// 添加到总商品列表
allGoods = allGoods.concat(res.data.result)
// 如果加载到足够商品,停止加载更多分类
if (allGoods.length >= 50) { // 限制初始加载数量
break
}
}
}
wx.hideLoading()
this.setData({
goods: allGoods,
goodsByCategory: goodsByCategory,
categoryIndex: Math.min(categoryIndex + 1, categories.length - 1),
currentCategoryIndex: 0 // 初始化第一个分类为激活状态
})
console.log('商品数据加载完成,分类数据:', goodsByCategory)
this.processBadge()
},
_onReachBottom() {
if (!this.data.isContinuousMode) {
// 原有的单分类模式
this.data.page++
this.getGoodsList()
return
}
// 连续滚动模式:继续加载更多分类的商品
this._loadMoreCategories()
},
// 连续滚动模式下加载更多分类的商品
async _loadMoreCategories() {
const categories = this.data.categories
const categoryIndex = this.data.categoryIndex
let allGoods = this.data.goods || []
let goodsByCategory = this.data.goodsByCategory || []
// 如果已经加载完所有分类,不再加载
if (categoryIndex >= categories.length) {
return
}
wx.showLoading({
title: '',
})
// 从当前分类索引开始继续加载
for (let i = categoryIndex; i < categories.length; i++) {
const category = categories[i]
const res = await WXAPI.goodsv2({
page: 1,
categoryId: category.id,
pageSize: 10000
})
if (res.code == 0 && res.data.result && res.data.result.length > 0) {
// 处理秒杀商品倒计时
res.data.result.forEach(ele => {
if (ele.miaosha) {
const _now = new Date().getTime()
ele.dateStartInt = new Date(ele.dateStart.replace(/-/g, '/')).getTime() - _now
ele.dateEndInt = new Date(ele.dateEnd.replace(/-/g, '/')).getTime() - _now
}
})
// 记录该分类的商品范围
const startIndex = allGoods.length
const endIndex = startIndex + res.data.result.length - 1
goodsByCategory.push({
categoryId: category.id,
categoryName: category.name,
startIndex: startIndex,
endIndex: endIndex,
goodsCount: res.data.result.length
})
// 添加到总商品列表
allGoods = allGoods.concat(res.data.result)
// 每次只加载一个分类,避免一次性加载太多
break
}
}
wx.hideLoading()
this.setData({
goods: allGoods,
goodsByCategory: goodsByCategory,
categoryIndex: Math.min(categoryIndex + 1, categories.length)
// 注意:不在这里设置currentCategoryIndex,以避免影响滚动时的选中状态
})
this.processBadge()
},
// 滚动事件监听
onScroll(e) {
if (!this.data.isContinuousMode) {
return
}
const scrollTop = e.detail.scrollTop
// this.setData({
// scrollTop: scrollTop
// })
// 计算当前滚动到的分类
this._calculateCurrentCategory(scrollTop)
},
// 计算当前滚动位置对应的分类
_calculateCurrentCategory(scrollTop) {
const goodsByCategory = this.data.goodsByCategory
if (!goodsByCategory || goodsByCategory.length === 0) {
console.log('goodsByCategory为空,无法计算分类')
return
}
// 更准确的估算值(rpx转px,微信小程序中1rpx = 0.5px在大多数设备上)
const itemHeight = 200 // 每个商品卡片约200px高度(包括间距)
const headerHeight = 200 // banner等头部高度约200px
// 计算当前可见区域的商品索引
const visibleStartIndex = Math.max(0, Math.floor((scrollTop - headerHeight) / itemHeight))
console.log('计算分类 - 滚动位置:', scrollTop, '可见商品索引:', visibleStartIndex, '分类数据:', goodsByCategory)
// 找到对应的分类
let currentCategoryIndex = 0
for (let i = 0; i < goodsByCategory.length; i++) {
const category = goodsByCategory[i]
if (visibleStartIndex >= category.startIndex && visibleStartIndex <= category.endIndex) {
currentCategoryIndex = i
console.log('找到匹配分类:', i, category)
break
}
}
// 如果滚动到了最后,设置最后一个分类为激活状态
if (visibleStartIndex >= goodsByCategory[goodsByCategory.length - 1].endIndex) {
currentCategoryIndex = goodsByCategory.length - 1
console.log('滚动到最后,设置最后一个分类:', currentCategoryIndex)
}
console.log('最终激活分类:', currentCategoryIndex, '当前值:', this.data.currentCategoryIndex)
// 更新当前分类索引
if (currentCategoryIndex !== this.data.currentCategoryIndex) {
console.log('更新激活分类:', currentCategoryIndex)
this.setData({
currentCategoryIndex: currentCategoryIndex
})
}
},
categoryClick(e) {
const index = e.currentTarget.dataset.idx
if (!this.data.isContinuousMode) {
// 原有的单分类模式
const categorySelected = this.data.categories[index]
this.setData({
page: 1,
categorySelected,
scrolltop: 0
})
this.getGoodsList()
return
}
// 连续滚动模式:滚动到对应分类的第一个商品
this._scrollToCategory(index)
},
// 滚动到指定分类的第一个商品
_scrollToCategory(categoryIndex) {
const goodsByCategory = this.data.goodsByCategory
if (!goodsByCategory || goodsByCategory.length <= categoryIndex) {
return
}
const category = goodsByCategory[categoryIndex]
if (!category) {
return
}
// 估算滚动位置:商品索引 * 商品高度 + 头部高度
const itemHeight = 200 // 与_calculateCurrentCategory中的估算值保持一致
const headerHeight = 200 // banner等头部高度
const scrollTop = category.startIndex * itemHeight + headerHeight
this.setData({
scrollTop: scrollTop,
currentCategoryIndex: categoryIndex
})
// 使用scroll-view的滚动方法
// 注意:需要在wxml中为scroll-view添加scroll-top属性绑定
},
async shippingCarInfo() {
const res = await WXAPI.shippingCarInfo(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
shippingCarInfo: res.data
})
} else {
this.setData({
shippingCarInfo: null,
showCartPop: false
})
}
this.processBadge()
},
showCartPop() {
if (this.data.scanDining) {
// 扫码点餐,前往购物车页面
wx.navigateTo({
url: '/pages/cart/index',
})
} else {
this.setData({
showCartPop: !this.data.showCartPop
})
}
},
hideCartPop() {
this.setData({
showCartPop: false
})
},
async addCart1(e) {
const token = wx.getStorageSync('token')
const index = e.currentTarget.dataset.idx
const item = this.data.goods[index]
wx.showLoading({
title: '',
})
let number = item.minBuyNumber // 加入购物车的数量
if (this.data.shippingCarInfo && this.data.shippingCarInfo.items) {
const goods = this.data.shippingCarInfo.items.find(ele => { return ele.goodsId == item.id})
console.log(goods);
if (goods) {
number = 1
}
}
const res = await WXAPI.shippingCarInfoAddItem(token, item.id, number, [])
wx.hideLoading()
if (res.code == 2000) {
AUTH.login(this)
return
}
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.shippingCarInfo()
},
async skuClick(e) {
const index1 = e.currentTarget.dataset.idx1
const index2 = e.currentTarget.dataset.idx2
const curGoodsMap = this.data.curGoodsMap
curGoodsMap.properties[index1].childsCurGoods.forEach(ele => {
ele.selected = false
})
curGoodsMap.properties[index1].childsCurGoods[index2].selected = true
let skuGoodsPic = this.data.skuGoodsPic
if (curGoodsMap.subPics && curGoodsMap.subPics.length > 0) {
const _subPic = curGoodsMap.subPics.find(ele => {
return ele.optionValueId == curGoodsMap.properties[index1].childsCurGoods[index2].id
})
if (_subPic) {
skuGoodsPic = _subPic.pic
}
}
this.setData({
curGoodsMap,
skuGoodsPic
})
this.calculateGoodsPrice()
},
async calculateGoodsPrice() {
const curGoodsMap = this.data.curGoodsMap
// 计算最终的商品价格
let price = curGoodsMap.basicInfo.minPrice
let originalPrice = curGoodsMap.basicInfo.originalPrice
let totalScoreToPay = curGoodsMap.basicInfo.minScore
let buyNumMax = curGoodsMap.basicInfo.stores
let buyNumber = curGoodsMap.basicInfo.minBuyNumber
if (this.data.shopType == 'toPingtuan') {
price = curGoodsMap.basicInfo.pingtuanPrice
}
// 计算 sku 价格
const canSubmit = this.skuCanSubmit()
if (canSubmit) {
let propertyChildIds = "";
if (curGoodsMap.properties) {
curGoodsMap.properties.forEach(big => {
const small = big.childsCurGoods.find(ele => {
return ele.selected
})
propertyChildIds = propertyChildIds + big.id + ":" + small.id + ","
})
}
const res = await WXAPI.goodsPrice(curGoodsMap.basicInfo.id, propertyChildIds)
if (res.code == 0) {
price = res.data.price
if (this.data.shopType == 'toPingtuan') {
price = res.data.pingtuanPrice
}
originalPrice = res.data.originalPrice
totalScoreToPay = res.data.score
buyNumMax = res.data.stores
}
}
// 计算时段定价的价格
if (this.data.goodsTimesSchedule) {
const a = this.data.goodsTimesSchedule.find(ele => ele.active)
if (a) {
const b = a.items.find(ele => ele.active)
if (b) {
price = b.price
buyNumMax = b.stores
}
}
}
// 计算配件价格
if (this.data.goodsAddition) {
this.data.goodsAddition.forEach(big => {
big.items.forEach(small => {
if (small.active) {
price = (price*100 + small.price*100) / 100
}
})
})
}
curGoodsMap.price = price
this.setData({
curGoodsMap,
buyNumMax
});
},
async skuClick2(e) {
const propertyindex = e.currentTarget.dataset.idx1
const propertychildindex = e.currentTarget.dataset.idx2
const goodsAddition = this.data.goodsAddition
const property = goodsAddition[propertyindex]
const child = property.items[propertychildindex]
if (child.active) {
// 该操作为取消选择
child.active = false
this.setData({
goodsAddition
})
this.calculateGoodsPrice()
return
}
// 单选配件取消所有子栏目选中状态
if (property.type == 0) {
property.items.forEach(child => {
child.active = false
})
}
// 设置当前选中状态
child.active = true
this.setData({
goodsAddition
})
this.calculateGoodsPrice()
},
skuCanSubmit() {
const curGoodsMap = this.data.curGoodsMap
let canSubmit = true
if (curGoodsMap.properties) {
curGoodsMap.properties.forEach(big => {
const small = big.childsCurGoods.find(ele => {
return ele.selected
})
if (!small) {
canSubmit = false
}
})
}
if (this.data.goodsTimesSchedule) {
const a = this.data.goodsTimesSchedule.find(ele => ele.active)
if (!a) {
canSubmit = false
} else {
const b = a.items.find(ele => ele.active)
if (!b) {
canSubmit = false
}
}
}
return canSubmit
},
additionCanSubmit() {
const curGoodsMap = this.data.curGoodsMap
let canSubmit = true
if (curGoodsMap.basicInfo.hasAddition) {
this.data.goodsAddition.forEach(ele => {
if (ele.required) {
const a = ele.items.find(item => {return item.active})
if (!a) {
canSubmit = false
}
}
})
}
return canSubmit
},
async addCart2() {
const token = wx.getStorageSync('token')
const curGoodsMap = this.data.curGoodsMap
const canSubmit = this.skuCanSubmit()
const additionCanSubmit = this.additionCanSubmit()
if (!canSubmit || !additionCanSubmit) {
wx.showToast({
title: this.data.$t.goodsDetail.noSelectSku,
icon: 'none'
})
return
}
const sku = []
if (curGoodsMap.properties) {
curGoodsMap.properties.forEach(big => {
const small = big.childsCurGoods.find(ele => {
return ele.selected
})
sku.push({
optionId: big.id,
optionValueId: small.id
})
})
}
const goodsAddition = []
if (this.data.goodsAddition) {
this.data.goodsAddition.forEach(ele => {
ele.items.forEach(item => {
if (item.active) {
goodsAddition.push({
id: item.id,
pid: item.pid
})
}
})
})
}
wx.showLoading({
title: '',
})
const d = {
token,
goodsId: curGoodsMap.basicInfo.id,
number: curGoodsMap.number,
sku: sku && sku.length > 0 ? JSON.stringify(sku) : '',
addition: goodsAddition && goodsAddition.length > 0 ? JSON.stringify(goodsAddition) : '',
}
if (this.data.goodsTimesSchedule) {
const a = this.data.goodsTimesSchedule.find(ele => ele.active)
if (a) {
const b = a.items.find(ele => ele.active)
if (b) {
d.goodsTimesDay = a.day
d.goodsTimesItem = b.name
}
}
}
const res = await WXAPI.shippingCarInfoAddItemV2(d)
wx.hideLoading()
if (res.code == 2000) {
this.hideGoodsDetailPOP()
AUTH.login(this)
return
}
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.hideGoodsDetailPOP()
this.shippingCarInfo()
},
async cartStepChange(e) {
const token = wx.getStorageSync('token')
const index = e.currentTarget.dataset.idx
const item = this.data.shippingCarInfo.items[index]
if (e.detail < 1) {
// 删除商品
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfoRemoveItem(token, item.key)
wx.hideLoading()
if (res.code == 700) {
this.setData({
shippingCarInfo: null,
showCartPop: false
})
} else if (res.code == 0) {
this.setData({
shippingCarInfo: res.data
})
} else {
this.setData({
shippingCarInfo: null,
showCartPop: false
})
}
this.processBadge()
} else {
// 修改数量
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfoModifyNumber(token, item.key, e.detail)
wx.hideLoading()
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.shippingCarInfo()
}
},
goodsStepChange(e) {
const curGoodsMap = this.data.curGoodsMap
curGoodsMap.number = e.detail
this.setData({
curGoodsMap
})
},
async clearCart() {
wx.showLoading({
title: '',
})
const res = await WXAPI.shippingCarInfoRemoveAll(wx.getStorageSync('token'))
wx.hideLoading()
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.shippingCarInfo()
},
async showGoodsDetailPOP(e) {
const index = e.currentTarget.dataset.idx
const goodsId = this.data.goods[index].id
this._showGoodsDetailPOP(goodsId)
this.goodsAddition(goodsId)
this._goodsTimesSchedule(goodsId)
},
async _showGoodsDetailPOP(goodsId) {
const token = wx.getStorageSync('token')
const res = await WXAPI.goodsDetail(goodsId)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.hideTabBar()
res.data.price = res.data.basicInfo.minPrice
res.data.number = res.data.basicInfo.minBuyNumber
const _data = {
curGoodsMap: res.data,
skuGoodsPic: res.data.basicInfo.pic,
pingtuan_open_id: null,
lijipingtuanbuy: false
}
if (res.data.basicInfo.pingtuan) {
_data.showPingtuanPop = true
_data.showGoodsDetailPOP = false
// 获取拼团设置
const resPintuanSet = await WXAPI.pingtuanSet(goodsId)
if (resPintuanSet.code != 0) {
_data.showPingtuanPop = false
_data.showGoodsDetailPOP = true
wx.showToast({
title: this.data.$t.index.pingtuanNoOpen,
icon: 'none'
})
return
} else {
_data.pintuanSet = resPintuanSet.data
// 是否是别人分享的团进来的
if (this.data.share_goods_id && this.data.share_goods_id == goodsId && this.data.share_pingtuan_open_id) {
// 分享进来的
_data.pingtuan_open_id = this.data.share_pingtuan_open_id
} else {
// 不是通过分享进来的
const resPintuanOpen = await WXAPI.pingtuanOpen(token, goodsId)
if (resPintuanOpen.code == 2000) {
AUTH.login(this)
return
}
if (resPintuanOpen.code != 0) {
wx.showToast({
title: resPintuanOpen.msg,
icon: 'none'
})
return
}
_data.pingtuan_open_id = resPintuanOpen.data.id
}
// 读取拼团记录
const helpUsers = []
for (let i = 0; i < _data.pintuanSet.numberOrder; i++) {
helpUsers[i] = '/images/who.png'
}
_data.helpNumers = 0
const resPingtuanJoinUsers = await WXAPI.pingtuanJoinUsers(_data.pingtuan_open_id)
if (resPingtuanJoinUsers.code == 700 && this.data.share_pingtuan_open_id) {
this.data.share_pingtuan_open_id = null
this._showGoodsDetailPOP(goodsId)
return
}
if (resPingtuanJoinUsers.code == 0) {
_data.helpNumers = resPingtuanJoinUsers.data.length
resPingtuanJoinUsers.data.forEach((ele, index) => {
if (_data.pintuanSet.numberOrder > index) {
helpUsers.splice(index, 1, ele.apiExtUserHelp.avatarUrl)
}
})
}
_data.helpUsers = helpUsers
}
} else {
_data.showPingtuanPop = false
_data.showGoodsDetailPOP = true
}
this.setData(_data)
},
hideGoodsDetailPOP() {
this.setData({
showGoodsDetailPOP: false,
showPingtuanPop: false
})
if (!this.data.scanDining) {
wx.showTabBar()
}
},
goPay() {
if (this.data.scanDining) {
// 扫码点餐,前往购物车
wx.navigateTo({
url: '/pages/cart/index',
})
} else {
wx.navigateTo({
url: '/pages/pay/index',
})
}
},
onShareAppMessage: function() {
let uid = wx.getStorageSync('uid')
if (!uid) {
uid = ''
}
let path = '/pages/index/index?inviter_id=' + uid
if (this.data.pingtuan_open_id) {
path = path + '&share_goods_id=' + this.data.curGoodsMap.basicInfo.id + '&share_pingtuan_open_id=' + this.data.pingtuan_open_id
}
return {
title: '"' + wx.getStorageSync('mallName') + '" ' + wx.getStorageSync('share_profile'),
path
}
},
couponOverlayClick() {
this.setData({
showCouponPop: false
})
},
couponImageClick() {
wx.navigateTo({
url: '/pages/coupons/index',
})
},
async noticeLastOne() {
const res = await WXAPI.noticeLastOne()
if (res.code == 0) {
this.setData({
noticeLastOne: res.data
})
}
},
goNotice(e) {
const id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/notice/detail?id=' + id,
})
},
async banners() {
// https://www.yuque.com/apifm/nu0f75/ms21ki
const res = await WXAPI.banners({
type: 'diancang'
})
if (res.code == 0) {
this.setData({
banners: res.data
})
}
},
tapBanner(e) {
const url = e.currentTarget.dataset.url
if (url) {
wx.navigateTo({
url
})
}
},
checkIsOpened(openingHours) {
if (!openingHours) {
return true
}
const date = new Date();
const startTime = openingHours.split('-')[0]
const endTime = openingHours.split('-')[1]
const dangqian=date.toLocaleTimeString('chinese',{hour12:false})
const dq=dangqian.split(":")
const a = startTime.split(":")
const b = endTime.split(":")
const dqdq=date.setHours(dq[0],dq[1])
const aa=date.setHours(a[0],a[1])
const bb=date.setHours(b[0],b[1])
if (a[0]*1 > b[0]*1) {
// 说明是到第二天
return !this.checkIsOpened(endTime + '-' + startTime)
}
return aa {
const small = big.childsCurGoods.find(ele => {
return ele.selected
})
sku.push({
optionId: big.id,
optionValueId: small.id,
optionName: big.name,
optionValueName: small.name
})
})
}
const additions = []
if (curGoodsMap.basicInfo.hasAddition) {
this.data.goodsAddition.forEach(ele => {
ele.items.forEach(item => {
if (item.active) {
additions.push({
id: item.id,
pid: item.pid,
pname: ele.name,
name: item.name
})
}
})
})
}
const pingtuanGoodsList = []
pingtuanGoodsList.push({
goodsId: curGoodsMap.basicInfo.id,
number: curGoodsMap.number,
categoryId: curGoodsMap.basicInfo.categoryId,
shopId: curGoodsMap.basicInfo.shopId,
price: curGoodsMap.price,
score: curGoodsMap.basicInfo.score,
pic: curGoodsMap.basicInfo.pic,
name: curGoodsMap.basicInfo.name,
minBuyNumber: curGoodsMap.basicInfo.minBuyNumber,
logisticsId: curGoodsMap.basicInfo.logisticsId,
sku,
additions
})
wx.setStorageSync('pingtuanGoodsList', pingtuanGoodsList)
// 跳转
wx.navigateTo({
url: '/pages/pay/index?orderType=buyNow&pingtuanOpenId=' + this.data.pingtuan_open_id,
})
},
_lijipingtuanbuy2() {
this.data.share_pingtuan_open_id = null
this._showGoodsDetailPOP(this.data.curGoodsMap.basicInfo.id)
},
async goodsAddition(goodsId){
const res = await WXAPI.goodsAddition(goodsId)
if (res.code == 0) {
this.setData({
goodsAddition: res.data
})
} else {
this.setData({
goodsAddition: null
})
}
},
tabbarChange(e) {
if (e.detail == 1) {
wx.navigateTo({
url: '/pages/cart/index',
})
}
if (e.detail == 2) {
wx.navigateTo({
url: '/pages/cart/order',
})
}
},
// 显示分类和商品数量徽章
processBadge() {
const categories = this.data.categories
const goods = this.data.goods
const shippingCarInfo = this.data.shippingCarInfo
if (!categories) {
return
}
if (!goods) {
return
}
categories.forEach(ele => {
ele.badge = 0
})
goods.forEach(ele => {
ele.badge = 0
})
if (shippingCarInfo) {
shippingCarInfo.items.forEach(ele => {
if (ele.categoryId) {
const category = categories.find(a => {
return a.id == ele.categoryId
})
if (category) {
category.badge += ele.number
}
}
if (ele.goodsId) {
const _goods = goods.find(a => {
return a.id == ele.goodsId
})
if (_goods) {
_goods.badge += ele.number
}
}
})
}
this.setData({
categories,
goods
})
},
selectshop() {
wx.navigateTo({
url: '/pages/shop/select?type=index',
})
},
goGoodsDetail(e) {
const index = e.currentTarget.dataset.idx
const goodsId = this.data.goods[index].id
wx.navigateTo({
url: '/pages/goods-details/index?id=' + goodsId,
})
},
async _goodsTimesSchedule(goodsId) {
const res = await WXAPI.goodsTimesSchedule(goodsId, '') // todo sku
if (res.code == 0) {
const goodsTimesSchedule = res.data
res.data.forEach(ele => {
ele.active = false
})
goodsTimesSchedule[0].active = true
goodsTimesSchedule[0].items[0].active = true
this.setData({
goodsTimesSchedule
})
this.calculateGoodsPrice()
} else {
this.setData({
goodsTimesSchedule: null
})
}
},
async skuClick3(e) {
const propertyindex = e.currentTarget.dataset.idx1
const propertychildindex = e.currentTarget.dataset.idx2
const goodsTimesSchedule = this.data.goodsTimesSchedule
const property = goodsTimesSchedule[propertyindex]
const child = property.items[propertychildindex]
if (child.stores <= 0) {
wx.showToast({
title: this.data.$t.goodsDetail.noStores,
icon: 'none'
})
return
}
goodsTimesSchedule.forEach(a => {
a.active = false
a.items.forEach(b => {
b.active = false
})
})
property.active = true
child.active = true
this.setData({
goodsTimesSchedule
})
this.calculateGoodsPrice()
},
changeLang() {
getApp().changeLang(this)
},
waimai() {
wx.clearStorageSync()
wx.showTabBar()
wx.reLaunch({
url: '/pages/index/index',
})
},
})
================================================
FILE: pages/index/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/index/index.wxml
================================================
{{shopInfo.name}}
{{ $t.index.pickup }}
{{ $t.index.Delivery }}
{{shopInfo.distance}}km
{{ $t.index.shopDetail }}
{{ $t.index.minPrice }} {{ item.kanjiaPrice }}
{{ item.characteristic }}
{{ $t.goodsDetail.storeing }}
{{ $t.index.noStart }}
{{ $t.index.miaoshaEnd }}
{{ $t.goodsDetail.kanjia }}
{{ $t.index.pingtuan }}
{{ $t.index.selectSku }}
{{ $t.cart.title }}
{{shippingCarInfo.number}}
¥{{shippingCarInfo.price}}
{{ $t.index.submit }}
{{ $t.index.selectShop }}
{{ $t.index.noBusiness }}
{{curGoodsMap.basicInfo.name}}
{{item.name}}
{{small.name}}
{{item.name}}
{{small.name}}
{{item.day}}
{{small.name}}
{{ $t.goodsDetail.title }}
¥{{curGoodsMap.price}}
{{ $t.index.pingtuan }}
{{ $t.goodsDetail.addCartBtn }}
{{ $t.cart.clear }}
{{item.name}}
{{_sku.optionValueName}}
{{option.name}}
{{ item.goodsTimesDay }} {{ item.goodsTimesItem }}
¥{{ item.price }}
{{curGoodsMap.basicInfo.name}}
¥{{curGoodsMap.basicInfo.pingtuanPrice}}
{{ $t.goodsDetail.originalPrice }} ¥{{curGoodsMap.basicInfo.minPrice}}
{{pintuanSet.numberOrder}}{{ $t.index.p_persion }} / {{ $t.index.p_numsuc }}{{curGoodsMap.basicInfo.numberSells}}
{{ $t.index.remain }}{{pintuanSet.numberOrder - helpNumers}}{{ $t.index.remainToSuccess }}
{{ $t.index.pingSuccess }}
{{ $t.index.originalPriceBuy }}
{{ $t.index.pingtuan }}
{{ $t.index.openNewPingtuan }}
{{ $t.index.pingtuanProcess }}
{{ $t.index.step1 }}
{{ $t.index.step2 }}
{{ $t.index.step3 }}
{{ $t.index.step4 }}
{{ $t.index.order }}
{{ $t.cart.title }}
{{ $t.index.ordered }}
{{ $t.index.Delivery }}
================================================
FILE: pages/index/index.wxss
================================================
page {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
background: linear-gradient(180deg, #FAF8F5 0%, #FFFFFF 100%);
}
/* 语言切换悬浮按钮 */
.float-lang-btn {
position: fixed;
top: 64rpx;
right: 24rpx;
z-index: 9999;
width: 80rpx;
height: 80rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
border: 3rpx solid rgba(255, 255, 255, 0.8);
transition: all 0.3s ease;
backdrop-filter: blur(10rpx);
}
.float-lang-btn:active {
transform: scale(0.92);
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.15);
}
.float-lang-btn .lang-icon {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
}
.notice {
margin: 16rpx 24rpx 0;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(192, 154, 107, 0.15);
}
.box{
height: auto;
margin: 20rpx 24rpx 16rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
position: relative;
overflow: hidden;
}
.box::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4rpx;
background: linear-gradient(90deg, #C09A6B 0%, #D4A574 50%, #C09A6B 100%);
}
.shop-name{
display: flex;
justify-content: space-between;
align-items: center;
}
.shop-name .name{
font-size: 38rpx;
font-weight: 600;
color: #2C2416;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.shop-name .select{
display: flex;
align-items: center;
font-size: 26rpx;
width: 196rpx;
height: 64rpx;
border-radius: 32rpx;
background: linear-gradient(135deg, #F5F5F5 0%, #ECECEC 100%);
padding: 4rpx;
box-shadow: inset 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
}
.shop-name .select .on{
width: 94rpx;
height: 56rpx;
background: linear-gradient(135deg, #C09A6B 0%, #D4A574 100%);
color: #FFFFFF;
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-weight: 600;
box-shadow: 0 4rpx 12rpx rgba(192, 154, 107, 0.4);
transition: all 0.3s ease;
}
.shop-name .select .off{
width: 94rpx;
height: 56rpx;
color: #999999;
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
transition: all 0.3s ease;
}
.distance-bar{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 24rpx;
padding-top: 24rpx;
border-top: 1rpx solid #F0F0F0;
}
.distance-bar .distance{
font-size: 26rpx;
color: #8FB996;
font-weight: 500;
padding: 8rpx 20rpx;
background: linear-gradient(135deg, #F0F9F4 0%, #E8F5ED 100%);
border-radius: 20rpx;
}
.distance-bar .shop-message{
display: flex;
align-items: center;
color: #666666;
}
.distance-bar .shop-message .message{
font-size: 26rpx;
margin-right: 4rpx;
}
.distance-bar .shop-message .go{
height: 32rpx;
width: 32rpx;
}
.box1{
flex: 1;
display: flex;
overflow: hidden;
gap: 16rpx;
padding: 0 24rpx 24rpx;
}
.box1 .box-1{
height: 100%;
overflow-y: scroll;
width: 180rpx;
background: #FFFFFF;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
}
.box1 .box-2{
flex: 1;
height: 100%;
overflow-y: scroll;
background: #FFFFFF;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
padding: 20rpx;
}
.swiper1 {
width: 100%;
height: 260rpx;
margin-bottom: 20rpx;
border-radius: 16rpx;
overflow: hidden;
}
.swiper1 image {
width: 100%;
height: 100%;
}
.pay-btn{
background-color: #d3aa79 !important;
border-style: none !important;
}
.price-0{
color: #000000 !important;
}
.pay-btn-box{
background-color:#eeeeee !important;
}
.cart-box{
background-color:#eeeeee ;
margin-left: 50rpx;
padding: 18rpx 32rpx;
border-radius: 50rpx;
}
.goods-detail-scroll {
max-height: 80vh;
height: auto;
}
.photos-00{
height: 320rpx;
width: 320rpx;
border-radius: 24rpx;
margin: 40rpx auto 0;
display: block;
box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.15);
border: 8rpx solid #FFFFFF;
}
.title-name{
margin: 32rpx 40rpx 0;
font-size: 36rpx;
font-weight: 600;
color: #2C2416;
text-align: center;
}
.content-1{
margin: 40rpx 32rpx 0;
padding: 28rpx;
background: linear-gradient(135deg, #FAF8F5 0%, #FFFFFF 100%);
border-radius: 20rpx;
}
.content-1 .title{
font-size: 30rpx;
font-weight: 600;
color: #2C2416;
margin-bottom: 20rpx;
position: relative;
padding-left: 20rpx;
}
.content-1 .title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: linear-gradient(180deg, #C09A6B 0%, #D4A574 100%);
border-radius: 3rpx;
}
.content-1 .box-1{
display: flex;
align-items: center;
flex-wrap: wrap;
font-size: 28rpx;
gap: 16rpx;
}
.content-1 .box-1 .title-1{
background: #FFFFFF;
padding: 16rpx 28rpx;
border-radius: 40rpx;
border: 2rpx solid #E8E8E8;
color: #666666;
font-size: 28rpx;
transition: all 0.3s ease;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.content-1 .box-1 .title-1.active{
background: linear-gradient(135deg, #C09A6B 0%, #D4A574 100%);
color: #FFFFFF;
border-color: #C09A6B;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(192, 154, 107, 0.35);
transform: translateY(-2rpx);
}
.introduce{
font-size: 28rpx;
margin: 40rpx 32rpx;
padding: 28rpx;
background: linear-gradient(135deg, #FAF8F5 0%, #FFFFFF 100%);
border-radius: 20rpx;
color: #666666;
line-height: 1.8;
}
.introduce .title {
font-size: 30rpx;
font-weight: 600;
color: #2C2416;
margin-bottom: 20rpx;
}
.introduce .content{
margin-top: 16rpx;
}
.blank{
background: linear-gradient(90deg, #F5F5F5 0%, #EEEEEE 50%, #F5F5F5 100%);
height: 16rpx;
margin: 20rpx 0;
}
.add-box{
display: flex;
justify-content: space-between;
align-items: center;
margin: 40rpx 32rpx;
padding: 32rpx;
background: linear-gradient(135deg, #FAF8F5 0%, #FFFFFF 100%);
border-radius: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
}
.add-box .price {
color: #C09A6B;
font-size: 56rpx;
font-weight: 700;
letter-spacing: 1rpx;
}
.add-box .price text {
color: #C09A6B;
font-size: 32rpx;
margin-right: 4rpx;
}
.add-box .plus{
border-radius: 50rpx;
background: linear-gradient(135deg, #C09A6B 0%, #D4A574 100%);
color: #FFFFFF;
box-shadow: 0 4rpx 16rpx rgba(192, 154, 107, 0.3);
}
.add-box .minus{
border-radius: 50rpx;
background: #F5F5F5;
color: #999999;
}
.add-box .input{
background: #FFFFFF;
border: 2rpx solid #E8E8E8;
border-radius: 12rpx;
font-weight: 600;
color: #2C2416;
}
.add-cart{
padding: 0 32rpx 40rpx;
}
.add-cart .van-button {
height: 88rpx;
border-radius: 44rpx;
font-size: 34rpx;
font-weight: 600;
letter-spacing: 4rpx;
box-shadow: 0 8rpx 24rpx rgba(192, 154, 107, 0.4);
}
.empty-box{
display: flex;
align-items: center;
justify-content: center;
padding: 24rpx;
margin: 20rpx;
background: linear-gradient(135deg, #FFF5F5 0%, #FFE8E8 100%);
border-radius: 16rpx;
border: 2rpx dashed #FFCCCC;
}
.empty-box .empty-0{
height: 32rpx;
width: 32rpx;
}
.empty-box .empty-1{
font-size: 28rpx;
margin-left: 12rpx;
color: #FF6B6B;
font-weight: 500;
}
.pingtuan-bar{
margin: 40rpx 32rpx;
padding: 32rpx;
display: flex;
align-items: center;
background: linear-gradient(135deg, #FAF8F5 0%, #FFFFFF 100%);
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.08);
}
.pingtuan-bar .photos{
height: 160rpx;
width: 160rpx;
border-radius: 20rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
border: 6rpx solid #FFFFFF;
}
.pingtuan-bar .pingtuan-box{
flex: 1;
margin-left: 28rpx;
}
.pingtuan-bar .pingtuan-box .title{
font-size: 32rpx;
font-weight: 600;
color: #2C2416;
line-height: 1.4;
}
.pingtuan-bar .pingtuan-box .price{
display: flex;
align-items: center;
margin-top: 16rpx;
}
.pingtuan-bar .pingtuan-box .price .xianjia{
color: #C09A6B;
font-size: 40rpx;
font-weight: 700;
}
.pingtuan-bar .pingtuan-box .price .yuanjia{
font-size: 24rpx;
margin-left: 16rpx;
color: #999999;
text-decoration: line-through;
}
.pingtuan-bar .pingtuan-box .jilu{
font-size: 24rpx;
margin-top: 12rpx;
color: #999999;
}
.pingdan-title{
font-size: 40rpx;
font-weight: 700;
text-align: center;
color: #2C2416;
margin: 32rpx 0;
letter-spacing: 2rpx;
}
.pingtuan-photos{
display: flex;
align-items: center;
justify-content: center;
margin: 48rpx 0;
gap: 20rpx;
}
.pingtuan-photos .photos{
width: 96rpx;
height: 96rpx;
border-radius: 50%;
border: 4rpx solid #FFFFFF;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.12);
}
.botton-box{
display: flex;
justify-content: center;
gap: 24rpx;
margin: 40rpx 32rpx;
}
.botton-box .van-button {
height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
font-weight: 600;
padding: 0 48rpx;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.1);
}
.liucheng{
margin: 32rpx;
padding: 40rpx 20rpx;
display: flex;
justify-content: space-around;
background: linear-gradient(135deg, #FAF8F5 0%, #FFFFFF 100%);
border-radius: 20rpx;
}
.liucheng .liucheng-1{
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
}
.liucheng .liucheng-1 .icon{
width: 72rpx;
height: 72rpx;
padding: 16rpx;
background: linear-gradient(135deg, #FFF8F0 0%, #FFE8CC 100%);
border-radius: 50%;
box-shadow: 0 4rpx 16rpx rgba(192, 154, 107, 0.2);
}
.liucheng .liucheng-1 .content{
font-size: 24rpx;
margin-top: 16rpx;
color: #666666;
text-align: center;
}
.goods-btn {
position: absolute;
right: 20rpx;
bottom: 20rpx;
}
.cart-bar {
width: 100vw;
height: 120rpx;
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 20%, rgba(255,255,255,0.98) 100%);
backdrop-filter: blur(20rpx);
z-index: 99999;
padding: 0 24rpx;
box-shadow: 0 -4rpx 24rpx rgba(0, 0, 0, 0.08);
}
.cart-bar .l {
position: relative;
transform: scale(1.1);
transition: transform 0.3s ease;
}
.cart-bar .r {
display: flex;
align-items: center;
height: 100%;
gap: 24rpx;
}
.cart-bar .r .amount {
color: #C09A6B;
font-size: 52rpx;
font-weight: 700;
letter-spacing: 1rpx;
}
.cart-bar .r .amount text {
color: #C09A6B;
font-size: 28rpx;
margin-right: 4rpx;
}
.cart-bar .r .topay {
width: 220rpx;
height: 80rpx;
background: linear-gradient(135deg, #C09A6B 0%, #D4A574 100%);
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
border-radius: 40rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 8rpx 24rpx rgba(192, 154, 107, 0.4);
letter-spacing: 2rpx;
}
.cart-bar .r .topay.noopen {
background: linear-gradient(135deg, #CCCCCC 0%, #AAAAAA 100%);
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.15);
}
.badge {
top: 16rpx !important;
right: 28rpx !important;
background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%) !important;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.4);
font-weight: 600;
}
.cart-goods-list {
display: flex;
justify-content: space-between;
align-items: center;
padding: 28rpx 32rpx;
margin: 0 20rpx 16rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
border-radius: 16rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
border: 1rpx solid #F5F5F5;
}
.cart-goods-list .r {
display: flex;
align-items: center;
gap: 24rpx;
}
.cart-goods-list .title{
font-size: 30rpx;
font-weight: 600;
color: #2C2416;
margin-bottom: 8rpx;
}
.cart-goods-list .content{
font-size: 24rpx;
color: #999999;
margin-top: 4rpx;
}
.cart-goods-list .price{
font-size: 28rpx;
color: #C09A6B;
font-weight: 600;
}
.couponOverlay-container {
width: 100vw;
height: 100vh;
display: flex;
justify-content: space-between;
align-items: center;
}
.couponOverlay-container image {
width: 240rpx;
height: 240rpx;
margin: auto;
}
.count-downno-start .van-count-down {
color: #ed6a0c;
padding: 8rpx 0;
}
.float-btn {
position: fixed;
right: 32rpx;
bottom: 400rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 50%;
padding: 16rpx;
width: 112rpx;
height: 112rpx;
font-size: 24rpx;
color: #C09A6B;
font-weight: 600;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.15);
border: 2rpx solid #FFFFFF;
transition: all 0.3s ease;
}
.float-btn:active {
transform: scale(0.95);
}
/* Van-card 商品卡片样式覆盖 */
.van-card {
margin-bottom: 20rpx !important;
background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%) !important;
border-radius: 20rpx !important;
overflow: hidden !important;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06) !important;
padding: 20rpx !important;
border: 1rpx solid #F5F5F5 !important;
}
.van-card__thumb {
width: 180rpx !important;
height: 180rpx !important;
border-radius: 16rpx !important;
overflow: hidden !important;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08) !important;
}
.van-card__title {
font-size: 32rpx !important;
font-weight: 600 !important;
color: #2C2416 !important;
line-height: 1.4 !important;
margin-bottom: 8rpx !important;
}
.van-card__desc {
font-size: 24rpx !important;
color: #999999 !important;
margin-top: 8rpx !important;
}
.van-card__price {
font-size: 40rpx !important;
font-weight: 700 !important;
color: #C09A6B !important;
}
.van-card__origin-price {
font-size: 24rpx !important;
color: #CCCCCC !important;
}
.van-card__tag {
background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%) !important;
color: #FFFFFF !important;
border-radius: 8rpx 0 16rpx 0 !important;
font-size: 22rpx !important;
padding: 8rpx 16rpx !important;
font-weight: 600 !important;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.3);
}
/* Van-button 按钮样式覆盖 */
.van-button--round {
border-radius: 40rpx !important;
}
.van-button--small {
height: 60rpx !important;
padding: 0 32rpx !important;
font-size: 26rpx !important;
font-weight: 600 !important;
}
/* Van-notice-bar 通知栏样式 */
.van-notice-bar {
background: linear-gradient(135deg, #FFF8F0 0%, #FFE8CC 100%) !important;
color: #C09A6B !important;
border-radius: 0 !important;
font-size: 26rpx !important;
}
/* Van-popup 弹窗样式覆盖 */
.van-popup {
border-radius: 32rpx 32rpx 0 0 !important;
overflow: hidden !important;
}
.van-popup--bottom {
background: linear-gradient(180deg, #FFFFFF 0%, #FAF8F5 100%) !important;
}
/* Van-stepper 步进器样式覆盖 */
.van-stepper__input {
background: #F5F5F5 !important;
border-radius: 12rpx !important;
font-weight: 600 !important;
color: #2C2416 !important;
}
.van-stepper__plus, .van-stepper__minus {
background: linear-gradient(135deg, #C09A6B 0%, #D4A574 100%) !important;
color: #FFFFFF !important;
border-radius: 50% !important;
width: 56rpx !important;
height: 56rpx !important;
box-shadow: 0 4rpx 12rpx rgba(192, 154, 107, 0.3) !important;
}
.van-stepper__minus {
background: #F5F5F5 !important;
color: #999999 !important;
box-shadow: none !important;
}
/* Van-icon 图标颜色覆盖 */
.van-icon--add {
background: linear-gradient(135deg, #C09A6B 0%, #D4A574 100%);
border-radius: 50%;
padding: 8rpx;
box-shadow: 0 6rpx 20rpx rgba(192, 154, 107, 0.4);
}
/* Van-empty 空状态样式 */
.van-empty__description {
color: #999999 !important;
font-size: 28rpx !important;
}
================================================
FILE: pages/member-center/index.js
================================================
const WXAPI = require('apifm-wxapi')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
totleConsumed: 0
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.vip.title,
})
this.userLevelList()
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
getApp().getUserDetailOK = (apiUserInfoMap) => {
this.processGotUserDetail(apiUserInfoMap)
}
},
onShow: function () {
},
async processGotUserDetail(apiUserInfoMap) {
if (!apiUserInfoMap) {
return
}
this.setData({
apiUserInfoMap
})
this.userAmount()
},
async userAmount() {
// https://www.yuque.com/apifm/nu0f75/wrqkcb
const res = await WXAPI.userAmount(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
totleConsumed: res.data.totleConsumed
});
}
},
async userLevelList() {
// https://www.yuque.com/apifm/nu0f75/fsh4gu
const res = await WXAPI.userLevelList()
if (res.code == 0) {
this.setData({
levelList: res.data.result
});
}
},
})
================================================
FILE: pages/member-center/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/member-center/index.wxml
================================================
{{apiUserInfoMap.base.nick}}
{{ $t.vip.consumption }}
¥{{totleConsumed}}
👑
{{apiUserInfoMap.userLevel.name}}
✨
{{ $t.vip.notVIP }}
{{ $t.vip.tip }}
等级
{{item.name}}
折扣
{{item.rebate}}
消费额
¥{{item.upgradeAmount}}
================================================
FILE: pages/member-center/index.wxss
================================================
/* 页面容器 */
.member-container {
min-height: 100vh;
background: linear-gradient(180deg, #FFF5EB 0%, #FFFFFF 100%);
padding-bottom: 40rpx;
}
/* 顶部装饰波浪 */
.top-wave {
height: 120rpx;
background: linear-gradient(135deg, #E8C4A0 0%, #D4A574 100%);
border-radius: 0 0 50% 50%;
position: relative;
}
/* 会员卡片 */
.member-card {
margin: -60rpx 30rpx 0;
background: linear-gradient(135deg, #E8C4A0 0%, #D4A574 50%, #C89968 100%);
border-radius: 24rpx;
padding: 40rpx 30rpx;
box-shadow: 0 16rpx 40rpx rgba(212, 165, 116, 0.3);
position: relative;
overflow: hidden;
}
/* 卡片背景装饰 */
.card-bg-decoration {
position: absolute;
top: -50rpx;
right: -50rpx;
width: 300rpx;
height: 300rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
border-radius: 50%;
}
.card-content {
position: relative;
z-index: 1;
}
/* 用户信息区域 */
.user-info {
display: flex;
align-items: center;
margin-bottom: 40rpx;
}
/* 头像盒子 */
.avatar-box {
position: relative;
margin-right: 24rpx;
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 4rpx solid rgba(255, 255, 255, 0.9);
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.1);
}
.avatar-ring {
position: absolute;
top: -6rpx;
left: -6rpx;
width: 132rpx;
height: 132rpx;
border-radius: 50%;
border: 2rpx solid rgba(255, 255, 255, 0.5);
}
/* 用户详情 */
.user-detail {
flex: 1;
}
.user-name {
font-size: 36rpx;
font-weight: 700;
color: #FFFFFF;
margin-bottom: 12rpx;
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.user-consumption {
display: flex;
align-items: baseline;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.95);
}
.consumption-label {
margin-right: 8rpx;
}
.consumption-value {
font-size: 32rpx;
font-weight: 600;
color: #FFF;
}
/* 会员等级盒子 */
.member-level-box {
text-align: center;
padding-top: 30rpx;
border-top: 1rpx solid rgba(255, 255, 255, 0.3);
}
.level-badge {
display: inline-flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(10rpx);
padding: 16rpx 40rpx;
border-radius: 50rpx;
margin-bottom: 16rpx;
}
.level-icon {
font-size: 40rpx;
margin-right: 12rpx;
}
.level-name {
font-size: 38rpx;
font-weight: 700;
color: #FFFFFF;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
.level-normal {
background: rgba(255, 255, 255, 0.2);
}
.level-tip {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.9);
line-height: 1.6;
}
/* 权益说明区域 */
.benefits-section {
margin: 40rpx 30rpx;
}
/* 区域标题 */
.section-header {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 32rpx;
}
.header-line {
width: 80rpx;
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #D4A574 100%);
}
.header-line:last-child {
background: linear-gradient(90deg, #D4A574 0%, transparent 100%);
}
.section-title {
font-size: 36rpx;
font-weight: 700;
color: #8B5A3C;
margin: 0 20rpx;
position: relative;
}
/* 表头 */
.benefits-table-header {
display: flex;
background: linear-gradient(135deg, #D4A574 0%, #C89968 100%);
border-radius: 16rpx 16rpx 0 0;
padding: 24rpx 20rpx;
box-shadow: 0 4rpx 12rpx rgba(212, 165, 116, 0.2);
}
.table-header-item {
flex: 1;
text-align: center;
font-size: 28rpx;
font-weight: 600;
color: #FFFFFF;
}
/* 等级卡片列表 */
.level-cards {
background: #FFFFFF;
border-radius: 0 0 16rpx 16rpx;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
}
.level-card-item {
position: relative;
border-bottom: 1rpx solid #F5F5F5;
overflow: hidden;
}
.level-card-item:last-child {
border-bottom: none;
}
.level-card-item:nth-child(odd) {
background: linear-gradient(90deg, #FFFBF7 0%, #FFFFFF 100%);
}
/* 等级卡片背景装饰 */
.level-card-bg {
position: absolute;
right: -20rpx;
top: 50%;
transform: translateY(-50%);
width: 120rpx;
height: 120rpx;
background: radial-gradient(circle, rgba(212, 165, 116, 0.05) 0%, transparent 70%);
border-radius: 50%;
}
.level-info {
display: flex;
padding: 32rpx 20rpx;
position: relative;
z-index: 1;
}
.level-col {
flex: 1;
text-align: center;
}
.level-col-highlight {
position: relative;
}
.level-col-highlight::before {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 140rpx;
height: 100rpx;
background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 152, 0, 0.1) 100%);
border-radius: 12rpx;
z-index: -1;
}
.level-label {
font-size: 22rpx;
color: #999999;
margin-bottom: 8rpx;
}
.level-value {
font-size: 30rpx;
font-weight: 600;
color: #333333;
}
.level-name-text {
color: #8B5A3C;
font-weight: 700;
}
.discount-text {
font-size: 36rpx;
color: #FF9800;
font-weight: 700;
}
/* 底部说明 */
.footer-remark {
margin: 40rpx 30rpx;
padding: 24rpx 30rpx;
background: #FFFFFF;
border-radius: 16rpx;
border-left: 6rpx solid #D4A574;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
display: flex;
align-items: flex-start;
}
.remark-icon {
font-size: 32rpx;
margin-right: 12rpx;
line-height: 1;
}
.remark-text {
flex: 1;
font-size: 24rpx;
color: #666666;
line-height: 1.8;
}
================================================
FILE: pages/my/feedback.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
autosize: {
minHeight: 100
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.feedback.title,
})
},
onShow: function() {
},
async bindSave() {
if (!this.data.name) {
wx.showToast({
title: this.data.$t.feedback.nameRequired,
icon: 'none',
})
return
}
if (!this.data.content) {
wx.showToast({
title: this.data.$t.feedback.contentRequired,
icon: 'none',
})
return
}
const extJsonStr = {}
extJsonStr['姓名'] = this.data.name
extJsonStr['联系电话'] = this.data.mobile || ''
// 批量上传附件
if (this.data.picsList) {
for (let index = 0; index < this.data.picsList.length; index++) {
const pic = this.data.picsList[index];
const res = await WXAPI.uploadFileV2(wx.getStorageSync('token'), pic.url)
if (res.code == 0) {
extJsonStr['file' + index] = res.data.url
}
}
}
const res = await WXAPI.addComment({
token: wx.getStorageSync('token'),
type: 1,
extJsonStr: JSON.stringify(extJsonStr),
content: this.data.content
})
if (res.code == 0) {
wx.showToast({
title: this.data.$t.common.submitSuccess,
})
setTimeout(() => {
wx.navigateBack({
delta: 0,
})
}, 1000);
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
},
afterPicRead(e) {
let picsList = this.data.picsList
if (!picsList) {
picsList = []
}
picsList = picsList.concat(e.detail.file)
this.setData({
picsList
})
},
afterPicDel(e) {
let picsList = this.data.picsList
picsList.splice(e.detail.index, 1)
this.setData({
picsList
})
}
})
================================================
FILE: pages/my/feedback.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/my/feedback.wxml
================================================
👤
{{ $t.feedback.name }}
📱
{{ $t.feedback.mobile }}
✍️
反馈内容
📷
{{ $t.feedback.imageOrVideo }}
(选填)
💡
温馨提示
我们会认真对待每一条反馈,并在24小时内给予回复
提交反馈
→
================================================
FILE: pages/my/feedback.wxss
================================================
/* 页面整体容器 */
page {
background: linear-gradient(135deg, #FFF5E6 0%, #FFE4D6 50%, #FFD4C4 100%);
min-height: 100vh;
}
.feedback-container {
min-height: 100vh;
padding: 0 30rpx 60rpx;
position: relative;
}
/* 顶部装饰波浪 */
.header-wave {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 180rpx;
background: linear-gradient(135deg, #D4A574 0%, #C49563 100%);
border-radius: 0 0 50% 50%;
opacity: 0.15;
}
/* 页面头部 */
.feedback-header {
padding-top: 60rpx;
padding-bottom: 40rpx;
text-align: center;
position: relative;
z-index: 1;
}
.header-icon {
font-size: 80rpx;
margin-bottom: 20rpx;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10rpx); }
}
.header-title {
font-size: 48rpx;
font-weight: bold;
color: #8B5A3C;
margin-bottom: 16rpx;
letter-spacing: 2rpx;
}
.header-subtitle {
font-size: 24rpx;
color: #A67C52;
opacity: 0.9;
}
/* 表单卡片 */
.feedback-card {
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF5 100%);
border-radius: 32rpx;
padding: 40rpx 32rpx;
margin-bottom: 30rpx;
box-shadow: 0 12rpx 48rpx rgba(212, 165, 116, 0.15),
0 4rpx 16rpx rgba(196, 149, 99, 0.08);
position: relative;
overflow: hidden;
}
.feedback-card::before {
content: '';
position: absolute;
top: -50rpx;
right: -50rpx;
width: 200rpx;
height: 200rpx;
background: linear-gradient(135deg, #FFE4D6 0%, #FFD4C4 100%);
border-radius: 50%;
opacity: 0.3;
}
/* 输入区域 */
.input-section {
margin-bottom: 32rpx;
position: relative;
}
.input-section:last-child {
margin-bottom: 0;
}
.input-label {
display: flex;
align-items: center;
margin-bottom: 20rpx;
padding-left: 8rpx;
}
.label-icon {
font-size: 32rpx;
margin-right: 12rpx;
}
.label-text {
font-size: 28rpx;
color: #8B5A3C;
font-weight: 600;
}
.label-tip {
font-size: 22rpx;
color: #C49563;
margin-left: 8rpx;
}
/* 自定义输入框样式 */
.custom-field {
background: #FFF9F0 !important;
border-radius: 16rpx !important;
padding: 24rpx 20rpx !important;
font-size: 28rpx !important;
color: #333 !important;
border: 2rpx solid #FFE4D6 !important;
transition: all 0.3s ease;
}
.custom-field:focus {
border-color: #D4A574 !important;
box-shadow: 0 0 0 4rpx rgba(212, 165, 116, 0.1) !important;
}
.custom-textarea {
background: #FFF9F0 !important;
border-radius: 16rpx !important;
padding: 24rpx 20rpx !important;
font-size: 28rpx !important;
color: #333 !important;
min-height: 200rpx !important;
border: 2rpx solid #FFE4D6 !important;
transition: all 0.3s ease;
}
/* 分割线 */
.divider {
height: 1rpx;
background: linear-gradient(90deg, transparent 0%, #FFE4D6 50%, transparent 100%);
margin: 32rpx 0;
}
/* 内容区域 */
.content-section {
margin-bottom: 32rpx;
}
/* 上传区域 */
.upload-section {
margin-top: 32rpx;
}
.uploader-wrapper {
margin-top: 20rpx;
padding: 20rpx;
background: #FFF9F0;
border-radius: 16rpx;
border: 2rpx dashed #FFE4D6;
}
/* 温馨提示卡片 */
.tips-card {
background: linear-gradient(135deg, #FFF9F0 0%, #FFF5E6 100%);
border-radius: 24rpx;
padding: 28rpx 32rpx;
margin-bottom: 40rpx;
display: flex;
align-items: flex-start;
border-left: 6rpx solid #D4A574;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.08);
}
.tips-icon {
font-size: 36rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.tips-content {
flex: 1;
}
.tips-title {
font-size: 26rpx;
color: #8B5A3C;
font-weight: 600;
margin-bottom: 8rpx;
}
.tips-text {
font-size: 22rpx;
color: #A67C52;
line-height: 1.6;
}
/* 提交按钮 */
.submit-wrapper {
padding: 20rpx 0;
}
.submit-btn {
background: linear-gradient(135deg, #D4A574 0%, #C49563 100%);
border-radius: 50rpx;
padding: 32rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 16rpx 48rpx rgba(212, 165, 116, 0.35),
0 8rpx 24rpx rgba(196, 149, 99, 0.2);
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
.submit-btn::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
transform: rotate(45deg);
animation: shimmer 3s infinite;
}
@keyframes shimmer {
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
.submit-btn:active {
transform: scale(0.98);
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.25);
}
.btn-text {
font-size: 32rpx;
color: #FFFFFF;
font-weight: bold;
letter-spacing: 4rpx;
margin-right: 12rpx;
}
.btn-icon {
font-size: 32rpx;
color: #FFFFFF;
font-weight: bold;
animation: arrow-move 1.5s infinite;
}
@keyframes arrow-move {
0%, 100% { transform: translateX(0); }
50% { transform: translateX(8rpx); }
}
/* 底部装饰 */
.footer-decoration {
position: fixed;
bottom: 40rpx;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 12rpx;
z-index: 0;
pointer-events: none;
}
.decoration-circle {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: #D4A574;
opacity: 0.3;
}
.circle-1 { animation: pulse 2s infinite 0s; }
.circle-2 { animation: pulse 2s infinite 0.3s; }
.circle-3 { animation: pulse 2s infinite 0.6s; }
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.3; }
50% { transform: scale(1.5); opacity: 0.6; }
}
/* 覆盖 vant 组件样式 */
.van-field__control {
color: #333 !important;
}
.van-field__placeholder {
color: #C49563 !important;
}
.van-uploader__upload {
background: linear-gradient(135deg, #FFF9F0 0%, #FFF5E6 100%) !important;
border: 2rpx dashed #D4A574 !important;
border-radius: 16rpx !important;
}
.van-uploader__preview-image {
border-radius: 16rpx !important;
}
.van-uploader__upload-icon {
color: #D4A574 !important;
}
.van-uploader__upload-text {
color: #A67C52 !important;
font-size: 22rpx !important;
}
================================================
FILE: pages/my/index.js
================================================
const CONFIG = require('../../config.js')
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
couponStatistics: {
canUse: 0
},
balance: 0.00,
score: 0,
nick: undefined,
},
onLoad() {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.my.title,
})
this.setData({
myBg: wx.getStorageSync('myBg'),
version: CONFIG.version,
customerServiceType: CONFIG.customerServiceType
})
getApp().getUserDetailOK = (apiUserInfoMap) => {
this.processGotUserDetail(apiUserInfoMap)
}
},
onShow() {
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
},
async processGotUserDetail(apiUserInfoMap) {
if (!apiUserInfoMap) {
return
}
const order_hx_uids = wx.getStorageSync('order_hx_uids')
const _data = {}
_data.apiUserInfoMap = apiUserInfoMap
_data.nick = apiUserInfoMap.base.nick
if (order_hx_uids && order_hx_uids.indexOf(apiUserInfoMap.base.id) != -1) {
_data.canHX = true // 具有扫码核销的权限
}
const admin_uids = wx.getStorageSync('admin_uids')
if (admin_uids && admin_uids.indexOf(apiUserInfoMap.base.id) != -1) {
_data.isAdmin = true
}
this.setData(_data)
this.getUserAmount()
this.couponStatistics()
},
async couponStatistics() {
const res = await WXAPI.couponStatistics(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
couponStatistics: res.data
})
}
},
async getUserAmount() {
const res = await WXAPI.userAmount(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
balance: res.data.balance,
score: res.data.score
})
}
},
scanOrderCode(){
wx.scanCode({
onlyFromCamera: true,
success(res) {
wx.navigateTo({
url: '/pages/order-details/scan-result?hxNumber=' + res.result,
})
},
fail(err) {
console.error(err)
wx.showToast({
title: err.errMsg,
icon: 'none'
})
}
})
},
goCoupons() {
wx.navigateTo({
url: '/pages/coupons/index?tabIndex=1',
})
},
goBalance() {
wx.navigateTo({
url: '/pages/asset/index',
})
},
goScorelog() {
wx.navigateTo({
url: '/pages/score/logs',
})
},
goadmin() {
wx.navigateToMiniProgram({
appId: 'wx5e5b0066c8d3f33d',
path: 'pages/autoLogin?token=' + wx.getStorageSync('token'),
})
},
clearStorage() {
wx.clearStorageSync()
wx.reLaunch({
url: '/pages/index/index',
})
},
govip() {
wx.navigateTo({
url: '/pages/member-center/index',
})
},
editNick() {
this.setData({
nickShow: true
})
},
async _editNick() {
if (!this.data.nick) {
wx.showToast({
title: this.data.$t.my.nickRequired,
icon: 'none'
})
return
}
const postData = {
token: wx.getStorageSync('token'),
nick: this.data.nick,
}
// https://www.yuque.com/apifm/nu0f75/ykr2zr
const res = await WXAPI.modifyUserInfoV2(postData)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.showToast({
title: this.data.$t.common.submitSuccess,
})
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
},
async onChooseAvatar(e) {
console.log(e);
const avatarUrl = e.detail.avatarUrl
let res = await WXAPI.uploadFileV2(wx.getStorageSync('token'), avatarUrl)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
// https://www.yuque.com/apifm/nu0f75/ykr2zr
res = await WXAPI.modifyUserInfoV2({
token: wx.getStorageSync('token'),
avatarUrl: res.data.url,
})
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.showToast({
title: this.data.$t.common.submitSuccess,
})
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
},
goUserCode() {
wx.navigateTo({
url: '/pages/my/user-code',
})
},
customerService() {
wx.openCustomerServiceChat({
extInfo: {url: wx.getStorageSync('customerServiceChatUrl')},
corpId: wx.getStorageSync('customerServiceChatCorpId'),
success: res => {},
fail: err => {
console.error(err)
}
})
},
copyuid() {
wx.setClipboardData({
data: this.data.apiUserInfoMap.base.id + ''
})
},
})
================================================
FILE: pages/my/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/my/index.wxml
================================================
{{couponStatistics.canUse}}
{{ $t.coupons.title }}
¥
{{balance}}
{{ $t.order.balance }}
{{score}}
{{ $t.my.score }}
v{{version}}
================================================
FILE: pages/my/index.wxss
================================================
/* 页面容器 */
.page-container {
min-height: 100vh;
background: linear-gradient(180deg, #FFF5E6 0%, #FFFFFF 50%);
padding-bottom: 40rpx;
}
/* ==================== 顶部区域 ==================== */
.header-section {
position: relative;
width: 100%;
height: 280rpx;
overflow: hidden;
}
.header-bg {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
filter: blur(20rpx);
opacity: 0.9;
z-index: 9;
}
.header-gradient {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(135deg,
rgba(245, 222, 179, 0.9) 0%,
rgba(210, 180, 140, 0.85) 50%,
rgba(139, 115, 85, 0.8) 100%
);
}
/* ==================== 用户信息卡片 ==================== */
.user-card {
position: absolute;
bottom: 32rpx;
left: 32rpx;
right: 32rpx;
background: #FFFFFF;
border-radius: 32rpx;
padding: 40rpx 32rpx;
box-shadow: 0 8rpx 32rpx rgba(139, 115, 85, 0.15);
z-index: 10;
}
.user-info-row {
display: flex;
align-items: center;
justify-content: space-between;
}
/* 头像区域 */
.avatar-section {
position: relative;
margin-right: 24rpx;
}
.avatar-btn {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
padding: 0;
margin: 0;
background: transparent;
border: none;
overflow: visible;
position: relative;
z-index: 2;
}
.avatar-btn::after {
border: none;
}
.avatar-img {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
border: 6rpx solid #FFFFFF;
box-shadow: 0 4rpx 16rpx rgba(139, 115, 85, 0.2);
}
.avatar-ring {
position: absolute;
top: -6rpx;
left: -6rpx;
width: 152rpx;
height: 152rpx;
border-radius: 50%;
border: 3rpx solid transparent;
background: linear-gradient(135deg, #FFD700, #FFA500, #FF8C00);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
padding: 3rpx;
animation: rotate 3s linear infinite;
z-index: 1;
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* 用户详情 */
.user-details {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.nickname {
font-size: 36rpx;
font-weight: 600;
color: #333333;
margin-bottom: 8rpx;
max-width: 300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.uid-row {
display: flex;
align-items: center;
margin-bottom: 12rpx;
}
.uid-label {
font-size: 24rpx;
color: #999999;
margin-right: 8rpx;
}
.uid-value {
font-size: 24rpx;
color: #666666;
font-family: 'Courier New', monospace;
}
.vip-badge {
display: inline-block;
padding: 8rpx 20rpx;
background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
border-radius: 20rpx;
align-self: flex-start;
}
.vip-text {
font-size: 22rpx;
color: #FFFFFF;
font-weight: 500;
letter-spacing: 1rpx;
}
/* 二维码区域 */
.qr-section {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 8rpx 16rpx;
}
.qr-icon-wrapper {
width: 72rpx;
height: 72rpx;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE4B5 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 8rpx;
box-shadow: 0 4rpx 12rpx rgba(139, 115, 85, 0.15);
}
.qr-text {
font-size: 22rpx;
color: #8B7355;
font-weight: 500;
}
/* ==================== 资产卡片区域 ==================== */
.assets-section {
margin: 96rpx 32rpx 32rpx;
display: flex;
gap: 20rpx;
justify-content: space-between;
}
.asset-card {
flex: 1;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx 20rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.asset-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6rpx;
background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
opacity: 0;
transition: opacity 0.3s ease;
}
.asset-card:active::before {
opacity: 1;
}
.highlight-card {
background: linear-gradient(135deg, #8B7355 0%, #A0826D 100%);
box-shadow: 0 8rpx 24rpx rgba(139, 115, 85, 0.3);
}
.highlight-card .asset-label,
.highlight-card .asset-value,
.highlight-card .asset-value-large {
color: #FFFFFF !important;
}
.asset-icon {
width: 72rpx;
height: 72rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
.coupon-icon {
background: linear-gradient(135deg, #FFE4B5 0%, #FFD7A3 100%);
}
.balance-icon {
background: rgba(255, 255, 255, 0.25);
}
.score-icon {
background: linear-gradient(135deg, #FFF8DC 0%, #FFEAA7 100%);
}
.asset-value {
font-size: 44rpx;
font-weight: 600;
color: #333333;
margin-bottom: 8rpx;
font-family: 'DIN Alternate', 'Helvetica Neue', sans-serif;
}
.asset-value-large {
display: flex;
align-items: baseline;
margin-bottom: 8rpx;
}
.currency {
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
margin-right: 4rpx;
}
.amount {
font-size: 48rpx;
font-weight: 700;
color: #FFFFFF;
font-family: 'DIN Alternate', 'Helvetica Neue', sans-serif;
}
.asset-label {
font-size: 24rpx;
color: #999999;
}
/* ==================== 功能菜单区域 ==================== */
.menu-section {
padding: 0 32rpx;
}
.menu-group {
margin-bottom: 32rpx;
}
.menu-title {
display: flex;
align-items: center;
margin-bottom: 24rpx;
padding-left: 8rpx;
}
.title-dot {
width: 8rpx;
height: 28rpx;
background: linear-gradient(180deg, #8B7355 0%, #A0826D 100%);
border-radius: 4rpx;
margin-right: 16rpx;
}
.menu-title text {
font-size: 32rpx;
font-weight: 600;
color: #333333;
}
/* 网格菜单 */
.menu-grid {
display: flex;
gap: 20rpx;
margin-bottom: 16rpx;
}
.menu-item {
flex: 1;
background: #FFFFFF;
border-radius: 20rpx;
padding: 32rpx 16rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
}
.menu-item navigator {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.menu-item:active {
transform: translateY(-4rpx);
box-shadow: 0 8rpx 20rpx rgba(139, 115, 85, 0.15);
}
.menu-icon-wrapper {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
transition: all 0.3s ease;
}
.scan-icon {
background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
color: #2196F3;
}
.sign-icon {
background: linear-gradient(135deg, #FCE4EC 0%, #F8BBD0 100%);
color: #E91E63;
}
.booking-icon {
background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
color: #9C27B0;
}
.pay-icon {
background: linear-gradient(135deg, #FFF9C4 0%, #FFF59D 100%);
color: #FFA000;
}
.menu-text {
font-size: 24rpx;
color: #666666;
text-align: center;
line-height: 1.4;
}
/* 列表菜单 */
.menu-list {
background: #FFFFFF;
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
}
.menu-list navigator {
display: block;
}
.menu-list-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx 28rpx;
border-bottom: 1rpx solid #F5F5F5;
transition: background 0.3s ease;
}
.menu-list-item:last-child {
border-bottom: none;
}
.menu-list-item:active {
background: #FAFAFA;
}
.item-left {
display: flex;
align-items: center;
flex: 1;
}
.list-icon {
width: 72rpx;
height: 72rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
}
.vip-icon {
background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
color: #FFA000;
}
.order-icon {
background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
color: #4CAF50;
}
.address-icon {
background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
color: #2196F3;
}
.about-icon {
background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
color: #9C27B0;
}
.service-icon {
background: linear-gradient(135deg, #E0F2F1 0%, #B2DFDB 100%);
color: #009688;
}
.feedback-icon {
background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
color: #FF9800;
}
.clear-icon {
background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
color: #F44336;
}
.admin-icon {
background: linear-gradient(135deg, #F5F5F5 0%, #E0E0E0 100%);
color: #757575;
}
.list-text {
font-size: 28rpx;
color: #333333;
font-weight: 500;
}
/* ==================== 版本信息 ==================== */
.version-text {
text-align: center;
margin-top: 48rpx;
padding-bottom: 32rpx;
color: #BDBDBD;
font-size: 24rpx;
letter-spacing: 2rpx;
}
/* ==================== 兼容旧样式 ==================== */
.userinfo, .uploader, .tunnel {
display: none;
}
.userinfo-avatar {
background: transparent;
border: none;
padding: 0;
margin: 0;
overflow: visible;
}
.userinfo-avatar::after {
border: none;
}
.userinfo-avatar-img {
display: none;
}
.userinfo-nickname {
display: none;
}
.userinfo-nickname::after {
border: none;
}
================================================
FILE: pages/my/user-code.js
================================================
const WXAPI = require('apifm-wxapi')
import wxbarcode from 'wxbarcode'
Page({
data: {
balance: 0,
freeze: 0,
score: 0,
growth: 0,
userCode: undefined
},
onLoad(e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.my.userCode,
})
this.getUserAmount()
this.dynamicUserCode()
},
onShow: function () {
},
onPullDownRefresh() {
this.getUserAmount()
this.dynamicUserCode()
wx.stopPullDownRefresh()
},
async getUserAmount() {
const res = await WXAPI.userAmount(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
balance: res.data.balance,
freeze: res.data.freeze,
score: res.data.score,
growth: res.data.growth
})
}
},
async dynamicUserCode() {
const res = await WXAPI.dynamicUserCode(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
userCode: res.data
})
wxbarcode.barcode('barcode', res.data, 560, 200);
wxbarcode.qrcode('qrcode', res.data, 450, 450);
}
},
})
================================================
FILE: pages/my/user-code.json
================================================
{
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
================================================
FILE: pages/my/user-code.wxml
================================================
会员编号
{{ userCode }}
向商家出示此码享受会员优惠
💰
{{ $t.order.balance }}
¥{{ balance }}
⭐
{{ $t.my.score }}
{{ score }}
•
每次消费可累积积分
•
积分可兑换精美礼品
================================================
FILE: pages/my/user-code.wxss
================================================
/* 页面容器 */
.member-code-page {
min-height: 100vh;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8CC 50%, #FFDDB3 100%);
padding: 40rpx 30rpx;
position: relative;
overflow: hidden;
}
/* 顶部装饰圆圈 */
.top-decoration {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 300rpx;
pointer-events: none;
}
.decoration-circle {
position: absolute;
border-radius: 50%;
opacity: 0.15;
}
.circle-1 {
width: 200rpx;
height: 200rpx;
background: linear-gradient(135deg, #FF9A76 0%, #FF6B9D 100%);
top: -100rpx;
right: 50rpx;
}
.circle-2 {
width: 150rpx;
height: 150rpx;
background: linear-gradient(135deg, #FFC837 0%, #FF8008 100%);
top: 100rpx;
left: -50rpx;
}
.circle-3 {
width: 100rpx;
height: 100rpx;
background: linear-gradient(135deg, #A8EDEA 0%, #FED6E3 100%);
top: 50rpx;
right: 200rpx;
}
/* 会员卡片 */
.member-card {
background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F3 100%);
border-radius: 32rpx;
padding: 40rpx 30rpx;
margin-bottom: 30rpx;
box-shadow: 0 16rpx 48rpx rgba(255, 168, 76, 0.15);
position: relative;
overflow: hidden;
}
.member-card::before {
content: '';
position: absolute;
top: -50%;
right: -50rpx;
width: 300rpx;
height: 300rpx;
background: linear-gradient(135deg, rgba(255, 193, 7, 0.08) 0%, rgba(255, 152, 0, 0.08) 100%);
border-radius: 50%;
}
/* 卡片头部 */
.card-header {
display: flex;
justify-content: center;
margin-bottom: 30rpx;
}
.member-badge {
display: inline-flex;
align-items: center;
background: linear-gradient(135deg, #FFD93D 0%, #FFA826 100%);
padding: 12rpx 32rpx;
border-radius: 50rpx;
box-shadow: 0 8rpx 24rpx rgba(255, 168, 38, 0.3);
}
.badge-icon {
font-size: 32rpx;
margin-right: 8rpx;
}
.badge-text {
color: #6B4423;
font-size: 28rpx;
font-weight: bold;
letter-spacing: 2rpx;
}
/* 会员编号 */
.code-number {
text-align: center;
margin-bottom: 40rpx;
}
.code-label {
display: block;
color: #999;
font-size: 24rpx;
margin-bottom: 10rpx;
letter-spacing: 1rpx;
}
.code-value {
display: block;
color: #8B5A3C;
font-size: 32rpx;
font-weight: bold;
letter-spacing: 3rpx;
font-family: 'Courier New', monospace;
}
/* 二维码容器 */
.qrcode-container {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 30rpx;
}
.qrcode-wrapper {
position: relative;
width: 510rpx;
height: 510rpx;
display: flex;
align-items: center;
justify-content: center;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(139, 90, 60, 0.08);
}
.user-code {
width: 450rpx;
height: 450rpx;
border-radius: 16rpx;
display: block;
}
/* 二维码四角装饰 */
.qrcode-corners {
position: absolute;
top: 30rpx;
left: 30rpx;
right: 30rpx;
bottom: 30rpx;
pointer-events: none;
}
.corner {
position: absolute;
width: 40rpx;
height: 40rpx;
border: 4rpx solid #FFA826;
}
.corner-tl {
top: 0;
left: 0;
border-right: none;
border-bottom: none;
border-radius: 8rpx 0 0 0;
}
.corner-tr {
top: 0;
right: 0;
border-left: none;
border-bottom: none;
border-radius: 0 8rpx 0 0;
}
.corner-bl {
bottom: 0;
left: 0;
border-right: none;
border-top: none;
border-radius: 0 0 0 8rpx;
}
.corner-br {
bottom: 0;
right: 0;
border-left: none;
border-top: none;
border-radius: 0 0 8rpx 0;
}
.qrcode-tip {
margin-top: 24rpx;
color: #8B5A3C;
font-size: 24rpx;
text-align: center;
opacity: 0.8;
}
/* 条形码容器 */
.barcode-container {
display: flex;
justify-content: center;
padding: 20rpx;
background: #FFFFFF;
border-radius: 16rpx;
box-shadow: 0 4rpx 16rpx rgba(139, 90, 60, 0.05);
}
.user-code-bar {
width: 600rpx;
height: 150rpx;
}
/* 账户信息卡片 */
.account-info {
background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F3 100%);
border-radius: 24rpx;
padding: 40rpx 30rpx;
margin-bottom: 30rpx;
box-shadow: 0 16rpx 48rpx rgba(255, 168, 76, 0.15);
display: flex;
align-items: center;
justify-content: space-around;
}
.info-item {
display: flex;
align-items: center;
flex: 1;
justify-content: center;
}
.info-icon-wrapper {
width: 88rpx;
height: 88rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
}
.balance-icon {
background: linear-gradient(135deg, #FFD93D 0%, #FFA826 100%);
}
.score-icon {
background: linear-gradient(135deg, #FF9A76 0%, #FF6B9D 100%);
}
.info-icon {
font-size: 44rpx;
}
.info-content {
display: flex;
flex-direction: column;
}
.info-label {
color: #999;
font-size: 24rpx;
margin-bottom: 8rpx;
}
.info-value {
color: #8B5A3C;
font-size: 36rpx;
font-weight: bold;
letter-spacing: 1rpx;
}
.info-divider {
width: 2rpx;
height: 60rpx;
background: linear-gradient(180deg, rgba(139, 90, 60, 0) 0%, rgba(139, 90, 60, 0.2) 50%, rgba(139, 90, 60, 0) 100%);
margin: 0 20rpx;
}
/* 底部提示 */
.bottom-tips {
padding: 30rpx 20rpx;
}
.tip-item {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.tip-dot {
color: #FFA826;
font-size: 28rpx;
margin-right: 12rpx;
font-weight: bold;
}
.tip-text {
color: #8B5A3C;
font-size: 24rpx;
opacity: 0.7;
letter-spacing: 1rpx;
}
/* 兼容vant组件 */
.van-grid-item__text {
color: #e64340 !important;
font-size: 28rpx !important;
}
================================================
FILE: pages/notice/detail.js
================================================
const WXAPI = require('apifm-wxapi')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.notice.title,
})
this.noticeDetail(options.id)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
async noticeDetail(id) {
const res = await WXAPI.noticeDetail(id)
if (res.code == 0) {
this.setData({
noticeDetail: res.data
})
}
},
})
================================================
FILE: pages/notice/detail.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/notice/detail.wxml
================================================
================================================
FILE: pages/notice/detail.wxss
================================================
.content {
padding: 32rpx;
line-height: 64rpx;
}
.content image {
max-width: 100%;
}
================================================
FILE: pages/order-details/doing.js
================================================
const WXAPI = require('apifm-wxapi')
const wxbarcode = require('wxbarcode')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
apiOk: false,
isLogined: true
},
onLoad: function (options) {
},
onShow: function () {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.index.PickingUp,
})
AUTH.checkHasLogined().then(isLogined => {
this.setData({
isLogined
})
if (isLogined) {
this.orderList();
}
})
},
toIndexPage: function() {
wx.switchTab({
url: "/pages/index/index"
});
},
async orderList() {
wx.showLoading({
title: '',
})
const res = await WXAPI.orderList({
token: wx.getStorageSync('token'),
type: 0,
statusBatch: '1,2'
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
orderList: res.data.orderList,
logisticsMap: res.data.logisticsMap,
goodsMap: res.data.goodsMap,
apiOk: true
})
wxbarcode.qrcode('qrcode_0', res.data.orderList[0].hxNumber, 400, 400);
} else {
this.setData({
orderList: null,
logisticsMap: null,
goodsMap: null,
apiOk: true
})
}
},
bindchange(e) {
const index = e.detail.current
const hxNumber = this.data.orderList[index].hxNumber
if (!hxNumber) {
return
}
wxbarcode.qrcode('qrcode_' + index, hxNumber, 400, 400);
},
})
================================================
FILE: pages/order-details/doing.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/order-details/doing.wxml
================================================
🥤
{{ $t.order.empty.t1 }}
{{ $t.order.empty.t2 }}
{{ $t.order.empty.btn }}
{{order.qudanhao}}
请向店员出示取餐码
核销二维码
配送核销码
📍
配送信息
{{logisticsMap[order.id].linkMan}}
{{logisticsMap[order.id].mobile}}
{{logisticsMap[order.id].provinceStr}}{{logisticsMap[order.id].cityStr}}{{logisticsMap[order.id].areaStr}}{{logisticsMap[order.id].address}}
📝
订单明细
{{goods.goodsName}}
{{goods.property}}
x{{goods.number}}
¥{{goods.amount}}
{{ $t.PickingUp.total }}
¥{{order.amountReal}}
🕐
{{ $t.order.dateAdd }}: {{order.dateAdd}}
享受每一口美好
================================================
FILE: pages/order-details/doing.wxss
================================================
/* 页面主体样式 */
page {
background: linear-gradient(135deg, #FFF5E6 0%, #FFE4D1 50%, #FFF0E6 100%);
display: flex;
flex-direction: column;
height: 100vh;
}
/* 空状态样式 */
.no-order {
margin-top: 200rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
animation: fadeIn 0.6s ease;
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 40rpx;
animation: float 3s ease-in-out infinite;
}
.content-1 {
font-size: 32rpx;
text-align: center;
margin-top: 20rpx;
color: #8B6F47;
font-weight: 500;
}
.content-2 {
font-size: 28rpx;
text-align: center;
margin-top: 16rpx;
color: #A89080;
}
.to-index-btn {
color: #fff;
background: linear-gradient(135deg, #FF9F5A 0%, #FF7B3E 100%);
border-radius: 48rpx;
width: 320rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
margin-top: 60rpx;
box-shadow: 0 8rpx 24rpx rgba(255, 159, 90, 0.3);
font-weight: 500;
}
/* Swiper容器 */
.swiper {
flex: 1;
}
.scroll-view {
height: 100%;
}
.page-container {
padding: 40rpx 30rpx 60rpx;
min-height: 100%;
}
/* 取单号卡片 */
.pickup-card {
background: linear-gradient(135deg, #FFFFFF 0%, #FFFBF5 100%);
border-radius: 32rpx;
padding: 48rpx;
margin-bottom: 32rpx;
box-shadow: 0 8rpx 32rpx rgba(139, 111, 71, 0.08);
position: relative;
overflow: hidden;
}
.pickup-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 8rpx;
background: linear-gradient(90deg, #FF9F5A 0%, #6DD0A5 100%);
}
.card-header {
display: flex;
align-items: center;
margin-bottom: 40rpx;
}
.header-icon {
font-size: 48rpx;
margin-right: 16rpx;
}
.header-title {
font-size: 36rpx;
color: #8B6F47;
font-weight: 600;
}
/* 取单号显示 */
.pickup-number-wrapper {
text-align: center;
margin-bottom: 48rpx;
padding: 40rpx 0;
background: linear-gradient(135deg, #FFF9F0 0%, #FFEDE0 100%);
border-radius: 24rpx;
position: relative;
}
.pickup-number {
font-size: 96rpx;
color: #FF7B3E;
font-weight: 700;
letter-spacing: 8rpx;
text-shadow: 0 4rpx 16rpx rgba(255, 123, 62, 0.2);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.pickup-tips {
font-size: 26rpx;
color: #A89080;
margin-top: 20rpx;
letter-spacing: 2rpx;
}
/* 二维码容器 */
.qrcode-wrapper {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 40rpx;
}
.qrcode-container {
position: relative;
padding: 32rpx;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.06);
}
.hx-canvas {
width: 400rpx;
height: 400rpx;
display: block;
}
/* 二维码装饰角 */
.qrcode-corners {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
}
.corner {
position: absolute;
width: 40rpx;
height: 40rpx;
border-color: #FF9F5A;
border-style: solid;
}
.corner-tl {
top: 16rpx;
left: 16rpx;
border-width: 6rpx 0 0 6rpx;
border-radius: 8rpx 0 0 0;
}
.corner-tr {
top: 16rpx;
right: 16rpx;
border-width: 6rpx 6rpx 0 0;
border-radius: 0 8rpx 0 0;
}
.corner-bl {
bottom: 16rpx;
left: 16rpx;
border-width: 0 0 6rpx 6rpx;
border-radius: 0 0 0 8rpx;
}
.corner-br {
bottom: 16rpx;
right: 16rpx;
border-width: 0 6rpx 6rpx 0;
border-radius: 0 0 8rpx 0;
}
.qrcode-label {
margin-top: 24rpx;
font-size: 26rpx;
color: #A89080;
letter-spacing: 2rpx;
}
/* 配送卡片特殊样式 */
.delivery-card::before {
background: linear-gradient(90deg, #6DD0A5 0%, #4FB89D 100%);
}
.delivery-qrcode {
margin-top: 20rpx;
}
/* 信息卡片 */
.info-card {
background: #FFFFFF;
border-radius: 24rpx;
padding: 40rpx;
margin-bottom: 32rpx;
box-shadow: 0 4rpx 24rpx rgba(139, 111, 71, 0.06);
}
.card-section-title {
display: flex;
align-items: center;
font-size: 32rpx;
color: #5D4E3C;
font-weight: 600;
margin-bottom: 32rpx;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #F5F0EA;
}
.title-icon {
font-size: 40rpx;
margin-right: 12rpx;
}
/* 地址卡片 */
.address-content {
padding: 24rpx;
background: linear-gradient(135deg, #FFF9F0 0%, #FFEDE0 100%);
border-radius: 16rpx;
}
.address-contact {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.contact-name {
font-size: 32rpx;
color: #5D4E3C;
font-weight: 600;
margin-right: 24rpx;
}
.contact-phone {
font-size: 28rpx;
color: #8B6F47;
}
.address-detail {
font-size: 28rpx;
color: #A89080;
line-height: 44rpx;
}
/* 商品列表 */
.goods-list {
margin-bottom: 24rpx;
}
.goods-item {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 24rpx 0;
border-bottom: 1rpx solid #F5F0EA;
}
.goods-item:last-child {
border-bottom: none;
}
.goods-main {
flex: 1;
margin-right: 24rpx;
}
.goods-name {
font-size: 30rpx;
color: #5D4E3C;
font-weight: 500;
margin-bottom: 8rpx;
line-height: 42rpx;
}
.goods-specs {
font-size: 24rpx;
color: #A89080;
line-height: 36rpx;
margin-top: 4rpx;
}
.goods-right {
display: flex;
align-items: center;
gap: 24rpx;
}
.goods-quantity {
font-size: 28rpx;
color: #8B6F47;
min-width: 60rpx;
text-align: right;
}
.goods-price {
font-size: 32rpx;
color: #FF7B3E;
font-weight: 600;
min-width: 100rpx;
text-align: right;
}
/* 分隔线 */
.divider-line {
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #F5F0EA 50%, transparent 100%);
margin: 24rpx 0;
}
/* 总计行 */
.total-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx;
background: linear-gradient(135deg, #FFF9F0 0%, #FFEDE0 100%);
border-radius: 16rpx;
margin-bottom: 24rpx;
}
.total-label {
font-size: 32rpx;
color: #5D4E3C;
font-weight: 600;
}
.total-amount {
font-size: 44rpx;
color: #FF7B3E;
font-weight: 700;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
/* 订单时间 */
.order-time {
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #A89080;
padding: 16rpx;
}
.time-icon {
margin-right: 8rpx;
font-size: 28rpx;
}
/* 底部装饰 */
.bottom-decoration {
display: flex;
align-items: center;
justify-content: center;
margin-top: 40rpx;
padding: 32rpx 0;
}
.decoration-line {
flex: 1;
height: 2rpx;
background: linear-gradient(90deg, transparent 0%, #E5D5C5 50%, transparent 100%);
max-width: 120rpx;
}
.decoration-text {
font-size: 24rpx;
color: #C4B5A8;
padding: 0 24rpx;
letter-spacing: 2rpx;
font-weight: 300;
}
/* 动画效果 */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-20rpx);
}
}
================================================
FILE: pages/order-details/index.js
================================================
const APP = getApp();
const WXAPI = require('apifm-wxapi')
APP.configLoadOK = () => {
wx.setNavigationBarTitle({
title: wx.getStorageSync('mallName')
})
}
const wxbarcode = require('wxbarcode')
Page({
data:{
},
onLoad(e){
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.order.detail,
})
// e.id = 1234
// e.payOrderNo = 'ZF2411231847541110'
this.setData({
orderId: e.id,
payOrderNo: e.payOrderNo,
})
if (e.payOrderNo) {
this.payLogs()
}
},
onShow : function () {
this.orderDetail()
},
async payLogs() {
wx.showLoading({
title: '',
})
const res = await WXAPI.payLogs({
token: wx.getStorageSync('token'),
orderNo: this.data.payOrderNo
})
wx.hideLoading()
if (res.code != 0) {
wx.showModal({
content: res.msg,
showCancel: false
})
return
}
const nextAction = res.data[0].nextAction
if(!nextAction) {
wx.navigateTo({
url: '/pages/asset/index',
})
return
}
const _nextAction = JSON.parse(nextAction)
if (_nextAction.type != 0) {
wx.navigateTo({
url: '/pages/asset/index',
})
return
}
this.setData({
orderId: _nextAction.id,
})
this.orderDetail()
},
async orderDetail() {
if (!this.data.orderId) {
return
}
wx.showLoading({
title: '',
})
const res = await WXAPI.orderDetail(wx.getStorageSync('token'), this.data.orderId)
wx.hideLoading()
if (res.code != 0) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
return
}
// 绘制核销码
if (res.data.orderInfo.hxNumber && res.data.orderInfo.status == 1) {
wxbarcode.qrcode('qrcode', res.data.orderInfo.hxNumber, 400, 400);
}
this.setData({
orderDetail: res.data
})
if (res.data.orderInfo.shopIdZt) {
this.shopSubdetail()
}
},
async shopSubdetail() {
const res = await WXAPI.shopSubdetail(this.data.orderDetail.orderInfo.shopIdZt)
if (res.code == 0) {
this.setData({
shopSubdetail: res.data
})
}
},
async toPayTap() {
// 立即支付
let res = await WXAPI.userAmount(wx.getStorageSync('token'))
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
const balance = res.data.balance // 当前用户的余额
let needPay = this.data.orderDetail.orderInfo.amountReal*1 - balance*1
needPay = needPay.toFixed(2)
if (needPay <= 0) {
// 余额足够
WXAPI.orderPay(wx.getStorageSync('token'), this.data.orderDetail.orderInfo.id).then(res => {
wx.showToast({
title: this.data.$t.asset.success,
icon: 'success'
})
this.orderDetail();
})
} else {
// 微信支付
this.setData({
paymentShow: true,
money: needPay,
orderId: this.data.orderDetail.orderInfo.id,
nextAction: {
type: 0,
id: this.data.orderDetail.orderInfo.id
}
})
}
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false
})
wx.redirectTo({
url: '/pages/all-orders/index',
})
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
callshop() {
wx.makePhoneCall({
phoneNumber: this.data.shopSubdetail.info.linkPhone,
})
},
wuliuDetailsTap:function(e){
var orderId = e.currentTarget.dataset.id;
wx.navigateTo({
url: "/pages/wuliu/index?id=" + orderId
})
},
confirmBtnTap(e){
let that = this;
let orderId = this.data.orderId;
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.order.askConfirm,
success: function(res) {
if (res.confirm) {
WXAPI.orderDelivery(wx.getStorageSync('token'), orderId).then(function (res) {
if (res.code == 0) {
that.onShow();
}
})
}
}
})
},
submitReputation: function (e) {
let that = this;
let postJsonString = {};
postJsonString.token = wx.getStorageSync('token');
postJsonString.orderId = this.data.orderId;
let reputations = [];
let i = 0;
while (e.detail.value["orderGoodsId" + i]) {
let orderGoodsId = e.detail.value["orderGoodsId" + i];
let goodReputation = e.detail.value["goodReputation" + i];
let goodReputationRemark = e.detail.value["goodReputationRemark" + i];
let reputations_json = {};
reputations_json.id = orderGoodsId;
reputations_json.reputation = goodReputation;
reputations_json.remark = goodReputationRemark;
reputations.push(reputations_json);
i++;
}
postJsonString.reputations = reputations;
WXAPI.orderReputation({
postJsonString: JSON.stringify(postJsonString)
}).then(function (res) {
if (res.code == 0) {
that.onShow();
}
})
}
})
================================================
FILE: pages/order-details/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/order-details/index.wxml
================================================
{{ $t.order.stausClosed }}
订单已取消
{{ $t.order.stausNoPay }}
请尽快完成支付
{{ $t.order.toPayTap }}
等待取餐
{{ $t.PickingUp.qudanhao }}
{{orderDetail.orderInfo.qudanhao}}
出示此码给店员核销
{{ $t.PickingUp.Deliverying }}
骑手正在火速配送中
出示此码给骑手
{{ $t.order.stausSuccess }}
感谢您的光临,期待再次为您服务
{{shopSubdetail.info.name}}
{{shopSubdetail.info.address}}
联系
{{orderDetail.logistics.linkMan}}
{{orderDetail.logistics.mobile}}
{{orderDetail.logistics.provinceStr}}{{orderDetail.logistics.cityStr}}{{orderDetail.logistics.areaStr}}{{orderDetail.logistics.address}}
{{item.goodsName}}
{{item.property}}
¥{{item.amount}}
x{{item.number}}
{{ $t.PickingUp.total }}
¥{{orderDetail.orderInfo.amountReal}}
{{ $t.order.dateAdd }}
{{orderDetail.orderInfo.dateAdd}}
{{ $t.common.cancel }}
{{orderDetail.orderInfo.dateClose}}
================================================
FILE: pages/order-details/index.wxss
================================================
page {
background: linear-gradient(180deg, #F5E6D3 0%, #FFF8F0 100%);
min-height: 100vh;
padding-bottom: 40rpx;
}
/* 页面容器 */
.page-container {
padding: 24rpx;
}
/* ========== 订单状态卡片 ========== */
.status-card {
margin-bottom: 24rpx;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(139, 69, 19, 0.12);
}
.status-content {
padding: 60rpx 40rpx 50rpx;
text-align: center;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
}
/* 状态背景渐变 */
.status-closed {
background: linear-gradient(135deg, #B0B0B0 0%, #808080 100%);
}
.status-unpay {
background: linear-gradient(135deg, #FFB84D 0%, #FF9500 100%);
}
.status-pickup {
background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
}
.status-delivery {
background: linear-gradient(135deg, #FF8C42 0%, #FF6B35 100%);
}
.status-success {
background: linear-gradient(135deg, #52C41A 0%, #389E0D 100%);
}
/* 状态图标 */
.status-icon-wrapper {
width: 140rpx;
height: 140rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24rpx;
backdrop-filter: blur(10rpx);
}
/* 状态文字 */
.status-title {
font-size: 40rpx;
font-weight: bold;
color: #fff;
margin-bottom: 12rpx;
letter-spacing: 2rpx;
}
.status-desc {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.9);
margin-top: 8rpx;
}
/* 支付按钮 */
.pay-btn-wrapper {
margin-top: 32rpx;
}
.pay-btn {
display: inline-block;
background: #fff;
color: #FF9500;
padding: 20rpx 80rpx;
border-radius: 60rpx;
font-size: 30rpx;
font-weight: bold;
box-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.15);
}
/* 取餐号 */
.pickup-number-label {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
margin-top: 24rpx;
margin-bottom: 12rpx;
}
.pickup-number {
font-size: 80rpx;
font-weight: bold;
color: #FFE4C4;
letter-spacing: 8rpx;
text-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.2);
margin: 16rpx 0;
}
/* 二维码 */
.qrcode-wrapper {
margin-top: 32rpx;
}
.qrcode-container {
background: #fff;
border-radius: 20rpx;
padding: 24rpx;
display: inline-block;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.15);
}
.qrcode-canvas {
width: 400rpx;
height: 400rpx;
display: block;
}
.qrcode-tip {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.85);
margin-top: 20rpx;
}
/* ========== 通用卡片样式 ========== */
.shop-card,
.address-card,
.goods-card,
.order-info-card {
background: #fff;
border-radius: 20rpx;
margin-bottom: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(139, 69, 19, 0.08);
}
/* 卡片头部 */
.card-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #F5E6D3;
}
.header-icon {
font-size: 36rpx;
margin-right: 12rpx;
}
.header-title {
font-size: 32rpx;
font-weight: bold;
color: #8B4513;
}
/* ========== 店铺信息 ========== */
.shop-info {
display: flex;
align-items: center;
justify-content: space-between;
}
.shop-main {
flex: 1;
}
.shop-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 12rpx;
}
.shop-address {
font-size: 26rpx;
color: #666;
line-height: 40rpx;
}
.shop-phone {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #FFF8F0 0%, #F5E6D3 100%);
border-radius: 16rpx;
padding: 20rpx 24rpx;
margin-left: 24rpx;
}
.phone-text {
font-size: 22rpx;
color: #8B4513;
margin-top: 8rpx;
}
/* ========== 收货地址 ========== */
.address-info {
font-size: 28rpx;
}
.address-user {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.user-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-right: 24rpx;
}
.user-phone {
font-size: 28rpx;
color: #666;
}
.address-detail {
font-size: 28rpx;
color: #666;
line-height: 44rpx;
}
/* ========== 商品列表 ========== */
.goods-list {
margin-bottom: 24rpx;
}
.goods-item {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #F5F5F5;
}
.goods-item:last-child {
border-bottom: none;
}
.goods-info {
flex: 1;
padding-right: 24rpx;
}
.goods-name {
font-size: 30rpx;
color: #333;
margin-bottom: 8rpx;
font-weight: 500;
}
.goods-spec {
font-size: 24rpx;
color: #999;
line-height: 36rpx;
background: #F5F5F5;
padding: 4rpx 12rpx;
border-radius: 6rpx;
display: inline-block;
margin-top: 8rpx;
}
.goods-right {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.goods-price {
font-size: 32rpx;
font-weight: bold;
color: #8B4513;
margin-bottom: 8rpx;
}
.goods-num {
font-size: 26rpx;
color: #999;
}
/* 商品分隔线 */
.goods-divider {
height: 2rpx;
background: linear-gradient(to right, #F5E6D3, #D2B48C, #F5E6D3);
margin: 24rpx 0;
}
/* 总价 */
.goods-total {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 24rpx;
}
.total-label {
font-size: 30rpx;
color: #666;
}
.total-price {
font-size: 40rpx;
font-weight: bold;
color: #8B4513;
}
/* ========== 订单信息 ========== */
.info-list {
font-size: 26rpx;
}
.info-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
line-height: 40rpx;
}
.info-label {
color: #999;
}
.info-value {
color: #666;
text-align: right;
}
/* 底部安全距离 */
.safe-bottom {
height: 40rpx;
}
================================================
FILE: pages/order-details/scan-result.js
================================================
const WXAPI = require('apifm-wxapi')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
},
onLoad: function (e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.my.scanHx,
})
// e.hxNumber = '2008010532287842'
this.setData({
hxNumber: e.hxNumber
});
},
onShow: function () {
var that = this;
WXAPI.orderDetail(wx.getStorageSync('token'), '', this.data.hxNumber).then(function (res) {
if (res.code != 0) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
return;
}
that.setData({
orderDetail: res.data
});
})
},
wuliuDetailsTap: function (e) {
var orderId = e.currentTarget.dataset.id;
wx.navigateTo({
url: "/pages/wuliu/index?id=" + orderId
})
},
confirmBtnTap(e) {
let that = this;
let orderId = this.data.orderId;
wx.showModal({
content: this.data.$t.order.askConfirm,
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
success: function (res) {
if (res.confirm) {
WXAPI.orderDelivery(wx.getStorageSync('token'), orderId).then(function (res) {
if (res.code == 0) {
that.onShow();
}
})
}
}
})
},
submitReputation: function (e) {
let that = this;
let postJsonString = {};
postJsonString.token = wx.getStorageSync('token');
postJsonString.orderId = this.data.orderId;
let reputations = [];
let i = 0;
while (e.detail.value["orderGoodsId" + i]) {
let orderGoodsId = e.detail.value["orderGoodsId" + i];
let goodReputation = e.detail.value["goodReputation" + i];
let goodReputationRemark = e.detail.value["goodReputationRemark" + i];
let reputations_json = {};
reputations_json.id = orderGoodsId;
reputations_json.reputation = goodReputation;
reputations_json.remark = goodReputationRemark;
reputations.push(reputations_json);
i++;
}
postJsonString.reputations = reputations;
WXAPI.orderReputation({
postJsonString: JSON.stringify(postJsonString)
}).then(function (res) {
if (res.code == 0) {
that.onShow();
}
})
},
async doneHx(){
wx.showLoading({
title: '',
})
// https://www.yuque.com/apifm/nu0f75/sq4sma
const res = await WXAPI.orderHXV2({
token: wx.getStorageSync('token'),
hxNumber: this.data.hxNumber
})
wx.hideLoading()
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
} else {
wx.showToast({
title: this.data.$t.order.VerificationCompleted,
icon: 'success'
})
this.onShow()
}
},
})
================================================
FILE: pages/order-details/scan-result.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/order-details/scan-result.wxml
================================================
{{orderDetail.logistics.linkMan}}
{{orderDetail.logistics.mobile}}
{{orderDetail.logistics.provinceStr}} {{orderDetail.logistics.cityStr}} {{orderDetail.logistics.areaStr}} {{orderDetail.logistics.address}}
{{ $t.coupons.title }}
{{item.coupon}}
{{ $t.PickingUp.goodsAmount }}
¥ {{orderDetail.orderInfo.amount}}
{{ $t.PickingUp.freight }}
+ ¥ {{orderDetail.orderInfo.amountLogistics}}
{{ $t.PickingUp.realAmount }}
¥
{{orderDetail.orderInfo.amountReal}}
{{ $t.PickingUp.ConfirmVerification }}
================================================
FILE: pages/order-details/scan-result.wxss
================================================
/* 页面整体样式 - 奶茶店风格 */
page {
min-height: 100%;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8CC 50%, #FFDAB3 100%);
}
.container {
min-height: 100%;
padding: 20rpx 0 120rpx 0;
}
/* 顶部成功标识 */
.success-header {
text-align: center;
padding: 50rpx 0 40rpx 0;
animation: fadeInDown 0.6s ease-out;
}
.success-icon {
width: 100rpx;
height: 100rpx;
line-height: 100rpx;
margin: 0 auto 20rpx;
background: linear-gradient(135deg, #A0673E 0%, #8B5A3C 100%);
color: #fff;
font-size: 60rpx;
font-weight: bold;
border-radius: 50%;
box-shadow: 0 8rpx 24rpx rgba(139, 90, 60, 0.3);
}
.success-title {
font-size: 36rpx;
font-weight: bold;
color: #5D3A1A;
margin-bottom: 12rpx;
letter-spacing: 2rpx;
}
.success-subtitle {
font-size: 26rpx;
color: #8B7355;
opacity: 0.9;
}
/* 卡片通用样式 */
.card-section {
margin: 0 24rpx 24rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 8rpx 24rpx rgba(139, 90, 60, 0.12);
overflow: hidden;
animation: fadeInUp 0.5s ease-out;
}
.card-header {
display: flex;
align-items: center;
padding: 32rpx 28rpx 24rpx 28rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.card-icon {
font-size: 36rpx;
margin-right: 16rpx;
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
border-radius: 12rpx;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8CC 100%);
}
.card-title {
font-size: 30rpx;
font-weight: 600;
color: #5D3A1A;
letter-spacing: 1rpx;
}
/* 配送地址样式 */
.address-card {
padding: 24rpx 28rpx 32rpx 28rpx;
}
.address-info {
position: relative;
padding-left: 20rpx;
border-left: 4rpx solid #A0673E;
}
.recipient-row {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.recipient-name {
font-size: 30rpx;
font-weight: 600;
color: #2C2C2C;
margin-right: 24rpx;
}
.recipient-phone {
font-size: 28rpx;
color: #666666;
background: #F8F8F8;
padding: 4rpx 16rpx;
border-radius: 8rpx;
}
.address-detail {
font-size: 26rpx;
color: #666666;
line-height: 40rpx;
}
/* 商品列表样式 */
.goods-section {
padding-bottom: 16rpx;
}
.goods-item {
display: flex;
padding: 24rpx 28rpx;
position: relative;
}
.goods-item::after {
content: '';
position: absolute;
bottom: 0;
left: 28rpx;
right: 28rpx;
height: 1rpx;
background: linear-gradient(90deg, transparent 0%, #EEEEEE 50%, transparent 100%);
}
.goods-item:last-child::after {
display: none;
}
.goods-image-wrap {
width: 180rpx;
height: 180rpx;
border-radius: 16rpx;
overflow: hidden;
margin-right: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
flex-shrink: 0;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE8CC 100%);
}
.goods-image {
width: 100%;
height: 100%;
}
.goods-content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 8rpx 0;
}
.goods-title {
font-size: 28rpx;
font-weight: 600;
color: #2C2C2C;
line-height: 40rpx;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.goods-specs {
font-size: 24rpx;
color: #999999;
background: #F5F5F5;
padding: 6rpx 12rpx;
border-radius: 6rpx;
display: inline-block;
align-self: flex-start;
margin-bottom: 12rpx;
}
.goods-footer {
display: flex;
justify-content: space-between;
align-items: flex-end;
}
.goods-price-wrap {
display: flex;
align-items: baseline;
}
.price-symbol {
font-size: 24rpx;
color: #A0673E;
font-weight: 600;
margin-right: 4rpx;
}
.price-number {
font-size: 32rpx;
color: #A0673E;
font-weight: 700;
}
.goods-quantity {
font-size: 26rpx;
color: #999999;
background: #F8F8F8;
padding: 6rpx 16rpx;
border-radius: 8rpx;
}
/* 优惠券样式 */
.coupon-section {
background: linear-gradient(135deg, #FFF8F0 0%, #FFFFFF 100%);
}
.coupon-list {
padding: 0 28rpx 24rpx 28rpx;
}
.coupon-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 24rpx;
background: linear-gradient(90deg, #A0673E 0%, #8B5A3C 100%);
border-radius: 12rpx;
margin-bottom: 16rpx;
}
.coupon-item:last-child {
margin-bottom: 0;
}
.coupon-label {
font-size: 26rpx;
color: #FFFFFF;
font-weight: 600;
}
.coupon-value {
font-size: 28rpx;
color: #FFE8CC;
font-weight: 700;
}
.coupon-image {
width: 100%;
border-radius: 12rpx;
}
/* 费用明细样式 */
.amount-section {
background: linear-gradient(135deg, #FFFBF5 0%, #FFFFFF 100%);
}
.amount-list {
padding: 16rpx 28rpx 24rpx 28rpx;
}
.amount-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
}
.amount-label {
font-size: 28rpx;
color: #666666;
}
.amount-value {
font-size: 28rpx;
color: #2C2C2C;
font-weight: 500;
}
.amount-divider {
height: 1rpx;
background: linear-gradient(90deg, transparent 0%, #DDDDDD 50%, transparent 100%);
margin: 12rpx 0;
}
.total-amount {
padding: 20rpx 0 8rpx 0;
}
.total-amount .amount-label {
font-size: 30rpx;
color: #2C2C2C;
font-weight: 600;
}
.total-amount .total-price {
display: flex;
align-items: baseline;
}
.total-amount .price-symbol {
font-size: 28rpx;
color: #A0673E;
font-weight: 700;
}
.total-amount .price-number {
font-size: 40rpx;
color: #A0673E;
font-weight: 800;
}
/* 底部占位 */
.bottom-placeholder {
height: 40rpx;
}
/* 确认核销按钮 */
.confirm-button-wrap {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 16rpx 24rpx 32rpx 24rpx;
background: linear-gradient(to top, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 80%, transparent 100%);
z-index: 999;
}
.confirm-button {
width: 100%;
height: 96rpx;
background: linear-gradient(135deg, #A0673E 0%, #8B5A3C 100%);
border-radius: 48rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(139, 90, 60, 0.4);
transition: all 0.3s ease;
}
.confirm-button:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(139, 90, 60, 0.5);
}
.button-text {
font-size: 32rpx;
color: #FFFFFF;
font-weight: 700;
letter-spacing: 4rpx;
}
/* 动画效果 */
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-30rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 兼容旧样式类名 */
.hx-btn {
width: 650rpx;
margin: 0 50rpx 50rpx 50rpx;
background: linear-gradient(135deg, #A0673E 0%, #8B5A3C 100%);
color: #fff;
text-align: center;
height: 88rpx;
line-height: 88rpx;
border-radius: 48rpx;
font-weight: 700;
font-size: 32rpx;
letter-spacing: 2rpx;
box-shadow: 0 8rpx 24rpx rgba(139, 90, 60, 0.4);
}
================================================
FILE: pages/pay/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
wxlogin: true,
switch1 : true, //switch开关
addressList: [],
curAddressData: [],
totalScoreToPay: 0,
goodsList: [],
allGoodsPrice: 0,
amountReal: 0,
yunPrice: 0,
allGoodsAndYunPrice: 0,
goodsJsonStr: "",
orderType: "", //订单类型,购物车下单或立即支付下单,默认是购物车,
pingtuanOpenId: undefined, //拼团的话记录团号
curCoupon: null, // 当前选择使用的优惠券
curCouponShowText: '', // 当前选择使用的优惠券
peisongType: '', // 配送方式 kd,zq 分别表示快递/到店自取【默认值到onshow修改,这里修改无效】
submitLoding: false,
remark: '',
// 会员卡相关
cardMyList: [], // 我的会员卡列表
curCard: null, // 当前选择使用的会员卡
currentDate: new Date().getHours() + ':' + (new Date().getMinutes() % 10 === 0 ? new Date().getMinutes() : Math.ceil(new Date().getMinutes() / 10) * 10),
minHour: new Date().getHours(),
minMinute: new Date().getMinutes(),
formatter(type, value) {
if (type === 'hour') {
return `${value}点`;
} else if (type === 'minute') {
return `${value}分`;
}
return value;
},
filter(type, options) {
if (type === 'minute') {
return options.filter((option) => option % 10 === 0);
}
return options;
},
packaging_fee_use: '1', // 自提需要包装费
tihuodianOpen: false, // 是否开启提货点,后台系统开关参数控制
selectedPickPointId: null, // 选择的提货点ID
},
diningTimeChange(a) {
const selectedHour = a.detail.getColumnValue(0).replace('点', '') * 1
if (selectedHour == new Date().getHours()) {
let minMinute = new Date().getMinutes()
if (minMinute % 10 != 0) {
minMinute = Math.round(minMinute / 10 + 1);
}
this.setData({
minMinute
})
} else {
this.setData({
minMinute: 0
})
}
},
onShow(){
const shopInfo = wx.getStorageSync('shopInfo')
let peisongType = wx.getStorageSync('peisongType')
if (!peisongType) {
peisongType = 'zq' // 此处修改默认值
}
if (shopInfo.openWaimai && !shopInfo.openZiqu) {
peisongType = 'kd'
}
if (!shopInfo.openWaimai && shopInfo.openZiqu) {
peisongType = 'zq'
}
this.setData({
shopInfo,
peisongType
})
this._pickPoints()
AUTH.checkHasLogined().then(isLogined => {
this.setData({
wxlogin: isLogined
})
if (isLogined) {
this.doneShow()
}
})
AUTH.wxaCode().then(code => {
this.data.code = code
})
},
async doneShow() {
let goodsList = [];
const token = wx.getStorageSync('token')
//立即购买下单
if ("buyNow" == this.data.orderType) {
goodsList = wx.getStorageSync('pingtuanGoodsList')
} else {
//购物车下单
const res = await WXAPI.shippingCarInfo(token)
if (res.code == 0) {
goodsList = res.data.items
}
}
this.setData({
goodsList: goodsList
})
this.initShippingAddress()
this.loadCardList()
},
onLoad(e) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.pay.title,
})
let _data = {
kjId: e.kjId,
create_order_select_time: wx.getStorageSync('create_order_select_time'),
packaging_fee: wx.getStorageSync('packaging_fee'),
curCouponShowText: this.data.$t.pay.choose,
tihuodianOpen: wx.getStorageSync('tihuodianOpen'),
}
if (e.orderType) {
_data.orderType = e.orderType
}
if (e.pingtuanOpenId) {
_data.pingtuanOpenId = e.pingtuanOpenId
}
this.setData(_data)
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
getApp().getUserDetailOK = (apiUserInfoMap) => {
this.processGotUserDetail(apiUserInfoMap)
}
this._peisonFeeList()
},
async processGotUserDetail(apiUserInfoMap) {
if (!apiUserInfoMap) {
return
}
this.setData({
nick: apiUserInfoMap.base.nick,
avatarUrl: apiUserInfoMap.base.avatarUrl,
mobile: apiUserInfoMap.base.mobile
})
},
selected(e){
const peisongType = e.currentTarget.dataset.pstype
this.setData({
peisongType
})
wx.setStorageSync('peisongType', peisongType)
this.createOrder()
},
getDistrictId: function (obj, aaa) {
if (!obj) {
return "";
}
if (!aaa) {
return "";
}
return aaa;
},
// 备注
remarkChange(e){
this.data.remark = e.detail.value
},
goCreateOrder(){
if (this.data.submitLoding) return
const mobile = this.data.mobile
if (this.data.peisongType == 'zq' && !mobile) {
wx.showToast({
title: this.data.$t.pay.inputphoneNO,
icon: 'none'
})
return
}
if (!this.data.diningTime && this.data.create_order_select_time == '1') {
wx.showToast({
title: this.data.$t.pay.select,
icon: 'none'
})
return
}
this.setData({
submitLoding: true
})
const subscribe_ids = wx.getStorageSync('subscribe_ids')
if (subscribe_ids) {
wx.requestSubscribeMessage({
tmplIds: subscribe_ids.split(','),
success(res) {},
fail(e) {
this.setData({
submitLoding: false
})
console.error(e)
},
complete: (e) => {
this.createOrder(true)
},
})
} else {
if (this.data.shopInfo.serviceDistance && this.data.distance && this.data.distance > this.data.shopInfo.serviceDistance * 1 && this.data.peisongType == 'kd') {
wx.showToast({
title: this.data.$t.pay.address,
icon: 'none'
})
return
}
this.createOrder(true)
}
},
async createOrder(e) {
var that = this;
var loginToken = wx.getStorageSync('token') // 用户登录 token
var remark = this.data.remark; // 备注信息
const postData = {
token: loginToken,
goodsJsonStr: that.data.goodsJsonStr,
remark: remark,
peisongType: that.data.peisongType,
isCanHx: true
}
if (e && that.data.peisongType == 'zq' && that.data.tihuodianOpen == '1') {
// 开启了自提点的功能
if (!that.data.selectedPickPointId) {
wx.showToast({
title: '请选择提货点',
icon: 'none'
})
return
}
postData.pickPointId = that.data.selectedPickPointId
}
if (this.data.shopInfo) {
if (!this.data.shopInfo.openWaimai && !this.data.shopInfo.openZiqu) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: this.data.$t.pay.servicesclosed,
showCancel: false
})
return;
}
postData.shopIdZt = this.data.shopInfo.id
postData.shopNameZt = this.data.shopInfo.name
}
if (that.data.kjId) {
postData.kjid = that.data.kjId
}
if (that.data.pingtuanOpenId) {
postData.pingtuanOpenId = that.data.pingtuanOpenId
}
const extJsonStr = {}
if (postData.peisongType == 'zq') {
extJsonStr['联系电话'] = this.data.mobile
if (this.data.packaging_fee && this.data.packaging_fee_use == '1') {
postData.trips = this.data.packaging_fee
}
}
if (this.data.create_order_select_time == '1') {
if (postData.peisongType == 'zq') {
extJsonStr['取餐时间'] = this.data.diningTime
} else {
extJsonStr['送达时间'] = this.data.diningTime
}
}
postData.extJsonStr = JSON.stringify(extJsonStr)
// 有设置了配送费的情况下,计算运费
if (this.data.peisonFeeList && postData.peisongType == 'kd') {
let distance = await this.getDistance(this.data.curAddressData)
const peisonFee = this.data.peisonFeeList.find(ele => {
return ele.distance >= distance
})
if (peisonFee) {
postData.peisongFeeId = peisonFee.id
}
}
// 达达配送
if (this.data.shopInfo && this.data.shopInfo.number && this.data.shopInfo.expressType == 'dada' && postData.peisongType == 'kd') {
if (!that.data.curAddressData) {
wx.hideLoading();
wx.showToast({
title: this.data.$t.pay.setaddress,
icon: 'none'
})
return;
}
postData.dadaShopNo = this.data.shopInfo.number
postData.lat = this.data.curAddressData.latitude
postData.lng = this.data.curAddressData.longitude
}
if (e && postData.peisongType == 'kd') {
if (!that.data.curAddressData) {
wx.hideLoading();
wx.showToast({
title: this.data.$t.pay.Receivingaddress,
icon: 'none'
})
return;
}
postData.provinceId = that.data.curAddressData.provinceId;
postData.cityId = that.data.curAddressData.cityId;
if (that.data.curAddressData.districtId) {
postData.districtId = that.data.curAddressData.districtId;
}
postData.address = that.data.curAddressData.address;
postData.linkMan = that.data.curAddressData.linkMan;
postData.mobile = that.data.curAddressData.mobile;
postData.code = that.data.curAddressData.code;
}
if (that.data.curCoupon) {
postData.couponId = that.data.curCoupon.id;
}
if (that.data.curCard) {
postData.cardId = that.data.curCard.id;
}
if (!e) {
postData.calculate = "true";
}
// console.log(postData)
// console.log(e)
WXAPI.orderCreate(postData)
.then(function (res) {
console.log(res.data)
if (res.code != 0) {
wx.showModal({
confirmText: that.data.$t.common.confirm,
cancelText: that.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
return;
}
if (e && "buyNow" != that.data.orderType) {
// 清空购物车数据
WXAPI.shippingCarInfoRemoveAll(loginToken)
}
if (!e) {
const coupons = res.data.couponUserList
if (coupons) {
coupons.forEach(ele => {
let moneyUnit = '元'
if (ele.moneyType == 1) {
moneyUnit = '%'
}
if (ele.moneyHreshold) {
ele.nameExt = ele.name + + ' ['+ that.data.$t.pay.Fullconsumption +'' + ele.moneyHreshold + that.data.$t.pay.RMBreduced + ele.money + moneyUnit +']'
} else {
ele.nameExt = ele.name + ' ['+ that.data.$t.pay.Fullconsumption +'' + ele.money + moneyUnit + ']'
}
})
}
that.setData({
totalScoreToPay: res.data.score,
allGoodsNumber: res.data.goodsNumber,
allGoodsPrice: res.data.amountTotle,
allGoodsAndYunPrice: res.data.amountLogistics + res.data.amountTotle,
yunPrice: res.data.amountLogistics,
peisongfee: res.data.peisongfee,
amountReal: res.data.amountReal,
coupons
});
return;
}
return that.processAfterCreateOrder(res)
})
.finally(() => {
// 再唤起微信支付的时候,有大约1s的弹窗动画过度,加上 1s 的延迟可以稳定防止重复下单
setTimeout(() => {
this.setData({
submitLoding: false
})
}, 1000)
})
},
async processAfterCreateOrder(res) {
const token = wx.getStorageSync('token')
if (res.data.status != 0) {
// 待支付状态才需要支付
wx.redirectTo({
url: "/pages/all-orders/index"
})
return
}
// 直接弹出支付,取消支付的话,去订单列表
const res1 = await WXAPI.userAmount(token)
if (res1.code != 0) {
wx.showToast({
title: this.data.$t.pay.information,
icon: 'none'
})
wx.redirectTo({
url: "/pages/all-orders/index"
});
return
}
const money = res.data.amountReal * 1 - res1.data.balance*1
if (money <= 0) {
// 使用余额支付
await WXAPI.orderPay(token, res.data.id)
// 跳到订单列表
wx.redirectTo({
url: "/pages/all-orders/index"
})
} else {
this.setData({
paymentShow: true,
money,
orderId: res.data.id,
nextAction: {
type: 0,
id: res.data.id
}
})
}
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false
})
wx.redirectTo({
url: '/pages/all-orders/index',
})
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
async getDistance(curAddressData) {
// 计算门店与收货地址之间的距离
if (!this.data.shopInfo || !this.data.shopInfo.latitude || !this.data.shopInfo.longitude || !curAddressData || !curAddressData.latitude || !curAddressData.longitude) {
return 0
}
let distance = 0
const QQ_MAP_KEY = wx.getStorageSync('QQ_MAP_KEY')
if (QQ_MAP_KEY == '1') {
const distanceRes = await WXAPI.gpsDistance({
key: QQ_MAP_KEY,
mode: 'bicycling',
from: this.data.shopInfo.latitude + ',' + this.data.shopInfo.longitude,
to: curAddressData.latitude + ',' + curAddressData.longitude
})
if (distanceRes.code != 0) {
wx.showToast({
title: distanceRes.msg,
icon: 'none'
})
return distance
}
distance = distanceRes.data.result.rows[0].elements[0].distance / 1000.0
return distance
}
// 只能计算直线距离
return this.getDistanceLine(this.data.shopInfo.latitude, this.data.shopInfo.longitude, curAddressData.latitude, curAddressData.longitude) / 1000
},
getDistanceLine(lat1, lng1, lat2, lng2) {
var dis = 0;
var radLat1 = toRadians(lat1);
var radLat2 = toRadians(lat2);
var deltaLat = radLat1 - radLat2;
var deltaLng = toRadians(lng1) - toRadians(lng2);
var dis = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(deltaLat / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(deltaLng / 2), 2)));
return dis * 6378137;
function toRadians(d) {
return d * Math.PI / 180;
}
},
async initShippingAddress() {
const res = await WXAPI.defaultAddress(wx.getStorageSync('token'))
if (res.code == 0) {
// 计算距离
let distance = await this.getDistance(res.data.info)
console.log('distance', distance);
if (this.data.shopInfo.serviceDistance && distance > this.data.shopInfo.serviceDistance * 1 && this.data.peisongType == 'kd') {
wx.showToast({
title: this.data.$t.pay.address,
icon: 'none'
})
}
this.setData({
curAddressData: res.data.info,
distance
})
} else {
this.setData({
curAddressData: null
});
}
this.processYunfei();
},
processYunfei() {
var goodsList = this.data.goodsList
if (goodsList.length == 0) {
return
}
const goodsJsonStr = []
var isNeedLogistics = 0;
let inviter_id = 0;
let inviter_id_storge = wx.getStorageSync('referrer');
if (inviter_id_storge) {
inviter_id = inviter_id_storge;
}
for (let i = 0; i < goodsList.length; i++) {
let carShopBean = goodsList[i];
if (carShopBean.stores < carShopBean.minBuyNumber) {
continue
}
if (carShopBean.logistics || carShopBean.logisticsId) {
isNeedLogistics = 1;
}
const _goodsJsonStr = {
propertyChildIds: carShopBean.propertyChildIds
}
if (carShopBean.sku && carShopBean.sku.length > 0) {
let propertyChildIds = ''
carShopBean.sku.forEach(option => {
propertyChildIds = propertyChildIds + ',' + option.optionId + ':' + option.optionValueId
})
_goodsJsonStr.propertyChildIds = propertyChildIds
}
if (carShopBean.additions && carShopBean.additions.length > 0) {
let goodsAdditionList = []
carShopBean.additions.forEach(option => {
goodsAdditionList.push({
pid: option.pid,
id: option.id
})
})
_goodsJsonStr.goodsAdditionList = goodsAdditionList
}
_goodsJsonStr.goodsId = carShopBean.goodsId
_goodsJsonStr.number = carShopBean.number
_goodsJsonStr.logisticsType = 0
_goodsJsonStr.inviter_id = inviter_id
_goodsJsonStr.goodsTimesDay = carShopBean.goodsTimesDay || ''
_goodsJsonStr.goodsTimesItem = carShopBean.goodsTimesItem || ''
goodsJsonStr.push(_goodsJsonStr)
}
this.setData({
isNeedLogistics: isNeedLogistics,
goodsJsonStr: JSON.stringify(goodsJsonStr)
});
this.createOrder()
},
addAddress: function () {
wx.navigateTo({
url: "/pages/ad/index"
})
},
selectAddress: function () {
wx.navigateTo({
url: "/pages/ad/index"
})
},
bindChangeCoupon: function (e) {
const selIndex = e.detail.value;
this.setData({
curCoupon: this.data.coupons[selIndex],
curCouponShowText: this.data.coupons[selIndex].nameExt
})
this.createOrder()
},
// 加载会员卡列表
async loadCardList() {
const token = wx.getStorageSync('token')
const res = await WXAPI.cardMyList(token)
if (res.code == 0 && res.data && res.data.length > 0) {
// 过滤出可用的会员卡(已激活且有余额/次数)
const availableCards = res.data.filter(card => {
return card.isActive && card.amount > 0
})
this.setData({
cardMyList: availableCards
})
}
},
// 选择会员卡
selectCard: function (e) {
const card = e.currentTarget.dataset.card
this.setData({
curCard: card
})
this.createOrder()
},
// 选择提货点
selectPickPoint: function (e) {
const pickPointId = e.currentTarget.dataset.id;
this.setData({
selectedPickPointId: pickPointId
})
},
async getPhoneNumber(e) {
if (!e.detail.errMsg || e.detail.errMsg != "getPhoneNumber:ok") {
wx.showToast({
title: e.detail.errMsg,
icon: 'none'
})
return;
}
const res = await WXAPI.bindMobileWxapp(wx.getStorageSync('token'), this.data.code, e.detail.encryptedData, e.detail.iv)
AUTH.wxaCode().then(code => {
this.data.code = code
})
if (res.code === 10002) {
wx.showToast({
title: this.data.$t.pay.login,
icon: 'none'
})
return
}
if (res.code == 0) {
wx.showToast({
title: this.data.$t.pay.fetchsuccessful,
icon: 'success'
})
this.setData({
mobile: res.data
})
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
},
diningTimeShow() {
this.setData({
diningTimeShow: true
})
},
diningTimeHide() {
this.setData({
diningTimeShow: false
})
},
diningTimeConfirm(e) {
this.setData({
diningTime: e.detail
})
this.diningTimeHide()
},
updateUserInfo(e) {
wx.getUserProfile({
lang: 'zh_CN',
desc: this.data.$t.pay.memberinformation,
success: res => {
console.log(res);
this._updateUserInfo(res.userInfo)
},
fail: err => {
wx.showToast({
title: err.errMsg,
icon: 'none'
})
}
})
},
async _updateUserInfo(userInfo) {
const postData = {
token: wx.getStorageSync('token'),
nick: userInfo.nickName,
avatarUrl: userInfo.avatarUrl,
city: userInfo.city,
province: userInfo.province,
gender: userInfo.gender,
}
// https://www.yuque.com/apifm/nu0f75/ykr2zr
const res = await WXAPI.modifyUserInfoV2(postData)
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
wx.showToast({
title: this.data.$t.pay.Loginsuccessful,
})
getApp().getUserApiInfo().then(apiUserInfoMap => {
this.processGotUserDetail(apiUserInfoMap)
})
},
async _peisonFeeList() {
// https://www.yuque.com/apifm/nu0f75/nx465k
const res = await WXAPI.peisonFeeList()
if (res.code == 0) {
this.data.peisonFeeList = res.data
}
},
packaging_fee_Change(event) {
this.setData({
packaging_fee_use: event.detail,
})
this.createOrder()
},
packaging_fee_Click(event) {
const { name } = event.currentTarget.dataset;
this.setData({
packaging_fee_use: name,
})
this.createOrder()
},
async _pickPoints() {
// 获取提货点列表 https://www.yuque.com/apifm/nu0f75/hm3exv
const res = await WXAPI.pickPoints({
shopIds: '0,' + this.data.shopInfo.id
})
if (res.code == 0) {
this.setData({
pickPoints: res.data.result
})
}
},
})
================================================
FILE: pages/pay/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/pay/index.wxml
================================================
配送方式
{{ $t.index.pickup }}
{{ $t.index.Delivery }}
{{ $t.pay.Addaddress }}
{{curAddressData.linkMan}} {{curAddressData.mobile}}
{{curAddressData.address}}
{{ $t.pay.reBind }}
选择提货点
{{item.name}}
{{item.address}}
{{ peisongType == 'zq' ? $t.pay.Mealtime : $t.pay.Deliverytime }}
{{ diningTime ? diningTime : $t.common.select }}
商品清单
{{item.name}}
{{ $t.goodsDetail.storeing }}
{{item.label}}
{{option.optionName}}:{{option.optionValueName}}
{{option.pname}}:{{option.name}}
×{{item.number}}
¥{{item.price}}
{{ $t.pay.Total }}
×{{allGoodsNumber}}
¥{{allGoodsPrice}}
{{ $t.coupons.title }}
{{curCouponShowText}}
不使用会员卡
使用其他支付方式
{{item.cardInfo.name}}
{{item.cardInfo.type == 0 ? '次卡' : '储值卡'}}
剩余 {{item.amount}} 次
余额 ¥{{item.amount}}
| 至 {{item.dateEnd}}
{{ $t.pay.Insulationbag }}
{{ $t.pay.Needbag }}
{{ $t.pay.UNneedbag }}
{{ $t.pay.DeliveryFee }}
¥{{ yunPrice }}
{{ peisongfee.fwf1Name }}
¥{{ peisongfee.amount1 }}
{{ peisongfee.fwf2Name }}
¥{{ peisongfee.amount2 }}
{{ peisongfee.fwf3Name }}
¥{{ peisongfee.amount3 }}
================================================
FILE: pages/pay/index.wxss
================================================
page {
background: linear-gradient(180deg, #FFF8F0 0%, #F5F5F5 100%);
min-height: 100vh;
padding-bottom: 140rpx;
}
/* ========== 店铺信息卡片 ========== */
.shop-card {
margin: 24rpx 24rpx 20rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFFAF5 100%);
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.shop-header {
display: flex;
align-items: center;
padding: 32rpx;
position: relative;
text-decoration: none;
color: inherit;
}
.shop-icon {
width: 88rpx;
height: 88rpx;
background: linear-gradient(135deg, #F5E6D3 0%, #E8D4B8 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
box-shadow: 0 4rpx 12rpx rgba(139, 90, 60, 0.15);
}
.shop-info {
flex: 1;
overflow: hidden;
}
.shop-name {
font-size: 32rpx;
font-weight: 600;
color: #2C2C2C;
margin-bottom: 12rpx;
display: flex;
align-items: center;
}
.distance {
font-size: 24rpx;
color: #D4A574;
font-weight: 500;
margin-left: 12rpx;
background: rgba(212, 165, 116, 0.1);
padding: 4rpx 12rpx;
border-radius: 12rpx;
}
.shop-address {
font-size: 26rpx;
color: #999;
line-height: 1.5;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.arrow-icon {
margin-left: 16rpx;
}
/* ========== 配送方式卡片 ========== */
.delivery-card {
margin: 0 24rpx 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.card-title {
font-size: 32rpx;
font-weight: 600;
color: #2C2C2C;
margin-bottom: 24rpx;
position: relative;
padding-left: 20rpx;
}
.card-title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 32rpx;
background: linear-gradient(180deg, #D4A574 0%, #C99960 100%);
border-radius: 4rpx;
}
.delivery-options {
display: flex;
gap: 20rpx;
margin-bottom: 8rpx;
}
.delivery-option {
flex: 1;
height: 140rpx;
background: #FAFAFA;
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
border: 2rpx solid transparent;
}
.delivery-option.active {
background: linear-gradient(135deg, #D4A574 0%, #C99960 100%);
border-color: #D4A574;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.3);
transform: translateY(-4rpx);
}
.option-icon {
margin-bottom: 12rpx;
}
.option-text {
font-size: 28rpx;
font-weight: 500;
color: #666;
}
.delivery-option.active .option-text {
color: #FFFFFF;
font-weight: 600;
}
/* 分割线 */
.section-divider {
height: 1rpx;
background: linear-gradient(90deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.06) 50%,
rgba(0, 0, 0, 0) 100%
);
margin: 32rpx 0 24rpx;
}
/* 地址部分 */
.address-section {
margin-top: 8rpx;
}
.address-content {
min-height: 100rpx;
display: flex;
align-items: center;
}
.add-address-btn {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
padding: 24rpx 0;
background: linear-gradient(135deg, #FFFAF5 0%, #FFF5EB 100%);
border-radius: 16rpx;
border: 2rpx dashed #D4A574;
}
.add-text {
font-size: 28rpx;
color: #D4A574;
margin-left: 12rpx;
font-weight: 500;
}
.address-detail {
padding: 16rpx 0;
}
.address-left {
flex: 1;
display: flex;
align-items: flex-start;
}
.address-icon {
margin-right: 16rpx;
margin-top: 4rpx;
}
.address-info {
flex: 1;
}
.contact-info {
font-size: 30rpx;
color: #2C2C2C;
font-weight: 600;
margin-bottom: 12rpx;
}
.address-text {
font-size: 26rpx;
color: #666;
line-height: 1.6;
}
.address-right {
margin-left: 16rpx;
}
/* 手机号部分 */
.phone-section {
margin-top: 8rpx;
}
/* 时间选择 */
.time-section {
margin-top: 8rpx;
}
.time-selector {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
}
.time-label {
display: flex;
align-items: center;
font-size: 28rpx;
color: #2C2C2C;
font-weight: 500;
}
.time-label text {
margin-left: 12rpx;
}
.time-value {
display: flex;
align-items: center;
}
.time-value text {
font-size: 28rpx;
margin-right: 8rpx;
}
.time-value .selected {
color: #D4A574;
font-weight: 600;
}
.time-value .placeholder {
color: #999;
}
/* ========== 商品清单卡片 ========== */
.goods-card {
margin: 0 24rpx 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.goods-card .card-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32rpx;
}
.title-decoration {
width: 80rpx;
height: 6rpx;
background: linear-gradient(90deg, #D4A574 0%, transparent 100%);
border-radius: 3rpx;
}
.goods-list {
margin-bottom: 24rpx;
}
.goods-item {
padding: 24rpx 0;
border-bottom: 1rpx solid #F5F5F5;
}
.goods-item:last-child {
border-bottom: none;
}
.goods-main {
display: flex;
align-items: flex-start;
}
.goods-info {
flex: 1;
min-width: 0;
margin-right: 16rpx;
}
.goods-name {
font-size: 30rpx;
color: #2C2C2C;
font-weight: 500;
margin-bottom: 12rpx;
line-height: 1.4;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8rpx;
}
.goods-name.quehuo {
text-decoration: line-through;
color: #BBB;
}
.goods-specs {
font-size: 24rpx;
color: #999;
line-height: 1.6;
}
.goods-quantity {
font-size: 28rpx;
color: #666;
margin-right: 32rpx;
min-width: 60rpx;
text-align: center;
}
.goods-price {
font-size: 32rpx;
color: #D4A574;
font-weight: 600;
min-width: 100rpx;
text-align: right;
}
.goods-total {
display: flex;
align-items: center;
justify-content: flex-end;
padding: 24rpx 0 8rpx;
border-top: 1rpx solid #F5F5F5;
}
.total-label {
font-size: 28rpx;
color: #666;
margin-right: 16rpx;
}
.total-quantity {
font-size: 28rpx;
color: #666;
margin-right: 32rpx;
}
.total-price {
font-size: 36rpx;
color: #D4A574;
font-weight: 700;
}
/* ========== 优惠券卡片 ========== */
.coupon-card {
margin: 0 24rpx 20rpx;
background: linear-gradient(135deg, #FFF9F0 0%, #FFFFFF 100%);
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 4rpx 20rpx rgba(212, 165, 116, 0.1);
}
.coupon-selector {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
}
.coupon-left {
display: flex;
align-items: center;
}
.coupon-label {
font-size: 28rpx;
color: #2C2C2C;
font-weight: 500;
margin-left: 12rpx;
}
.coupon-right {
display: flex;
align-items: center;
}
.coupon-value {
font-size: 26rpx;
color: #D4A574;
font-weight: 600;
margin-right: 8rpx;
max-width: 300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ========== 会员卡选择卡片 ========== */
.card-select-card {
margin: 0 24rpx 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.card-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
}
.card-title-text {
font-size: 32rpx;
font-weight: 600;
color: #2C2C2C;
margin-left: 12rpx;
}
.card-list-wrapper {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.card-item {
background: #FAFAFA;
border-radius: 20rpx;
border: 2rpx solid transparent;
transition: all 0.3s ease;
overflow: hidden;
}
.card-item.active {
background: linear-gradient(135deg, #FFF9F0 0%, #FFF5EB 100%);
border-color: #D4A574;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.2);
}
.card-item-content {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 20rpx;
}
.card-item-left {
flex: 1;
display: flex;
align-items: center;
min-width: 0;
}
.card-item-icon {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
flex-shrink: 0;
}
.card-item-icon.no-card {
background: linear-gradient(135deg, #F5F5F5 0%, #E8E8E8 100%);
}
.card-item-icon.times-card-icon {
background: linear-gradient(135deg, #66BB6A 0%, #43A047 100%);
box-shadow: 0 4rpx 12rpx rgba(67, 160, 71, 0.3);
}
.card-item-icon.balance-card-icon {
background: linear-gradient(135deg, #FFA726 0%, #FB8C00 100%);
box-shadow: 0 4rpx 12rpx rgba(251, 140, 0, 0.3);
}
.card-item-info {
flex: 1;
min-width: 0;
}
.card-item-name {
font-size: 30rpx;
color: #2C2C2C;
font-weight: 600;
margin-bottom: 8rpx;
display: flex;
align-items: center;
gap: 8rpx;
}
.card-type-tag {
padding: 4rpx 12rpx;
border-radius: 8rpx;
font-size: 20rpx;
}
.card-type-tag.times-tag {
background: rgba(67, 160, 71, 0.15);
color: #2E7D32;
}
.card-type-tag.balance-tag {
background: rgba(251, 140, 0, 0.15);
color: #E65100;
}
.card-item-desc {
font-size: 24rpx;
color: #666;
line-height: 1.5;
}
.card-expire {
color: #999;
margin-left: 8rpx;
}
.card-item-radio {
margin-left: 16rpx;
flex-shrink: 0;
}
/* ========== 保温袋卡片 ========== */
.bag-card {
margin: 0 24rpx 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.bag-options {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.bag-option {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 24rpx;
background: #FAFAFA;
border-radius: 16rpx;
transition: all 0.3s ease;
}
.bag-text {
font-size: 28rpx;
color: #2C2C2C;
}
/* ========== 费用明细卡片 ========== */
.fee-card {
margin: 0 24rpx 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.fee-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1rpx solid #F5F5F5;
}
.fee-item:last-child {
border-bottom: none;
}
.fee-label {
font-size: 28rpx;
color: #666;
}
.fee-value {
font-size: 32rpx;
color: #D4A574;
font-weight: 600;
}
/* ========== 备注卡片 ========== */
.remark-card {
margin: 0 24rpx 20rpx;
background: #FFFFFF;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 4rpx 20rpx rgba(139, 90, 60, 0.08);
}
.remark-container {
display: flex;
align-items: center;
padding: 24rpx 32rpx;
}
.remark-icon {
margin-right: 12rpx;
}
/* ========== 底部提交栏 ========== */
.bottom {
height: 120rpx;
}
.pay-btn {
background: linear-gradient(135deg, #D4A574 0%, #C99960 100%) !important;
border: none !important;
border-radius: 40rpx !important;
font-weight: 600 !important;
font-size: 32rpx !important;
box-shadow: 0 8rpx 24rpx rgba(212, 165, 116, 0.3) !important;
}
/* ========== 自定义按钮样式 ========== */
.phone-btn {
background: linear-gradient(135deg, #D4A574 0%, #C99960 100%) !important;
color: #FFFFFF !important;
border: none !important;
font-weight: 500 !important;
padding: 0 24rpx !important;
height: 56rpx !important;
line-height: 56rpx !important;
}
/* ========== 通用样式 ========== */
.red {
color: #D4A574 !important;
}
.quehuo {
text-decoration: line-through;
color: #BBB;
}
/* ========== 动画效果 ========== */
.shop-card,
.delivery-card,
.goods-card,
.coupon-card,
.bag-card,
.fee-card,
.remark-card {
animation: fadeInUp 0.5s ease-out;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ========== 提货点选择 ========== */
.pickpoint-section {
margin-top: 8rpx;
}
.section-title {
font-size: 28rpx;
color: #2C2C2C;
font-weight: 600;
margin-bottom: 24rpx;
padding-left: 4rpx;
}
.pickpoint-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.pickpoint-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 20rpx;
background: #FAFAFA;
border-radius: 16rpx;
border: 2rpx solid transparent;
transition: all 0.3s ease;
}
.pickpoint-item.active {
background: linear-gradient(135deg, #FFF9F0 0%, #FFF5EB 100%);
border-color: #D4A574;
box-shadow: 0 4rpx 16rpx rgba(212, 165, 116, 0.2);
}
.pickpoint-info {
flex: 1;
min-width: 0;
}
.pickpoint-name {
font-size: 30rpx;
color: #2C2C2C;
font-weight: 600;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.pickpoint-address {
font-size: 26rpx;
color: #666;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.pickpoint-radio {
margin-left: 16rpx;
}
/* ========== 响应式优化 ========== */
@media (max-width: 375px) {
.shop-name {
font-size: 30rpx;
}
.card-title {
font-size: 30rpx;
}
.goods-name {
font-size: 28rpx;
}
.pickpoint-name {
font-size: 28rpx;
}
.pickpoint-address {
font-size: 24rpx;
}
}
================================================
FILE: pages/queue/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
Page({
data: {
},
onLoad: function (options) {
},
onShow: function () {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.queue.t,
})
AUTH.checkHasLogined().then(isLogin => {
if (isLogin) {
this.queuingTypes()
this.queuingMy()
AUTH.bindSeller()
} else {
AUTH.authorize().then(res => {
this.queuingTypes()
this.queuingMy()
AUTH.bindSeller()
})
}
})
},
async queuingTypes() {
wx.showLoading({
title: '',
})
const res = await WXAPI.queuingTypes()
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
this.setData({
list: res.data
})
}
},
async queuingMy() {
const res = await WXAPI.queuingMy(wx.getStorageSync('token'))
if (res.code == 0) {
const mylist = []
res.data.forEach(ele => {
const queuingLog = ele.queuingLog
const queuingUpType = ele.queuingUpType
const waitMinitus = (queuingLog.number - queuingUpType.curNumber -1) * queuingUpType.minitus
if (waitMinitus) {
queuingLog.waitMinitus = waitMinitus
}
queuingLog.typeEntity = queuingUpType
mylist.push(queuingLog)
})
this.setData({
mylist
})
}
},
async queuingGet(e) {
const index = e.currentTarget.dataset.index
const queueType = this.data.list[index]
const isLogined = await AUTH.checkHasLogined()
if (!isLogined) {
AUTH.login(this)
return
}
wx.showLoading({
title: '',
})
const res = await WXAPI.queuingGet(wx.getStorageSync('token'), queueType.id)
wx.hideLoading({
success: (res) => {},
})
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
} else {
wx.showToast({
title: this.data.$t.queue.success
})
this.queuingMy()
}
},
})
================================================
FILE: pages/queue/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/queue/index.wxml
================================================
🍵
{{ $t.common.empty }}
选择取号类型
☕
{{ item.name }}
点击立即取号
{{ item.curNumber }}
/ {{ item.numberGet }}
当前排队
{{ $t.queue.myNumber }}
{{ item.statusStr }}
⏱
{{ $t.queue.ExpectedWaiting }}: {{ item.waitMinitus }}{{ $t.queue.minutes }}
================================================
FILE: pages/queue/index.wxss
================================================
/* 页面容器 */
.queue-container {
min-height: 100vh;
background: linear-gradient(180deg, #FFF5F0 0%, #FFF9F6 50%, #FFFFFF 100%);
padding-bottom: 40rpx;
}
/* 头部区域 */
.header-section {
position: relative;
padding: 60rpx 0 80rpx;
text-align: center;
overflow: hidden;
}
.header-decoration {
position: absolute;
top: -100rpx;
left: 50%;
transform: translateX(-50%);
width: 400rpx;
height: 400rpx;
background: radial-gradient(circle, rgba(199, 147, 115, 0.1) 0%, transparent 70%);
border-radius: 50%;
}
.header-title {
position: relative;
z-index: 1;
}
.title-main {
font-size: 56rpx;
font-weight: 600;
color: #4A3428;
letter-spacing: 4rpx;
margin-bottom: 8rpx;
}
.title-sub {
font-size: 24rpx;
color: #C79373;
letter-spacing: 6rpx;
font-weight: 300;
}
/* 内容区域 */
.queue-content {
padding: 0 32rpx;
}
/* 空状态 */
.empty-state {
text-align: center;
padding: 120rpx 0;
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 24rpx;
opacity: 0.6;
}
.empty-text {
font-size: 28rpx;
color: #999;
}
/* 分区标题 */
.section-title {
display: flex;
align-items: center;
margin-bottom: 32rpx;
padding-left: 8rpx;
}
.title-dot {
width: 8rpx;
height: 32rpx;
background: linear-gradient(180deg, #C79373 0%, #D4A574 100%);
border-radius: 4rpx;
margin-right: 16rpx;
}
.section-title text {
font-size: 32rpx;
font-weight: 600;
color: #4A3428;
}
/* 取号卡片区域 */
.queue-cards {
margin-bottom: 60rpx;
}
.card-item {
position: relative;
background: #FFFFFF;
border-radius: 24rpx;
margin-bottom: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(199, 147, 115, 0.12);
transition: all 0.3s ease;
}
.card-item:active {
transform: scale(0.98);
box-shadow: 0 4rpx 16rpx rgba(199, 147, 115, 0.2);
}
.card-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 28rpx;
position: relative;
z-index: 1;
}
.card-left {
display: flex;
align-items: center;
flex: 1;
}
.card-icon {
font-size: 64rpx;
margin-right: 24rpx;
filter: grayscale(0.2);
}
.card-info {
flex: 1;
}
.card-name {
font-size: 32rpx;
font-weight: 600;
color: #4A3428;
margin-bottom: 8rpx;
}
.card-desc {
font-size: 24rpx;
color: #999;
}
.card-right {
text-align: right;
padding-left: 24rpx;
}
.queue-number {
display: flex;
align-items: baseline;
justify-content: flex-end;
margin-bottom: 8rpx;
}
.current-num {
font-size: 48rpx;
font-weight: 700;
color: #C79373;
line-height: 1;
}
.total-num {
font-size: 28rpx;
color: #999;
margin-left: 4rpx;
}
.queue-label {
font-size: 22rpx;
color: #999;
}
.card-shine {
position: absolute;
top: 0;
right: -100rpx;
width: 200rpx;
height: 100%;
background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
transform: skewX(-20deg);
opacity: 0;
transition: all 0.6s ease;
}
.card-item:active .card-shine {
right: 100%;
opacity: 1;
}
/* 我的号码区域 */
.my-queue-section {
margin-top: 60rpx;
}
.my-queue-cards {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.my-queue-card {
position: relative;
background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F6 100%);
border-radius: 24rpx;
padding: 32rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(199, 147, 115, 0.15);
border: 2rpx solid rgba(199, 147, 115, 0.1);
}
.my-card-bg-decoration {
position: absolute;
top: -40rpx;
right: -40rpx;
width: 160rpx;
height: 160rpx;
background: radial-gradient(circle, rgba(199, 147, 115, 0.08) 0%, transparent 70%);
border-radius: 50%;
}
.my-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
position: relative;
z-index: 1;
}
.my-card-type {
font-size: 32rpx;
font-weight: 600;
color: #4A3428;
}
.my-card-number {
font-size: 56rpx;
font-weight: 700;
color: #C79373;
font-family: 'DIN Alternate', -apple-system, sans-serif;
}
.my-card-status {
display: flex;
align-items: center;
gap: 16rpx;
flex-wrap: wrap;
position: relative;
z-index: 1;
}
.status-tag {
display: inline-block;
padding: 8rpx 20rpx;
background: linear-gradient(135deg, #FFE8DC 0%, #FFD4C4 100%);
color: #C79373;
font-size: 24rpx;
font-weight: 500;
border-radius: 32rpx;
}
.wait-time {
display: flex;
align-items: center;
font-size: 26rpx;
color: #666;
}
.wait-icon {
margin-right: 8rpx;
font-size: 28rpx;
}
/* 响应式调整 */
@media (max-width: 320px) {
.title-main {
font-size: 48rpx;
}
.card-name {
font-size: 28rpx;
}
.current-num {
font-size: 42rpx;
}
}
/* 过渡动画 */
.card-item,
.my-queue-card {
animation: fadeInUp 0.5s ease-out;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
================================================
FILE: pages/score/logs.js
================================================
const APP = getApp()
const WXAPI = require('apifm-wxapi')
// fixed首次打开不显示标题的bug
APP.configLoadOK = () => {
}
Page({
/**
* 页面的初始数据
*/
data: {
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.scoreLogs.title,
})
this.scoreLogs()
},
onShow: function () {
},
async scoreLogs() {
wx.showLoading({
title: '',
})
const res = await WXAPI.scoreLogs({
token: wx.getStorageSync('token'),
page:1,
pageSize:500
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
scoreLogs: res.data.result
})
}
},
})
================================================
FILE: pages/score/logs.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/score/logs.wxml
================================================
{{item.score > 0 ? '+' : '-'}}
{{item.typeStr}}
{{item.dateAdd}}
{{item.score > 0 ? '+' : ''}}{{item.score}}
积分
📝
暂无积分记录
快去购买奶茶赚取积分吧
================================================
FILE: pages/score/logs.wxss
================================================
/* pages/score/logs.wxss */
page {
background: linear-gradient(180deg, #FFF5E6 0%, #FFFFFF 35%);
min-height: 100vh;
}
.score-logs-container {
width: 100%;
min-height: 100vh;
padding-bottom: 40rpx;
}
/* 顶部装饰背景 */
.header-decoration {
width: 100%;
height: 240rpx;
position: relative;
overflow: hidden;
background: linear-gradient(135deg, #FFB84D 0%, #FF9A4D 100%);
}
.wave-bg {
width: 100%;
height: 100%;
position: absolute;
bottom: -2rpx;
left: 0;
background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}
.wave-bg::before {
content: '';
position: absolute;
width: 200%;
height: 120rpx;
bottom: 0;
left: -50%;
background: #FFFFFF;
border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
/* 内容区域 */
.logs-content {
width: 100%;
padding: 0 30rpx;
margin-top: -60rpx;
position: relative;
z-index: 10;
}
/* 列表容器 */
.logs-list {
width: 100%;
}
/* 单条记录 */
.log-item {
width: 100%;
margin-bottom: 24rpx;
animation: slideUp 0.4s ease-out;
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.log-card {
width: 100%;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx 28rpx;
box-shadow: 0 4rpx 20rpx rgba(255, 154, 77, 0.08);
display: flex;
align-items: center;
justify-content: space-between;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.log-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 6rpx;
height: 100%;
background: linear-gradient(180deg, #FFB84D 0%, #FF9A4D 100%);
}
.log-card:active {
transform: scale(0.98);
box-shadow: 0 2rpx 12rpx rgba(255, 154, 77, 0.12);
}
/* 左侧内容 */
.log-left {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
.icon-wrapper {
width: 88rpx;
height: 88rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
flex-shrink: 0;
position: relative;
overflow: hidden;
}
.icon-wrapper::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0.15;
}
.icon-add {
background: linear-gradient(135deg, #FFF3E6 0%, #FFE8CC 100%);
}
.icon-add::before {
background: #FFB84D;
}
.icon-minus {
background: linear-gradient(135deg, #F5F5F5 0%, #ECECEC 100%);
}
.icon-minus::before {
background: #999999;
}
.icon-text {
font-size: 48rpx;
font-weight: 600;
position: relative;
z-index: 1;
}
.icon-add .icon-text {
color: #FFB84D;
}
.icon-minus .icon-text {
color: #999999;
}
.info-wrapper {
flex: 1;
min-width: 0;
}
.type-text {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
letter-spacing: 0.5rpx;
}
.date-text {
font-size: 24rpx;
color: #999999;
letter-spacing: 0.5rpx;
}
/* 右侧积分 */
.log-right {
display: flex;
flex-direction: column;
align-items: flex-end;
flex-shrink: 0;
margin-left: 20rpx;
}
.score-value {
font-size: 40rpx;
font-weight: 700;
margin-bottom: 4rpx;
font-family: 'DIN Alternate', 'Helvetica Neue', Arial, sans-serif;
letter-spacing: 1rpx;
}
.score-add {
color: #FFB84D;
}
.score-minus {
color: #999999;
}
.score-label {
font-size: 22rpx;
color: #CCCCCC;
letter-spacing: 1rpx;
}
/* 空状态 */
.empty-state {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 160rpx 60rpx;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 4rpx 20rpx rgba(255, 154, 77, 0.06);
}
.empty-icon {
font-size: 120rpx;
margin-bottom: 32rpx;
opacity: 0.6;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-10rpx);
}
}
.empty-text {
font-size: 32rpx;
color: #666666;
font-weight: 600;
margin-bottom: 16rpx;
letter-spacing: 1rpx;
}
.empty-desc {
font-size: 26rpx;
color: #999999;
letter-spacing: 0.5rpx;
}
================================================
FILE: pages/shop/detail.js
================================================
const WXAPI = require('apifm-wxapi')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
markers: [],
},
onLoad: function (options) {
getApp().initLanguage(this)
// options.id = 36
this.data.id = options.id
this.shopSubdetail()
},
async shopSubdetail() {
const res = await WXAPI.shopSubdetail(this.data.id)
if (res.code != 0) {
wx.showModal({
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
wx.navigateBack()
} else {
wx.setNavigationBarTitle({
title: res.data.info.name,
})
const marker = {
latitude: res.data.info.latitude,
longitude: res.data.info.longitude,
iconPath: wx.getStorageSync('mapPos'),
height: 30,
width: 30,
}
const markers = [marker]
this.setData({
shopSubdetailData: res.data,
shopInfo: res.data.info,
markers
})
}
},
//
phoneCall:function(){
var phoneNumber = this.data.shopInfo.linkPhone
wx.makePhoneCall({
phoneNumber,
// phoneNumber: phoneNumber,
})
},
//
guideNow: function(){
var name = this.data.shopInfo.name
var address = this.data.shopInfo.address
var latitude = this.data.shopInfo.latitude
var longitude = this.data.shopInfo.longitude
wx.openLocation({
name: name,
address: address,
latitude: latitude,
longitude: longitude,
})
},
})
================================================
FILE: pages/shop/detail.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/shop/detail.wxml
================================================
{{shopInfo.name}}
✨
{{shopInfo.characteristic}}
📞
{{ $t.shop.contactUs || '联系电话' }}
{{shopInfo.linkPhone}}
🧭
{{ $t.shop.Navigation || '到店导航' }}
{{ $t.shop.viewMap || '查看地图' }}
门店信息
🕐
{{ $t.shop.openingHours || '营业时间' }}
{{shopInfo.openingHours}}
📍
{{ $t.shop.address || '门店地址' }}
{{shopInfo.address}}
================================================
FILE: pages/shop/detail.wxss
================================================
/* 页面容器 */
.container {
width: 100vw;
min-height: 100vh;
background: linear-gradient(180deg, #FFF8F0 0%, #FFFFFF 100%);
}
/* 顶部图片区域 */
.header-section {
position: relative;
width: 100%;
height: 500rpx;
overflow: hidden;
}
.shop-cover {
width: 100%;
height: 100%;
}
.cover-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 150rpx;
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 100%);
}
/* 门店信息卡片 */
.shop-card {
position: relative;
margin: -80rpx 30rpx 24rpx;
padding: 40rpx 32rpx;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(210, 180, 140, 0.15);
}
.shop-title-area {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.shop-name {
font-size: 40rpx;
font-weight: 600;
color: #3D2817;
line-height: 56rpx;
letter-spacing: 1rpx;
}
.shop-tag {
display: inline-flex;
align-items: center;
align-self: flex-start;
padding: 12rpx 24rpx;
background: linear-gradient(135deg, #FFE8D1 0%, #FFD4A8 100%);
border-radius: 50rpx;
gap: 8rpx;
}
.tag-icon {
font-size: 24rpx;
}
.tag-text {
font-size: 24rpx;
color: #8B5A2B;
font-weight: 500;
}
/* 快捷操作按钮 */
.action-buttons {
display: flex;
margin: 0 30rpx 24rpx;
padding: 32rpx;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(210, 180, 140, 0.15);
}
.action-btn {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 12rpx;
padding: 16rpx 0;
transition: all 0.3s;
}
.action-btn:active {
opacity: 0.7;
transform: scale(0.95);
}
.btn-icon {
font-size: 48rpx;
margin-bottom: 8rpx;
}
.btn-text {
font-size: 28rpx;
color: #3D2817;
font-weight: 500;
}
.btn-sub-text {
font-size: 22rpx;
color: #999999;
margin-top: 4rpx;
max-width: 240rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.action-divider {
width: 2rpx;
height: 100rpx;
background: linear-gradient(to bottom, rgba(210, 180, 140, 0) 0%, rgba(210, 180, 140, 0.3) 50%, rgba(210, 180, 140, 0) 100%);
}
/* 详细信息区域 */
.detail-section {
margin: 0 30rpx 24rpx;
padding: 40rpx 32rpx;
background: #FFFFFF;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(210, 180, 140, 0.15);
}
.detail-title {
font-size: 32rpx;
font-weight: 600;
color: #3D2817;
margin-bottom: 32rpx;
padding-bottom: 24rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.info-item {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 24rpx 0;
border-bottom: 1rpx solid #F8F8F8;
}
.info-item:last-child {
border-bottom: none;
padding-bottom: 0;
}
.info-label {
display: flex;
align-items: center;
gap: 12rpx;
font-size: 26rpx;
color: #666666;
font-weight: 500;
}
.label-icon {
font-size: 28rpx;
}
.info-value {
font-size: 28rpx;
color: #333333;
line-height: 44rpx;
padding-left: 40rpx;
}
/* 地图区域 */
.map-section {
margin: 0 30rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(210, 180, 140, 0.15);
}
.map-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx;
background: linear-gradient(135deg, #FFF8F0 0%, #FFFFFF 100%);
}
.map-title {
font-size: 32rpx;
font-weight: 600;
color: #3D2817;
}
.map-tip {
font-size: 24rpx;
color: #D2691E;
font-weight: 500;
padding: 8rpx 16rpx;
background: rgba(255, 228, 196, 0.5);
border-radius: 20rpx;
}
.map-container {
width: 100%;
height: 500rpx;
border-top: 1rpx solid #F5F5F5;
}
/* 底部安全距离 */
.safe-bottom {
height: 40rpx;
}
================================================
FILE: pages/shop/join-apply.js
================================================
const WXAPI = require('apifm-wxapi')
Page({
data: {
autosize: {
minHeight: 100
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.shop.join,
})
},
onShow: function() {
},
async bindSave() {
if (!this.data.name) {
wx.showToast({
title: this.data.$t.shop.nameRequired,
icon: 'none',
})
return
}
if (!this.data.mobile) {
wx.showToast({
title: this.data.$t.shop.mobileRequired,
icon: 'none',
})
return
}
if (!this.data.content) {
this.data.content = '申请入驻'
}
if (!this.data.content) {
wx.showToast({
title: this.data.$t.shop.contentRequired,
icon: 'none',
})
return
}
const extJsonStr = {}
extJsonStr['姓名'] = this.data.name
extJsonStr['联系电话'] = this.data.mobile
// 批量上传附件
if (this.data.picsList) {
for (let index = 0; index < this.data.picsList.length; index++) {
const pic = this.data.picsList[index];
const res = await WXAPI.uploadFileV2(wx.getStorageSync('token'), pic.url)
if (res.code == 0) {
extJsonStr['file' + index] = res.data.url
}
}
}
const res = await WXAPI.addComment({
token: wx.getStorageSync('token'),
type: 1,
extJsonStr: JSON.stringify(extJsonStr),
content: this.data.content
})
if (res.code == 0) {
wx.showToast({
title: this.data.$t.common.submitSuccess,
})
setTimeout(() => {
wx.navigateBack({
delta: 0,
})
}, 1000);
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
},
afterPicRead(e) {
let picsList = this.data.picsList
if (!picsList) {
picsList = []
}
picsList = picsList.concat(e.detail.file)
this.setData({
picsList
})
},
afterPicDel(e) {
let picsList = this.data.picsList
picsList.splice(e.detail.index, 1)
this.setData({
picsList
})
}
})
================================================
FILE: pages/shop/join-apply.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/shop/join-apply.wxml
================================================
🍵
商家入驻申请
加入我们,开启您的甜蜜事业
基本信息
👤
{{ $t.shop.name }}
*
📱
{{ $t.shop.mobile }}
*
店铺资料
📸
店铺照片
(营业执照、店铺照片等)
✍️
申请说明
*
💡 温馨提示
• 请确保提供的信息真实有效
• 我们将在1-3个工作日内审核您的申请
• 审核结果将通过短信或站内消息通知
{{ $t.shop.joinBtn }}
================================================
FILE: pages/shop/join-apply.wxss
================================================
/* 整体容器 */
.join-apply-container {
min-height: 100vh;
background: linear-gradient(135deg, #FFF5E6 0%, #FFE4D6 50%, #FFF8F0 100%);
padding-bottom: 40rpx;
position: relative;
overflow: hidden;
}
/* 顶部装饰背景 */
.header-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 400rpx;
overflow: hidden;
}
.bubble {
position: absolute;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
animation: float 6s ease-in-out infinite;
}
.bubble-1 {
width: 120rpx;
height: 120rpx;
top: 50rpx;
left: 30rpx;
animation-delay: 0s;
}
.bubble-2 {
width: 180rpx;
height: 180rpx;
top: 150rpx;
right: 40rpx;
animation-delay: 2s;
}
.bubble-3 {
width: 90rpx;
height: 90rpx;
top: 280rpx;
left: 50%;
animation-delay: 4s;
}
@keyframes float {
0%, 100% {
transform: translateY(0) scale(1);
opacity: 0.5;
}
50% {
transform: translateY(-30rpx) scale(1.1);
opacity: 0.8;
}
}
/* 欢迎标题区域 */
.welcome-section {
position: relative;
z-index: 10;
padding: 60rpx 0 50rpx;
text-align: center;
}
.icon-wrapper {
margin-bottom: 24rpx;
animation: bounce 2s ease-in-out infinite;
}
.icon {
font-size: 100rpx;
display: inline-block;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-10rpx);
}
}
.welcome-title {
font-size: 48rpx;
font-weight: bold;
color: #5D3A1A;
margin-bottom: 16rpx;
letter-spacing: 2rpx;
}
.welcome-subtitle {
font-size: 26rpx;
color: #8B6F47;
opacity: 0.9;
}
/* 表单卡片 */
.form-card {
position: relative;
z-index: 10;
margin: 0 30rpx;
background: #FFFFFF;
border-radius: 32rpx;
padding: 40rpx 30rpx;
box-shadow: 0 8rpx 32rpx rgba(93, 58, 26, 0.08);
}
/* 表单板块 */
.form-section {
margin-bottom: 50rpx;
}
.form-section:last-child {
margin-bottom: 0;
}
/* 板块标题 */
.section-title {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 40rpx;
gap: 20rpx;
}
.title-line {
flex: 1;
height: 2rpx;
background: linear-gradient(90deg, transparent, #D4A574, transparent);
max-width: 120rpx;
}
.title-text {
font-size: 30rpx;
font-weight: 600;
color: #5D3A1A;
white-space: nowrap;
}
/* 表单项 */
.field-item {
margin-bottom: 32rpx;
}
.field-item:last-child {
margin-bottom: 0;
}
/* 字段标签 */
.field-label {
display: flex;
align-items: center;
margin-bottom: 16rpx;
padding-left: 8rpx;
}
.label-icon {
font-size: 32rpx;
margin-right: 12rpx;
}
.label-text {
font-size: 28rpx;
color: #333333;
font-weight: 500;
}
.required-mark {
color: #FF6B6B;
margin-left: 6rpx;
font-size: 28rpx;
}
.field-tip {
font-size: 22rpx;
color: #999999;
margin-left: 8rpx;
}
/* 上传组件包装 */
.uploader-wrapper {
padding: 20rpx;
background: #FAFAFA;
border-radius: 16rpx;
border: 2rpx dashed #E0E0E0;
}
/* 文本域包装 */
.textarea-wrapper {
margin-top: 8rpx;
}
/* 提示信息板块 */
.tips-section {
margin-top: 40rpx;
padding: 30rpx;
background: linear-gradient(135deg, #FFF9F0 0%, #FFF5E6 100%);
border-radius: 20rpx;
border-left: 6rpx solid #D4A574;
}
.tips-title {
font-size: 28rpx;
font-weight: 600;
color: #5D3A1A;
margin-bottom: 20rpx;
display: flex;
align-items: center;
}
.tips-item {
font-size: 24rpx;
color: #666666;
line-height: 40rpx;
margin-bottom: 8rpx;
padding-left: 8rpx;
}
.tips-item:last-child {
margin-bottom: 0;
}
/* 提交按钮区域 */
.submit-section {
position: relative;
z-index: 10;
margin: 50rpx 30rpx 30rpx;
}
.submit-button {
height: 96rpx !important;
border-radius: 48rpx !important;
background: linear-gradient(135deg, #D4A574 0%, #A67C52 100%) !important;
box-shadow: 0 8rpx 24rpx rgba(164, 124, 82, 0.3) !important;
font-size: 32rpx !important;
font-weight: 600 !important;
letter-spacing: 4rpx !important;
}
/* 底部装饰 */
.footer-decoration {
position: relative;
z-index: 10;
text-align: center;
margin-top: 40rpx;
padding: 0 30rpx;
}
.footer-text {
font-size: 24rpx;
color: #8B6F47;
opacity: 0.7;
}
/* Vant 组件样式覆盖 */
.van-field__control {
color: #333333;
font-size: 28rpx;
}
.van-field__placeholder {
color: #BBBBBB;
font-size: 26rpx;
}
/* 上传组件美化 */
.van-uploader__upload {
background: #FFFFFF !important;
border: 2rpx dashed #D4A574 !important;
border-radius: 12rpx !important;
}
.van-uploader__upload-text {
color: #8B6F47 !important;
font-size: 24rpx !important;
}
.van-uploader__preview-image {
border-radius: 12rpx !important;
}
/* 响应式优化 */
@media (max-width: 375px) {
.welcome-title {
font-size: 44rpx;
}
.form-card {
padding: 36rpx 24rpx;
}
}
================================================
FILE: pages/shop/select.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.shop.select,
})
this.setData({
type: options.type,
shop_join_open: wx.getStorageSync('shop_join_open')
})
},
onShow: function () {
wx.getLocation({
type: 'wgs84', //wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
success: (res) => {
this.data.latitude = res.latitude
this.data.longitude = res.longitude
this.fetchShops(res.latitude, res.longitude, '')
},
fail(e){
console.error(e)
AUTH.checkAndAuthorize('scope.userLocation')
}
})
},
async fetchShops(latitude, longitude, kw){
const res = await WXAPI.fetchShops({
curlatitude: latitude,
curlongitude: longitude,
nameLike: kw
})
if (res.code == 0) {
res.data.forEach(ele => {
ele.distance = ele.distance.toFixed(1) // 距离保留3位小数
})
this.setData({
shops: res.data
})
} else {
this.setData({
shops: null
})
}
},
searchChange(event){
this.setData({
searchValue: event.detail.value
})
},
search(event){
console.log('search')
this.setData({
searchValue: event.detail.value
})
this.fetchShops(this.data.latitude, this.data.longitude, event.detail.value)
},
goShop(e){
const idx = e.currentTarget.dataset.idx
wx.setStorageSync('shopInfo', this.data.shops[idx])
if (this.data.type == 'index') {
wx.setStorageSync('refreshIndex', 1)
}
if (this.data.type == 'pay') {
wx.navigateBack()
} else {
wx.switchTab({
url: '/pages/index/index'
})
}
},
joinApply() {
wx.navigateTo({
url: '/pages/shop/join-apply',
})
},
})
================================================
FILE: pages/shop/select.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/shop/select.wxml
================================================
{{ item.address }}
{{ item.openingHours }}
{{ item.linkPhone }}
================================================
FILE: pages/shop/select.wxss
================================================
/* 页面容器 */
.page-container {
min-height: 100vh;
background: linear-gradient(180deg, #FFF9F0 0%, #FFEEDD 100%);
padding-bottom: 120rpx;
}
/* 搜索区域 */
.search-wrapper {
padding: 24rpx 32rpx 32rpx;
background: linear-gradient(180deg, #8B4513 0%, #A0826D 100%);
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 4rpx 20rpx rgba(139, 69, 19, 0.15);
}
.search-box {
position: relative;
background: #FFFFFF;
border-radius: 50rpx;
height: 80rpx;
display: flex;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
overflow: hidden;
}
.search-icon {
position: absolute;
left: 28rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A0826D;
}
.search-input {
flex: 1;
height: 100%;
padding: 0 28rpx 0 72rpx;
font-size: 28rpx;
color: #333;
}
.search-placeholder {
color: #BFAB9A;
font-size: 28rpx;
}
/* 门店列表 */
.shop-list {
padding: 32rpx 32rpx 0;
}
/* 门店卡片 */
.shop-card {
position: relative;
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx;
margin-bottom: 24rpx;
box-shadow: 0 8rpx 24rpx rgba(139, 69, 19, 0.08);
transition: all 0.3s ease;
overflow: hidden;
}
/* 最近门店卡片特殊样式 */
.shop-card-nearest {
background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F0 100%);
border: 2rpx solid #D4AF37;
box-shadow: 0 12rpx 32rpx rgba(212, 175, 55, 0.2);
}
/* 当前门店标签 */
.nearest-badge {
position: absolute;
top: 0;
right: 32rpx;
background: linear-gradient(135deg, #D4AF37 0%, #FFD700 100%);
padding: 12rpx 28rpx;
border-radius: 0 0 20rpx 20rpx;
box-shadow: 0 4rpx 12rpx rgba(212, 175, 55, 0.3);
}
.badge-text {
font-size: 22rpx;
color: #FFFFFF;
font-weight: 600;
letter-spacing: 1rpx;
}
/* 门店头部 */
.shop-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
}
.shop-title {
display: flex;
align-items: center;
flex: 1;
margin-right: 20rpx;
}
.shop-icon {
display: flex;
align-items: center;
justify-content: center;
width: 72rpx;
height: 72rpx;
background: linear-gradient(135deg, #FFF9F0 0%, #FFE4C4 100%);
border-radius: 16rpx;
margin-right: 20rpx;
}
.shop-name {
font-size: 32rpx;
font-weight: 600;
color: #2C1810;
line-height: 44rpx;
letter-spacing: 0.5rpx;
}
/* 距离显示 */
.distance-wrapper {
display: flex;
align-items: baseline;
padding: 12rpx 24rpx;
background: linear-gradient(135deg, #F5E6D3 0%, #FFE4C4 100%);
border-radius: 32rpx;
box-shadow: 0 2rpx 8rpx rgba(139, 69, 19, 0.1);
}
.distance-num {
font-size: 36rpx;
font-weight: 700;
color: #8B4513;
line-height: 1;
}
.distance-unit {
font-size: 22rpx;
color: #A0826D;
margin-left: 4rpx;
font-weight: 500;
}
/* 门店信息 */
.shop-info {
display: flex;
flex-direction: column;
gap: 20rpx;
padding: 24rpx 0;
border-top: 1rpx solid #F5E6D3;
border-bottom: 1rpx solid #F5E6D3;
}
.info-item {
display: flex;
align-items: flex-start;
}
.info-icon {
display: flex;
align-items: center;
justify-content: center;
width: 48rpx;
height: 48rpx;
background: #FFF9F0;
border-radius: 12rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.info-text {
flex: 1;
font-size: 26rpx;
color: #5A4A42;
line-height: 48rpx;
letter-spacing: 0.3rpx;
}
/* 按钮容器 */
.select-btn-wrapper,
.switch-btn-wrapper {
margin-top: 28rpx;
}
/* 按钮基础样式 */
.select-btn {
width: 100%;
height: 88rpx;
border-radius: 44rpx;
font-size: 30rpx;
font-weight: 600;
letter-spacing: 1rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
box-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.1);
}
.select-btn::after {
border: none;
}
/* 主按钮 */
.select-btn-primary {
background: linear-gradient(135deg, #8B4513 0%, #A0826D 100%);
color: #FFFFFF;
box-shadow: 0 8rpx 20rpx rgba(139, 69, 19, 0.3);
}
/* 次要按钮 */
.select-btn-secondary {
background: linear-gradient(135deg, #F5E6D3 0%, #FFE4C4 100%);
color: #8B4513;
border: 2rpx solid #D4AF37;
box-shadow: 0 4rpx 12rpx rgba(139, 69, 19, 0.15);
}
/* 底部申请入驻按钮 */
.footer-btn {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20rpx 32rpx 32rpx;
background: linear-gradient(180deg, rgba(255, 249, 240, 0) 0%, rgba(255, 249, 240, 0.95) 30%, rgba(255, 249, 240, 1) 100%);
z-index: 99;
}
.apply-btn {
width: 100%;
height: 88rpx;
background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F0 100%);
border: 2rpx solid #D4AF37;
border-radius: 44rpx;
color: #8B4513;
font-size: 28rpx;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
box-shadow: 0 8rpx 24rpx rgba(212, 175, 55, 0.2);
transition: all 0.3s ease;
}
.apply-btn::after {
border: none;
}
.apply-btn text {
letter-spacing: 1rpx;
}
================================================
FILE: pages/sign/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
Page({
data: {
minDate: new Date().getTime(),
maxDate: new Date().getTime(),
formatter(day) {
return day;
},
},
onLoad: function(options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.my.signDaily,
})
this.scoreSignLogs()
},
onShow: function() {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.login(this)
}
})
},
async scoreSignLogs() {
const _this = this
const res = await WXAPI.scoreSignLogs({
token: wx.getStorageSync('token')
})
if (res.code == 0) {
this.setData({
scoreSignLogs: res.data.result,
formatter(day) {
const _log = res.data.result.find(ele => {
const year = day.date.getYear() + 1900
let month = day.date.getMonth() + 1
month = month + ''
if (month.length == 1) {
month = '0' + month
}
let date = day.date.getDate() + ''
if (date.length == 1) {
date = '0' + date
}
return ele.dateAdd.indexOf(`${year}-${month}-${date}`) == 0
})
if (_log) {
day.bottomInfo = _this.data.$t.sign.signed
}
return day;
}
})
}
},
async sign() {
const res = await WXAPI.scoreSign(wx.getStorageSync('token'))
if (res.code == 10000) {
wx.showToast({
title: this.data.$t.sign.signSuccess,
icon: 'success'
})
this.scoreSignLogs()
return
}
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
} else {
wx.showToast({
title: this.data.$t.sign.signSuccess,
icon: 'success'
})
this.scoreSignLogs()
}
},
})
================================================
FILE: pages/sign/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/sign/index.wxml
================================================
{{ $t.sign.signBtn }}
================================================
FILE: pages/sign/index.wxss
================================================
.todo-dot-bottom {
color: red !important;
}
.zwqd-box {
text-align: center;
margin: auto;
margin-top: 32rpx;
}
.zwqd-box image {
width: 140rpx;
height: 140rpx;
margin: auto;
}
.zwqd-box view {
margin-top: 16rpx;
color: #999;
font-size: 26rpx;
}
================================================
FILE: pages/youhui-pay/index.js
================================================
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {
}
Page({
data: {
rechargeSendRules: []
},
onLoad: function (options) {
getApp().initLanguage(this)
wx.setNavigationBarTitle({
title: this.data.$t.my.youhuimaidan,
})
WXAPI.payBillDiscounts().then(res => {
if (res.code === 0) {
this.setData({
rechargeSendRules: res.data
});
}
})
},
onShow () {
this.setData({
shopInfo: wx.getStorageSync('shopInfo')
})
},
async bindSave(e) {
const _this = this
const amount = e.detail.value.amount;
console.log(amount)
if (amount == "" || amount * 1 < 0) {
wx.showToast({
title: this.data.$t.youhuipay.amountRequired,
icon: 'none'
})
return
}
const userMoney = await WXAPI.userAmount(wx.getStorageSync('token'))
if (userMoney.code == 2000) {
AUTH.login(this)
return
}
if (userMoney.code != 0) {
wx.showToast({
title: userMoney.msg,
icon: 'none'
})
return
}
const rechargeSendRule = this.data.rechargeSendRules.sort((a, b) => {
return b.consume - a.consume
}).find(ele => {
return amount >= ele.consume
})
let _msg = this.data.$t.youhuipay.curAmount + ' ¥' + amount + ' '
let needPayAmount = amount*1
if (rechargeSendRule) {
needPayAmount -= rechargeSendRule.discounts
_msg += ','+ this.data.$t.youhuipay.youhui +' ¥' + rechargeSendRule.discounts + ' '
}
if (userMoney.data.balance*1 > 0) {
_msg += ',' + this.data.$t.order.balance + ' ¥' + userMoney.data.balance + ' '
}
needPayAmount = needPayAmount.toFixed(2) // 需要买单支付的金额
const wxpayAmount = (needPayAmount - userMoney.data.balance).toFixed(2) // 需要额外微信支付的金额
console.log(needPayAmount)
console.log(wxpayAmount)
if (wxpayAmount > 0) {
_msg += ',' + this.data.$t.order.payAmount + ' ¥' + wxpayAmount
}
wx.showModal({
content: _msg,
confirmText: this.data.$t.common.confirm,
cancelText: this.data.$t.common.cancel,
success: function (res) {
console.log(res);
if (res.confirm) {
_this.goPay(amount, wxpayAmount)
}
}
});
},
goPay(amount, wxpayAmount){
const _this = this
if (wxpayAmount > 0) {
this.setData({
paymentShow: true,
money: wxpayAmount,
nextAction: {
type: 4,
uid: wx.getStorageSync('uid'),
money: amount
}
})
} else {
WXAPI.payBill(wx.getStorageSync('token'), amount).then(function (res) {
if (res.code == 0) {
wx.showModal({
confirmText: _this.data.$t.common.confirm,
cancelText: _this.data.$t.common.cancel,
content: _this.data.$t.asset.success,
showCancel: false
})
} else {
wx.showModal({
confirmText: _this.data.$t.common.confirm,
cancelText: _this.data.$t.common.cancel,
content: res.msg,
showCancel: false
})
}
})
}
},
paymentOk(e) {
console.log(e.detail); // 这里是组件里data的数据
this.setData({
paymentShow: false
})
wx.redirectTo({
url: '/pages/asset/index',
})
},
paymentCancel() {
this.setData({
paymentShow: false
})
},
})
================================================
FILE: pages/youhui-pay/index.json
================================================
{
"navigationBarTitleText": ""
}
================================================
FILE: pages/youhui-pay/index.wxml
================================================
💡
消费满额即可享受相应优惠,余额不足将使用微信支付
================================================
FILE: pages/youhui-pay/index.wxss
================================================
page {
background: linear-gradient(180deg, #f8f4f0 0%, #fff5eb 100%);
min-height: 100vh;
padding-bottom: 40rpx;
}
/* 页面容器 */
.page-container {
padding: 30rpx 25rpx;
}
/* 店铺信息卡片 */
.shop-card {
background: #ffffff;
border-radius: 24rpx;
margin-bottom: 24rpx;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(210, 180, 140, 0.12);
}
.shop-cell {
background: linear-gradient(135deg, #fff 0%, #fefcf9 100%);
}
/* 金额输入卡片 */
.amount-card {
background: linear-gradient(135deg, #ffffff 0%, #fffaf5 100%);
border-radius: 32rpx;
padding: 50rpx 40rpx;
margin-bottom: 24rpx;
box-shadow: 0 12rpx 40rpx rgba(210, 180, 140, 0.15);
position: relative;
overflow: hidden;
}
.amount-card::before {
content: '';
position: absolute;
top: -50%;
right: -50rpx;
width: 400rpx;
height: 400rpx;
background: radial-gradient(circle, rgba(255, 200, 124, 0.08) 0%, transparent 70%);
border-radius: 50%;
}
.amount-header {
display: flex;
align-items: center;
margin-bottom: 40rpx;
}
.header-icon {
font-size: 48rpx;
margin-right: 16rpx;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.1); }
}
.header-title {
font-size: 32rpx;
font-weight: 600;
color: #8b6f47;
letter-spacing: 1rpx;
}
/* 金额输入区域 */
.amount-input-wrapper {
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
border-radius: 24rpx;
padding: 40rpx 50rpx;
margin-bottom: 40rpx;
border: 3rpx solid transparent;
background-clip: padding-box;
position: relative;
}
.amount-input-wrapper::before {
content: '';
position: absolute;
inset: 0;
border-radius: 24rpx;
padding: 3rpx;
background: linear-gradient(135deg, #d4a574 0%, #e8c8a0 100%);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0.3;
}
.currency-symbol {
font-size: 56rpx;
font-weight: 700;
color: #c9935b;
margin-right: 20rpx;
}
.amount-input {
flex: 1;
font-size: 72rpx;
font-weight: 700;
color: #2c2416;
text-align: left;
height: 100rpx;
line-height: 100rpx;
}
.input-placeholder {
color: #d4b896;
font-weight: 400;
font-size: 48rpx;
}
/* 支付按钮 */
.pay-button-wrapper {
position: relative;
}
.pay-button {
width: 100%;
height: 100rpx;
border-radius: 50rpx;
background: linear-gradient(135deg, #d4a574 0%, #c9935b 100%);
border: none;
box-shadow: 0 8rpx 24rpx rgba(201, 147, 91, 0.3);
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
.pay-button::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
transition: left 0.5s;
}
.pay-button:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(201, 147, 91, 0.4);
}
.button-content {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.button-text {
font-size: 36rpx;
font-weight: 600;
color: #ffffff;
letter-spacing: 2rpx;
}
.button-icon {
font-size: 40rpx;
color: #ffffff;
margin-left: 12rpx;
font-weight: bold;
}
/* 优惠规则卡片 */
.discount-card {
background: linear-gradient(135deg, #ffffff 0%, #fffbf7 100%);
border-radius: 32rpx;
padding: 40rpx;
margin-bottom: 24rpx;
box-shadow: 0 12rpx 40rpx rgba(210, 180, 140, 0.15);
}
.discount-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
}
.header-left {
display: flex;
align-items: center;
}
.discount-icon {
font-size: 44rpx;
margin-right: 16rpx;
}
.discount-title {
font-size: 32rpx;
font-weight: 600;
color: #8b6f47;
letter-spacing: 1rpx;
}
.discount-badge {
background: linear-gradient(135deg, #ff9a62 0%, #ff7f50 100%);
color: #ffffff;
font-size: 22rpx;
padding: 8rpx 20rpx;
border-radius: 20rpx;
font-weight: 500;
box-shadow: 0 4rpx 12rpx rgba(255, 127, 80, 0.3);
animation: shake 3s ease-in-out infinite;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-3rpx); }
75% { transform: translateX(3rpx); }
}
/* 优惠列表 */
.discount-list {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
}
.discount-item {
flex: 0 0 calc(50% - 10rpx);
background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
border-radius: 20rpx;
padding: 28rpx 20rpx;
position: relative;
overflow: hidden;
border: 2rpx solid #f5e6d3;
box-shadow: 0 4rpx 16rpx rgba(210, 180, 140, 0.1);
}
.discount-item::before {
content: '';
position: absolute;
top: -20rpx;
right: -20rpx;
width: 100rpx;
height: 100rpx;
background: radial-gradient(circle, rgba(255, 200, 124, 0.15) 0%, transparent 70%);
border-radius: 50%;
}
.discount-item-top {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 16rpx;
}
.discount-amount {
font-size: 52rpx;
font-weight: 700;
color: #d4a574;
line-height: 1.2;
letter-spacing: -1rpx;
}
.discount-label {
font-size: 24rpx;
color: #a88560;
font-weight: 500;
margin-top: 4rpx;
}
.discount-divider {
height: 2rpx;
background: linear-gradient(90deg, transparent, #e8d5c4, transparent);
margin: 16rpx 0;
}
.discount-item-bottom {
text-align: center;
}
.discount-rule {
font-size: 26rpx;
color: #8b6f47;
font-weight: 500;
}
/* 温馨提示卡片 */
.tips-card {
background: linear-gradient(135deg, #fffbf7 0%, #fff9f0 100%);
border-radius: 24rpx;
padding: 32rpx;
display: flex;
align-items: center;
border: 2rpx solid #f5e6d3;
box-shadow: 0 4rpx 16rpx rgba(210, 180, 140, 0.08);
}
.tips-icon {
font-size: 40rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.tips-text {
font-size: 26rpx;
color: #a88560;
line-height: 1.6;
flex: 1;
}
================================================
FILE: project.config.json
================================================
{
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": true,
"useMultiFrameRuntime": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"lazyloadPlaceholderEnable": false,
"useStaticServer": true,
"ignoreUploadUnusedFiles": true,
"condition": false
},
"compileType": "miniprogram",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"list": []
}
},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"appid": "wx47586bbed56a5001",
"packOptions": {
"ignore": [],
"include": []
}
}
================================================
FILE: project.private.config.json
================================================
{
"setting": {
"compileHotReLoad": true,
"urlCheck": false
},
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/pay/index",
"pathName": "pages/pay/index",
"query": "",
"scene": null,
"launchMode": "default"
}
]
}
},
"projectname": "%E5%B0%8F%E8%9C%9C%E8%9C%82%E7%82%B9%E9%A4%90",
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "3.7.12"
}
================================================
FILE: sitemap.json
================================================
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
================================================
FILE: utils/auth.js
================================================
const WXAPI = require('apifm-wxapi')
const i18n = require("../i18n/index")
const $t = i18n.$t()
async function checkSession(){
return new Promise((resolve, reject) => {
wx.checkSession({
success() {
return resolve(true)
},
fail() {
return resolve(false)
}
})
})
}
async function bindSeller() {
const token = wx.getStorageSync('token')
const referrer = wx.getStorageSync('referrer')
if (!token) {
return
}
if (!referrer) {
return
}
const res = await WXAPI.bindSeller({
token,
uid: referrer
})
}
// 检测登录状态,返回 true / false
async function checkHasLogined() {
const token = wx.getStorageSync('token')
if (!token) {
return false
}
const loggined = await checkSession()
if (!loggined) {
wx.removeStorageSync('token')
return false
}
const checkTokenRes = await WXAPI.checkToken(token)
if (checkTokenRes.code != 0) {
wx.removeStorageSync('token')
return false
}
return true
}
async function wxaCode(){
return new Promise((resolve, reject) => {
wx.login({
success(res) {
return resolve(res.code)
},
fail() {
wx.showToast({
title: $t.common.getCodeError,
icon: 'none'
})
return resolve($t.common.getCodeError)
}
})
})
}
async function login(page){
const _this = this
wx.login({
success: function (res) {
const componentAppid = wx.getStorageSync('componentAppid')
if (componentAppid) {
WXAPI.wxappServiceLogin({
componentAppid,
appid: wx.getStorageSync('appid'),
code: res.code
}).then(function (res) {
if (res.code == 10000) {
// 去注册
return;
}
if (res.code != 0) {
// 登录错误
wx.showModal({
confirmText: $t.common.confirm,
cancelText: $t.common.cancel,
title: $t.common.loginFail,
content: res.msg,
showCancel: false
})
return;
}
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
_this.bindSeller()
if ( page ) {
page.onShow()
}
})
} else {
WXAPI.login_wx(res.code).then(function (res) {
if (res.code == 10000) {
// 去注册
return;
}
if (res.code != 0) {
// 登录错误
wx.showModal({
confirmText: $t.common.confirm,
cancelText: $t.common.cancel,
title: $t.common.loginFail,
content: res.msg,
showCancel: false
})
return;
}
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
_this.bindSeller()
if ( page ) {
page.onShow()
}
})
}
}
})
}
async function authorize() {
return new Promise((resolve, reject) => {
wx.login({
success: function (res) {
const code = res.code
let referrer = '' // 推荐人
let referrer_storge = wx.getStorageSync('referrer');
if (referrer_storge) {
referrer = referrer_storge;
}
// 下面开始调用注册接口
const componentAppid = wx.getStorageSync('componentAppid')
if (componentAppid) {
WXAPI.wxappServiceAuthorize({
code: code,
referrer: referrer
}).then(function (res) {
if (res.code == 0) {
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
resolve(res)
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
reject(res.msg)
}
})
} else {
WXAPI.authorize({
code: code,
referrer: referrer
}).then(function (res) {
if (res.code == 0) {
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
resolve(res)
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
reject(res.msg)
}
})
}
},
fail: err => {
reject(err)
}
})
})
}
function loginOut(){
wx.removeStorageSync('token')
wx.removeStorageSync('uid')
}
async function checkAndAuthorize (scope) {
return new Promise((resolve, reject) => {
wx.getSetting({
success(res) {
if (!res.authSetting[scope]) {
wx.authorize({
scope: scope,
success() {
resolve() // 无返回参数
},
fail(e){
console.error(e)
// if (e.errMsg.indexof('auth deny') != -1) {
// wx.showToast({
// title: e.errMsg,
// icon: 'none'
// })
// }
wx.showModal({
content: $t.common.authorizeRequired,
showCancel: false,
confirmText: $t.common.authorize,
confirmColor: '#e64340',
success(res) {
wx.openSetting();
},
fail(e){
console.error(e)
reject(e)
},
})
}
})
} else {
resolve() // 无返回参数
}
},
fail(e){
console.error(e)
reject(e)
}
})
})
}
module.exports = {
checkHasLogined: checkHasLogined,
wxaCode: wxaCode,
login: login,
loginOut: loginOut,
checkAndAuthorize: checkAndAuthorize,
authorize: authorize,
bindSeller: bindSeller
}
================================================
FILE: utils/image.js
================================================
function imageUtil (originalWidth, originalHeight) {
let imageSize = {}
wx.getSystemInfo({
success: function (res) {
const windowWidth = res.windowWidth
imageSize.x = 0
imageSize.y = 0
imageSize.windowWidth = windowWidth
imageSize.imageWidth = originalWidth
imageSize.imageHeight = originalHeight
if (originalWidth > windowWidth) {
imageSize.imageWidth = windowWidth
imageSize.imageHeight = windowWidth * originalHeight / originalWidth
} else {
imageSize.x = (windowWidth - originalWidth) / 2
}
}
})
return imageSize
}
module.exports = {
imageUtil: imageUtil
}
================================================
FILE: utils/pay.js
================================================
const WXAPI = require('apifm-wxapi')
const i18n = require("../i18n/index")
const $t = i18n.$t()
/**
* type: order 支付订单 recharge 充值 paybill 优惠买单
* data: 扩展数据对象,用于保存参数
*/
function wxpay(type, money, orderId, redirectUrl, data) {
const postData = {
token: wx.getStorageSync('token'),
money: money,
remark: "在线充值",
}
if (type === 'order') {
postData.remark = "支付订单 :" + orderId;
postData.nextAction = {
type: 0,
id: orderId
};
}
if (type === 'paybill') {
postData.remark = $t.my.youhuimaidan + " :" + data.money;
postData.nextAction = {
type: 4,
uid: wx.getStorageSync('uid'),
money: data.money
};
}
postData.payName = postData.remark;
if (postData.nextAction) {
postData.nextAction = JSON.stringify(postData.nextAction);
}
WXAPI.wxpay(postData).then(function (res) {
if (res.code == 0) {
// 发起支付
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
fail: function (aaa) {
console.error(aaa)
wx.showToast({
title: aaa
})
if (redirectUrl) {
wx.redirectTo({
url: redirectUrl,
})
}
},
success: function () {
// 提示支付成功
wx.showToast({
title: $t.asset.success
})
if (redirectUrl) {
wx.redirectTo({
url: redirectUrl,
})
}
}
})
} else {
wx.showModal({
confirmText: $t.common.confirm,
cancelText: $t.common.cancel,
content: JSON.stringify(res),
showCancel: false
})
}
})
}
module.exports = {
wxpay: wxpay
}
================================================
FILE: utils/runtime.js
================================================
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var regeneratorRuntime = (function (exports) {
"use strict";
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunctionPrototype[toStringTagSymbol] =
GeneratorFunction.displayName = "GeneratorFunction";
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
prototype[method] = function(arg) {
return this._invoke(method, arg);
};
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
if (!(toStringTagSymbol in genFun)) {
genFun[toStringTagSymbol] = "GeneratorFunction";
}
}
genFun.prototype = Object.create(Gp);
return genFun;
};
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return Promise.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
}
return Promise.resolve(value).then(function(unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function(error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new Promise(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function(innerFn, outerFn, self, tryLocsList) {
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList)
);
return exports.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (! info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value;
// Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined;
}
} else {
// Re-yield the result returned by the delegate method.
return info;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
Gp[toStringTagSymbol] = "Generator";
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function() {
return this;
};
Gp.toString = function() {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
exports.values = values;
function doneResult() {
return { value: undefined, done: true };
}
Context.prototype = {
constructor: Context,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this.sent = this._sent = undefined;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined;
}
return !! caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined;
}
return ContinueSentinel;
}
};
// Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
return exports;
}(
// If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
typeof module === "object" ? module.exports : {}
));
================================================
FILE: utils/tools.js
================================================
const WXAPI = require('apifm-wxapi')
// 显示购物车tabBar的Badge
async function showTabBarBadge(noTabBarPage){
const token = wx.getStorageSync('token')
if (!token) {
return 0
}
let number = 0
// 自营商品
let res = await WXAPI.shippingCarInfo(token)
if (res.code == 0) {
number += res.data.number
}
if (!noTabBarPage) {
if (number == 0) {
// 删除红点点
wx.removeTabBarBadge({
index: 3
})
} else {
// 显示红点点
wx.setTabBarBadge({
index: 3,
text: number + ''
})
}
}
return number
}
module.exports = {
showTabBarBadge: showTabBarBadge
}
================================================
FILE: utils/util.js
================================================
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}