From 05a69374ea5dccdfe5033c3bbda1dbebe6d6eb5e Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 21 Jun 2024 10:59:01 +0800 Subject: [PATCH 1/5] add --- api/address.js | 8 + config/app.js | 4 +- pages.json | 9 + pages/login/login.vue | 7 +- pages/my/my.vue | 2 +- pagesOrder/setPayPassword/index.vue | 92 +++++- uni_modules/uni-transition/changelog.md | 24 ++ .../uni-transition/createAnimation.js | 131 ++++++++ .../uni-transition/uni-transition.vue | 286 ++++++++++++++++++ uni_modules/uni-transition/package.json | 85 ++++++ uni_modules/uni-transition/readme.md | 11 + 11 files changed, 644 insertions(+), 15 deletions(-) create mode 100644 uni_modules/uni-transition/changelog.md create mode 100644 uni_modules/uni-transition/components/uni-transition/createAnimation.js create mode 100644 uni_modules/uni-transition/components/uni-transition/uni-transition.vue create mode 100644 uni_modules/uni-transition/package.json create mode 100644 uni_modules/uni-transition/readme.md diff --git a/api/address.js b/api/address.js index 845d525..a50a95c 100644 --- a/api/address.js +++ b/api/address.js @@ -21,4 +21,12 @@ export const villageListApi = (data) => { } export const brigadeListApi = (data) => { return request.get('/brigade', data); +} + +export const getMassageCode = (data) => { + return request.post('/brigade', data); +} + +export const setPayPassword = (data) => { + return request.post('/brigade', data); } \ No newline at end of file diff --git a/config/app.js b/config/app.js index 85facca..ab2ac5f 100644 --- a/config/app.js +++ b/config/app.js @@ -1,8 +1,8 @@ let BASE_URL import store from "@/store/user.js" // 环境 -// let env = "dev" -let env = "prod" +let env = "dev" +// let env = "prod" // let env = "liu"; switch (env) { diff --git a/pages.json b/pages.json index ed62957..49114dc 100644 --- a/pages.json +++ b/pages.json @@ -161,6 +161,13 @@ "navigationBarTitleText": "确认订单", "enablePullDownRefresh": false } + }, + { + "path": "setPayPassword/index", + "style": { + "navigationBarTitleText": "设置密码", + "enablePullDownRefresh": false + } } ] }, @@ -228,6 +235,8 @@ "enablePullDownRefresh": true } } + + ] } ], diff --git a/pages/login/login.vue b/pages/login/login.vue index 35ce671..1f7d2df 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -16,10 +16,10 @@ 微信快捷登录 - + + diff --git a/pagesOrder/setPayPassword/index.vue b/pagesOrder/setPayPassword/index.vue index ef8854e..9c806af 100644 --- a/pagesOrder/setPayPassword/index.vue +++ b/pagesOrder/setPayPassword/index.vue @@ -1,38 +1,110 @@ diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md new file mode 100644 index 0000000..faaf336 --- /dev/null +++ b/uni_modules/uni-transition/changelog.md @@ -0,0 +1,24 @@ +## 1.3.3(2024-04-23) +- 修复 当元素会受变量影响自动隐藏的bug +## 1.3.2(2023-05-04) +- 修复 NVUE 平台报错的问题 +## 1.3.1(2021-11-23) +- 修复 init 方法初始化问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-transition](https://uniapp.dcloud.io/component/uniui/uni-transition) +## 1.2.1(2021-09-27) +- 修复 init 方法不生效的 Bug +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.1(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的 Bug +## 1.1.0(2021-04-22) +- 新增 通过方法自定义动画 +- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式 +- 优化 动画触发逻辑,使动画更流畅 +- 优化 支持单独的动画类型 +- 优化 文档示例 +## 1.0.2(2021-02-05) +- 调整为 uni_modules 目录规范 diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js new file mode 100644 index 0000000..8f89b18 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js @@ -0,0 +1,131 @@ +// const defaultOption = { +// duration: 300, +// timingFunction: 'linear', +// delay: 0, +// transformOrigin: '50% 50% 0' +// } +// #ifdef APP-NVUE +const nvueAnimation = uni.requireNativePlugin('animation') +// #endif +class MPAnimation { + constructor(options, _this) { + this.options = options + // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误 + this.animation = uni.createAnimation({ + ...options + }) + this.currentStepAnimates = {} + this.next = 0 + this.$ = _this + + } + + _nvuePushAnimates(type, args) { + let aniObj = this.currentStepAnimates[this.next] + let styles = {} + if (!aniObj) { + styles = { + styles: {}, + config: {} + } + } else { + styles = aniObj + } + if (animateTypes1.includes(type)) { + if (!styles.styles.transform) { + styles.styles.transform = '' + } + let unit = '' + if(type === 'rotate'){ + unit = 'deg' + } + styles.styles.transform += `${type}(${args+unit}) ` + } else { + styles.styles[type] = `${args}` + } + this.currentStepAnimates[this.next] = styles + } + _animateRun(styles = {}, config = {}) { + let ref = this.$.$refs['ani'].ref + if (!ref) return + return new Promise((resolve, reject) => { + nvueAnimation.transition(ref, { + styles, + ...config + }, res => { + resolve() + }) + }) + } + + _nvueNextAnimate(animates, step = 0, fn) { + let obj = animates[step] + if (obj) { + let { + styles, + config + } = obj + this._animateRun(styles, config).then(() => { + step += 1 + this._nvueNextAnimate(animates, step, fn) + }) + } else { + this.currentStepAnimates = {} + typeof fn === 'function' && fn() + this.isEnd = true + } + } + + step(config = {}) { + // #ifndef APP-NVUE + this.animation.step(config) + // #endif + // #ifdef APP-NVUE + this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) + this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin + this.next++ + // #endif + return this + } + + run(fn) { + // #ifndef APP-NVUE + this.$.animationData = this.animation.export() + this.$.timer = setTimeout(() => { + typeof fn === 'function' && fn() + }, this.$.durationTime) + // #endif + // #ifdef APP-NVUE + this.isEnd = false + let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref + if(!ref) return + this._nvueNextAnimate(this.currentStepAnimates, 0, fn) + this.next = 0 + // #endif + } +} + + +const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ' +] +const animateTypes2 = ['opacity', 'backgroundColor'] +const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] +animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function(...args) { + // #ifndef APP-NVUE + this.animation[type](...args) + // #endif + // #ifdef APP-NVUE + this._nvuePushAnimates(type, args) + // #endif + return this + } +}) + +export function createAnimation(option, _this) { + if(!_this) return + clearTimeout(_this.timer) + return new MPAnimation(option, _this) +} diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue new file mode 100644 index 0000000..f3ddd1f --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue @@ -0,0 +1,286 @@ + + + + + diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json new file mode 100644 index 0000000..d5c20e1 --- /dev/null +++ b/uni_modules/uni-transition/package.json @@ -0,0 +1,85 @@ +{ + "id": "uni-transition", + "displayName": "uni-transition 过渡动画", + "version": "1.3.3", + "description": "元素的简单过渡动画", + "keywords": [ + "uni-ui", + "uniui", + "动画", + "过渡", + "过渡动画" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md new file mode 100644 index 0000000..2f8a77e --- /dev/null +++ b/uni_modules/uni-transition/readme.md @@ -0,0 +1,11 @@ + + +## Transition 过渡动画 +> **组件名:uni-transition** +> 代码块: `uTransition` + + +元素过渡动画 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file From c5af02d7c01597215f0d5f1aeb9a392150da5385 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 21 Jun 2024 11:40:32 +0800 Subject: [PATCH 2/5] add --- pagesOrder/settle/settle.vue | 36 +++- uni_modules/zy-passwordboard/changelog.md | 4 + .../zy-passwordboard/zy-passwordboard.vue | 179 ++++++++++++++++++ uni_modules/zy-passwordboard/package.json | 89 +++++++++ uni_modules/zy-passwordboard/readme.md | 45 +++++ 5 files changed, 347 insertions(+), 6 deletions(-) create mode 100644 uni_modules/zy-passwordboard/changelog.md create mode 100644 uni_modules/zy-passwordboard/components/zy-passwordboard/zy-passwordboard.vue create mode 100644 uni_modules/zy-passwordboard/package.json create mode 100644 uni_modules/zy-passwordboard/readme.md diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue index cbd5c67..06613b9 100644 --- a/pagesOrder/settle/settle.vue +++ b/pagesOrder/settle/settle.vue @@ -93,11 +93,12 @@ - + 余额支付 - ( 可用¥{{userInfo.now_money}} ) + ( 可用¥{{userInfo.now_money}} + ) @@ -110,7 +111,8 @@ 采购款支付 - ( 可用¥{{userInfo.purchase_funds}} ) + ( 可用¥{{userInfo.purchase_funds}} + ) @@ -152,6 +154,7 @@ @change="changeShop" @search="searchShop" /> + @@ -181,11 +184,9 @@ import { createOrderApi } from "@/api/order.js"; + import ZyPasswordboard from '@/uni_modules/zy-passwordboard/components/zy-passwordboard/zy-passwordboard.vue'; const userInfo = useUserStore().userInfo; - - console.log(userInfo) - // 用户选择的门店信息 let STORE_INFO = uni.getStorageSync('STORE_INFO'); if (STORE_INFO) @@ -357,9 +358,32 @@ const pay_type = ref('7'); + + // 支付密码 + const passwordBoardVisible = ref(false); + const handleItemClick = () => { + passwordBoardVisible.value = true; + }; + const passwordBoardProps = { + title: '输入支付密码', + onComplete(value) { + console.log(value); + } + }; + + + const createOrder = () => { if (!pay_type.value) return uni.$u.toast('请选择支付方式'); let shareInfo = uni.getStorageSync('SHARE_INFO'); + + + if (pay_type.value == 3 || pay_type.value == 17) { + passwordBoardVisible.value = true + return + } + + createOrderApi({ spread_uid: (shareInfo && shareInfo.uid) ? shareInfo.uid : '', cart_id: cartStore.cartList, diff --git a/uni_modules/zy-passwordboard/changelog.md b/uni_modules/zy-passwordboard/changelog.md new file mode 100644 index 0000000..8b3259c --- /dev/null +++ b/uni_modules/zy-passwordboard/changelog.md @@ -0,0 +1,4 @@ +## 2022.0513.0001(2022-05-13) +小程序样式不支持 *,调整样式配置 +## 2022.0513.0000(2022-05-13) +初建 diff --git a/uni_modules/zy-passwordboard/components/zy-passwordboard/zy-passwordboard.vue b/uni_modules/zy-passwordboard/components/zy-passwordboard/zy-passwordboard.vue new file mode 100644 index 0000000..b9e3317 --- /dev/null +++ b/uni_modules/zy-passwordboard/components/zy-passwordboard/zy-passwordboard.vue @@ -0,0 +1,179 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/zy-passwordboard/package.json b/uni_modules/zy-passwordboard/package.json new file mode 100644 index 0000000..43c7c07 --- /dev/null +++ b/uni_modules/zy-passwordboard/package.json @@ -0,0 +1,89 @@ +{ + "id": "zy-passwordboard", + "displayName": "zy-passwordboard", + "version": "2022.0513.0001", + "description": "密码弹框", + "keywords": [ + "zy-passwordboard", + "密码弹框", + "支付密码" + ], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "插件不采集任何数据", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [ + "uni-transition" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "u", + "vue3": "y" + }, + "App": { + "app-vue": "u", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "y", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "y", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u", + "小红书": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} diff --git a/uni_modules/zy-passwordboard/readme.md b/uni_modules/zy-passwordboard/readme.md new file mode 100644 index 0000000..fd9b299 --- /dev/null +++ b/uni_modules/zy-passwordboard/readme.md @@ -0,0 +1,45 @@ +# zy-passwordboard +密码弹框 + +## 兼容说明 +仅基于H5进行了开发,未进行全面测试,后续用到再补 + +## 属性 +|属性名 |类型 |说明 | 默认值 | +|:-- |:-- |:-- |:-- | +|visible|Boolean|是否显示(支持 v-model:visible) | `false` | +|random |Boolean|是否随机排位 | `true` | +|num |Number |密码位数,过多显示会有问题 | `6` | +|title |String |显示标题 | -- | + +## 事件 +|事件名 |说明 | +|:-- |:-- | +| complete | 输入完毕 | +| colse | 关闭 | + +## 样式说明 +未使用 `scoped`, 通过顶层样式名`.zy-passwordboard`就可以进行调整。 + +## 使用案例 + +``` vue + + +``` From 4368d5965a2bd826e32107a4fa79f41923d683e8 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 21 Jun 2024 14:27:24 +0800 Subject: [PATCH 3/5] add --- api/address.js | 4 +- pagesOrder/setPayPassword/index.vue | 20 +++++++--- pagesOrder/settle/settle.vue | 60 ++++++++++++++++------------- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/api/address.js b/api/address.js index a50a95c..50022aa 100644 --- a/api/address.js +++ b/api/address.js @@ -24,9 +24,9 @@ export const brigadeListApi = (data) => { } export const getMassageCode = (data) => { - return request.post('/brigade', data); + return request.get('/user/user/send_sms', data); } export const setPayPassword = (data) => { - return request.post('/brigade', data); + return request.post('/user/user/set_payPassword', data); } \ No newline at end of file diff --git a/pagesOrder/setPayPassword/index.vue b/pagesOrder/setPayPassword/index.vue index 9c806af..3a98e97 100644 --- a/pagesOrder/setPayPassword/index.vue +++ b/pagesOrder/setPayPassword/index.vue @@ -1,11 +1,15 @@ @@ -178,6 +180,7 @@ checkOrderApi } from "@/api/cart.js"; import { + userInfoApi, addressListsApi, merchantListApi } from "@/api/user.js"; @@ -298,14 +301,6 @@ const searchShop = (e) => { getMerchantList(e) } - - // 拨打电话 - // const callShow = ref(false) - // const phone = ref(''); - // const callphone = (e) => { - // callShow.value = true; - // phone.value = e; - // } const onCall = (e) => { uni.makePhoneCall({ phoneNumber: e, @@ -361,30 +356,25 @@ // 支付密码 const passwordBoardVisible = ref(false); - const handleItemClick = () => { - passwordBoardVisible.value = true; - }; + const passwordBoardProps = { title: '输入支付密码', onComplete(value) { - console.log(value); + password.value = value + passwordBoardVisible.value = false + payFn() } }; + const closeKeyBord = () => { + password.value = '' + } - - const createOrder = () => { - if (!pay_type.value) return uni.$u.toast('请选择支付方式'); + const password = ref('') + const payFn = () => { let shareInfo = uni.getStorageSync('SHARE_INFO'); - - - if (pay_type.value == 3 || pay_type.value == 17) { - passwordBoardVisible.value = true - return - } - - createOrderApi({ + password: password.value, spread_uid: (shareInfo && shareInfo.uid) ? shareInfo.uid : '', cart_id: cartStore.cartList, address_id: addressInfo.value.address_id, @@ -447,6 +437,24 @@ }) } + const showModal = ref(false) + const navgo = (url) => { + showModal.value &&= false + uni.navigateTo({ + url + }) + } + + const createOrder = async () => { + if (!pay_type.value) return uni.$u.toast('请选择支付方式'); + if (pay_type.value == 3 || pay_type.value == 18) { + let res = await userInfoApi() + return res.data.pay_password ? passwordBoardVisible.value = true : showModal.value = true + } + payFn() + } + + const c_price = (price, index = 0) => { price = price + ''; return price.split('.')[index] || (index ? '00' : '0'); From d03a1eecfcebc409ce1db1d406805b63d827ca04 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 21 Jun 2024 15:27:09 +0800 Subject: [PATCH 4/5] add --- pagesOrder/setPayPassword/index.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pagesOrder/setPayPassword/index.vue b/pagesOrder/setPayPassword/index.vue index 3a98e97..c113ac9 100644 --- a/pagesOrder/setPayPassword/index.vue +++ b/pagesOrder/setPayPassword/index.vue @@ -16,17 +16,16 @@ - - + - + @@ -65,12 +64,11 @@ return regex.test(phone) ? true : false } - const getCode = async () => { if (!checkPhone(form.phone)) return uni.$u.toast('请输入正确的手机号') await getMassageCode() flag.value = false - cutDown.value = 10 + cutDown.value = 60 let timer = setInterval(() => { cutDown.value-- if (cutDown.value <= 0) clearInterval(timer) @@ -103,6 +101,9 @@ } // 键盘事件结束 + + + const submit = async () => { if (!form.code) return uni.$u.toast('请输入验证码'); if (form.password !== form.rePassword) return uni.$u.toast('两次密码不一致'); From d49221bcb47d2a3fc2dfe5950b0c0b4bce0fb2af Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Sat, 22 Jun 2024 11:27:11 +0800 Subject: [PATCH 5/5] add --- components/goodPopup.vue | 281 ++++++++++++++++++----------------- pages/index/index.vue | 13 +- pagesOrder/settle/settle.vue | 2 +- 3 files changed, 153 insertions(+), 143 deletions(-) diff --git a/components/goodPopup.vue b/components/goodPopup.vue index 533e110..5372a72 100644 --- a/components/goodPopup.vue +++ b/components/goodPopup.vue @@ -1,160 +1,165 @@ \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 7e4c2c4..519c0cc 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -144,12 +144,17 @@ {{item.spec}} - - ¥{{item.vip_price}} - 会员价 + + {{item.batch}}{{item.unit_name }}起卖 + + + 会员价¥ + {{item.vip_price}} + + /{{item.unit_name}} - ¥{{item.price}} + ¥{{item.price}}/{{item.unit_name}} diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue index cbc529a..4dc095a 100644 --- a/pagesOrder/settle/settle.vue +++ b/pagesOrder/settle/settle.vue @@ -67,7 +67,7 @@ 优惠减免 - {{ c_price(orderInfo.preferential_amount, 0) }}.{{ c_price(orderInfo.preferential_amount, 1) }} + {{ c_price(orderInfo.activity_price, 0) }}.{{ c_price(orderInfo.activity_price, 1) }}