diff --git a/package.json b/package.json index 8b6cc97..8983368 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@better-scroll/core": "^2.0.0-beta.6", "axios": "^0.19.2", "core-js": "^3.6.4", + "dayjs": "^1.8.33", "js-cookie": "^2.2.1", "lodash": "^4.17.19", "normalize.css": "^8.0.1", diff --git a/src/assets/images/ali_pay.png b/src/assets/images/ali_pay.png new file mode 100644 index 0000000..989dfc2 Binary files /dev/null and b/src/assets/images/ali_pay.png differ diff --git a/src/assets/images/avatar_default.png b/src/assets/images/avatar_default.png new file mode 100644 index 0000000..a3fd658 Binary files /dev/null and b/src/assets/images/avatar_default.png differ diff --git a/src/assets/images/goods_default.png b/src/assets/images/goods_default.png new file mode 100644 index 0000000..e38c7c2 Binary files /dev/null and b/src/assets/images/goods_default.png differ diff --git a/src/assets/images/is_empty.png b/src/assets/images/is_empty.png new file mode 100644 index 0000000..371f964 Binary files /dev/null and b/src/assets/images/is_empty.png differ diff --git a/src/assets/images/mx_be_to.png b/src/assets/images/mx_be_to.png new file mode 100644 index 0000000..e24dbd5 Binary files /dev/null and b/src/assets/images/mx_be_to.png differ diff --git a/src/assets/images/mx_start.png b/src/assets/images/mx_start.png new file mode 100644 index 0000000..1b2aab1 Binary files /dev/null and b/src/assets/images/mx_start.png differ diff --git a/src/assets/images/not_enough.png b/src/assets/images/not_enough.png new file mode 100644 index 0000000..70d8f59 Binary files /dev/null and b/src/assets/images/not_enough.png differ diff --git a/src/assets/images/store_default.png b/src/assets/images/store_default.png new file mode 100644 index 0000000..4aa072f Binary files /dev/null and b/src/assets/images/store_default.png differ diff --git a/src/assets/images/trumpet.png b/src/assets/images/trumpet.png new file mode 100644 index 0000000..d8e3dc0 Binary files /dev/null and b/src/assets/images/trumpet.png differ diff --git a/src/assets/images/user_head_bg.png b/src/assets/images/user_head_bg.png new file mode 100644 index 0000000..e9edaec Binary files /dev/null and b/src/assets/images/user_head_bg.png differ diff --git a/src/assets/images/wx_pay.png b/src/assets/images/wx_pay.png new file mode 100644 index 0000000..329248c Binary files /dev/null and b/src/assets/images/wx_pay.png differ diff --git a/src/components/Vant/index.js b/src/components/Vant/index.js index b9c8e0e..c7ee8ad 100644 --- a/src/components/Vant/index.js +++ b/src/components/Vant/index.js @@ -45,7 +45,8 @@ import { DropdownItem, ContactCard, ContactList, - ContactEdit + ContactEdit, + NoticeBar } from 'vant' Vue.use(Toast) @@ -92,3 +93,4 @@ Vue.use(Toast) .use(ContactCard) .use(ContactList) .use(ContactEdit) + .use(NoticeBar) diff --git a/src/filter/index.js b/src/filter/index.js new file mode 100644 index 0000000..016c821 --- /dev/null +++ b/src/filter/index.js @@ -0,0 +1,15 @@ +import dayjs from 'dayjs' +import { isNumber } from 'lodash' +export const dateFormat = (value, format = 'YYYY-MM-DD') => + value ? dayjs(value * 1000).format(format) : '' + +export const yuan = value => { + return isNumber(value) ? `${(value).toFixed(2)}` : value +} + +export default { + install(Vue) { + Vue.filter('yuan', yuan) + Vue.filter('dateFormat', dateFormat) + } +} diff --git a/src/main.js b/src/main.js index 34aa119..ca017a5 100644 --- a/src/main.js +++ b/src/main.js @@ -16,7 +16,9 @@ import './permission' import '@/components/Vant' // register common components globally import '@/components/common' -import { toDecimal2 } from '@/utils' +import filters from '@/filter' + +Vue.use(filters) // mock in online if (process.env.NODE_ENV === 'production') { @@ -26,8 +28,6 @@ if (process.env.NODE_ENV === 'production') { Vue.config.productionTip = false -Vue.prototype.$toDecimal2 = toDecimal2 - new Vue({ router, store, diff --git a/src/router/index.js b/src/router/index.js index 1111bb9..6073e8f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -124,6 +124,15 @@ const routes = [ keepAlive: true } }, + // 订单支付 + { + path: '/order/pay', + name: 'OrderPay', + component: () => import('@/views/order/pay'), + meta: { + title: '订单支付' + } + }, // 订单列表 { path: '/order/list', diff --git a/src/utils/localStorage.js b/src/utils/localStorage.js new file mode 100644 index 0000000..969d66a --- /dev/null +++ b/src/utils/localStorage.js @@ -0,0 +1,20 @@ +export const getLocalStorage = (...args) => { + const storage = {} + args.forEach(arg => { + storage[arg] = window.localStorage.getItem(arg) || null + }) + return storage +} + +export const setLocalStorage = data => { + Object.keys(data).forEach(prop => { + const el = data[prop] + window.localStorage.setItem(prop, el) + }) +} + +export const removeLocalStorage = (...args) => { + args.forEach(arg => { + window.localStorage.removeItem(arg) + }) +} diff --git a/src/views/cart/index.vue b/src/views/cart/index.vue index 78124e5..509bbf6 100644 --- a/src/views/cart/index.vue +++ b/src/views/cart/index.vue @@ -11,7 +11,7 @@ :desc="item.specifications.join(' ')" :tag="'123'" :tags="['满50减20', 'hot']" - :price="item.price" + :price="item.price | yuan" :isChecked="item.checked" @input="handleItemSelect" @handleDelete="handleDelete" @@ -66,9 +66,6 @@ export default { getCartList().then(res => { const { data } = res.map this.list = data - this.list.forEach(item => { - item.price = this.$toDecimal2(item.price) - }) this.isSkeletonShow = false }) }, diff --git a/src/views/detail/index.vue b/src/views/detail/index.vue index f11789d..eb31312 100644 --- a/src/views/detail/index.vue +++ b/src/views/detail/index.vue @@ -31,7 +31,6 @@ + +