From 87eade40919a8dc2d6c79325dabc77e5c45cb0e3 Mon Sep 17 00:00:00 2001
From: mullins <476823686@qq.com>
Date: Tue, 26 May 2020 15:19:19 +0800
Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E5=85=89=E6=95=B0=E6=8D=AE=E5=A1=AB?=
=?UTF-8?q?=E5=85=85=E6=A3=80=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages.json | 2 +-
src/pages/confirmOrder/confirmOrder.vue | 19 +++--
src/pages/myOrderPaying/myOrderPaying.vue | 10 +--
src/pages/purchaseLenses/purchaseLenses.vue | 50 +++++++++++-
src/store/modules/myLoveList.js | 115 ++++++++++++++--------------
src/store/modules/order.js | 2 +-
src/store/request.js | 72 ++++++++---------
7 files changed, 162 insertions(+), 108 deletions(-)
diff --git a/src/pages.json b/src/pages.json
index 195200a..5b6074c 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -27,7 +27,7 @@
{
"path": "pages/purchaseLenses/purchaseLenses",
"style": {
- "navigationBarTitleText": "产品选购"
+ "navigationBarTitleText": "参数选择"
}
},
{
diff --git a/src/pages/confirmOrder/confirmOrder.vue b/src/pages/confirmOrder/confirmOrder.vue
index ec6ba30..ed56f6e 100644
--- a/src/pages/confirmOrder/confirmOrder.vue
+++ b/src/pages/confirmOrder/confirmOrder.vue
@@ -104,15 +104,15 @@
>
微信支付
- 最高随机立减¥99
+
-
+ > -->
-
+
运费
- ¥{{freight}}
+ 免运费
@@ -229,6 +229,12 @@ export default {
complete: () => {}
})
},
+ // 加入购物车
+ addCart() {
+ console.log('this', this.$store.state)
+ store.dispatch('cart/')
+ },
+ // 下单
orderBuild() {
console.log('this', this.$store.state)
// store.dispatch('order/build', {
@@ -238,6 +244,7 @@ export default {
// totalPrice: 101
// })
}
+ // 支付
// pay() {
// const openId = uni.getStorageSync('openid')
// const fieldSet = {
diff --git a/src/pages/myOrderPaying/myOrderPaying.vue b/src/pages/myOrderPaying/myOrderPaying.vue
index 23db451..cf2448b 100644
--- a/src/pages/myOrderPaying/myOrderPaying.vue
+++ b/src/pages/myOrderPaying/myOrderPaying.vue
@@ -80,13 +80,13 @@
实付
- ¥{{orderInfo.order_info.total_fee}}
+ ¥{{orderInfo.order_info[0].total_fee}}
- 订单号:{{orderInfo.prepay_id}}
+ 订单号:{{payId}}
- 下单时间:{{orderInfo.pay_time}}
+ 下单时间:{{orderInfo.order_info[0].pay_time}}
@@ -131,13 +131,11 @@ export default {
},
data () {
return {
- // orderInfo:{},
payId: '',
status: '',
uid: '',
openid: '',
lefttime: 0
-
}
},
onLoad: function (option) {
@@ -159,7 +157,7 @@ export default {
computed: {
// 获取订单详细信息
orderInfo () {
- console.log(this.$store.state.orderRead.orderInfo)
+ console.log('orderInfo', this.$store.state.orderRead.orderInfo)
return this.$store.state.orderRead.orderInfo || {}
},
orderInfoList () {
diff --git a/src/pages/purchaseLenses/purchaseLenses.vue b/src/pages/purchaseLenses/purchaseLenses.vue
index 6a6faaf..201bf75 100644
--- a/src/pages/purchaseLenses/purchaseLenses.vue
+++ b/src/pages/purchaseLenses/purchaseLenses.vue
@@ -49,6 +49,8 @@
@@ -371,7 +373,8 @@ export default {
count: 1,
pid: 0,
maxCount: 20,
- isShow: true,
+ dataName: '', // 验光数据人员名称
+ isDataName: false,
opIsOpen: true,
addDisabled: false,
desDisabled: false,
@@ -384,6 +387,9 @@ export default {
sku_name: 'Miss 黑二代【减龄自然】',
sk_id: '128'
},
+ checkedData: {
+
+ },
chooseRes2: '14.0',
chooseRes3: 0,
chooseItem1: [
@@ -426,6 +432,9 @@ export default {
},
skuList() {
return this.$store.state.read.goodInfo.skuList
+ },
+ mpList() {
+ return this.$store.state.myLoveList.loveList
}
},
onLoad({ pid }) {
@@ -442,8 +451,31 @@ export default {
this.current = current
this.show = show
})
+ store.dispatch('myLoveList/getLoveList')
},
methods: {
+ // 是否填充人员数据
+ fillData(e) {
+ this.isDataName = false
+ console.log('e---->', e)
+ const mpList = this.mpList
+
+ for (let index = 0; index < mpList.length; index++) {
+ if (e.detail.value === mpList[index].name) {
+ this.isDataName = true
+ uni.showModal({
+ title: '提示',
+ content: `是否填充已有的${e.detail.value}的数据`,
+ success: ({ confirm }) => {
+ if (confirm) {
+ this.checkedData = mpList[index]
+ console.log('checkedData', this.checkedData)
+ }
+ }
+ })
+ }
+ }
+ },
change(num) {
this.show[num] = !this.show[num]
this.$forceUpdate()
@@ -480,9 +512,25 @@ export default {
}
},
toComfirmOrder() {
+ let i = 0
+ // 判断出是哪一个sku被选中
+ for (let index = 0; index < this.current.length; index++) {
+ console.log('index', index, i, index !== this.current.length - 1)
+ if (index !== this.current.length - 1) {
+ console.log('----', this.current[index], this.attrList[1].attr.length, this.attrList)
+ i = this.current[index] * this.attrList[1].attr.length
+ } else {
+ i += this.current[index]
+ }
+ console.log('i', i)
+ }
+ console.log('i------>', i)
+ // 判断是否其输入的人员数据是否已存在
store.dispatch('order/saveParams', {
+ sk_id_arr: this.skuList[i],
current: this.current
})
+
uni.navigateTo({
url: `../confirmOrder/confirmOrder?pid=${this.pid}`
})
diff --git a/src/store/modules/myLoveList.js b/src/store/modules/myLoveList.js
index 715a5d1..27cefab 100644
--- a/src/store/modules/myLoveList.js
+++ b/src/store/modules/myLoveList.js
@@ -1,68 +1,67 @@
-import urlAlias from '../url';
-import request from '../request';
-
-const {
+import urlAlias from '../url'
+import request from '../request'
+
+const {
mylovelist,
myloveadd,
- myloveupdate
-} = urlAlias;
-
-const state = {
- loveList: [],
-};
-
-const mutations = {
- INIT: (state, data) => {
- state.loveList = data;
+ myloveupdate
+} = urlAlias
+
+const state = {
+ loveList: []
+}
+
+const mutations = {
+ INIT: (state, data) => {
+ state.loveList = data
},
// 更新关心人验光单
- UPDATE:(state, data) => {
- // state.loveList.push(data)
- // console.log('UPDATA=====>',data)
- }
-};
-
-const actions = {
- getLoveList({ commit }, param) {
- request({
- url: mylovelist,
- data: param,
- success: (res) => {
- // console.log(res.data);
- commit("INIT", res.data.data);
- },
- })
+ UPDATE: (state, data) => {
+ // state.loveList.push(data)
+ // console.log('UPDATA=====>',data)
+ }
+}
+
+const actions = {
+ getLoveList({ commit }, param) {
+ request({
+ url: mylovelist,
+ data: param,
+ success: (res) => {
+ // console.log(res.data);
+ commit('INIT', res.data.data)
+ }
+ })
},
addMylove({ commit }, param) {
-
- console.log('myloveupdate-parm====>',param)
- request({
- url: myloveadd,
- data: param,
- success: (res) => {
- console.log('addMylove-parm====>',param)
- console.log(res.data);
- // commit("ADD", args);
- },
+ console.log('myloveupdate-parm====>', param)
+ request({
+ url: myloveadd,
+ data: param,
+ success: (res) => {
+ console.log('addMylove-parm====>', param)
+ console.log(res.data)
+ // commit("ADD", args);
+ }
})
},
updateMylove({ commit }, param) {
- request({
- url: myloveupdate,
- data: param,
- success: (res) => {
- console.log('myloveupdate-parm====>',param)
- console.log(res);
- // commit("UPDATE", param);
- },
+ request({
+ url: myloveupdate,
+ data: param,
+ success: (res) => {
+ console.log('myloveupdate-parm====>', param)
+ console.log(res)
+ // commit("UPDATE", param);
+ }
})
- },
-
-}
-
-export default {
- namespaced: true,
- state,
- mutations,
- actions,
-}
\ No newline at end of file
+ }
+
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/order.js b/src/store/modules/order.js
index 4faf68d..d2a54c4 100644
--- a/src/store/modules/order.js
+++ b/src/store/modules/order.js
@@ -3,7 +3,7 @@ import request from '../request'
const { orderBuild } = urlAlias
-const state = { list: [], param: [] }
+const state = { list: [], param: {} }
const mutations = {
LIST: (state, list) => {
diff --git a/src/store/request.js b/src/store/request.js
index 12338b3..7a48f4a 100644
--- a/src/store/request.js
+++ b/src/store/request.js
@@ -1,38 +1,40 @@
-const DOMAIN = 'https://api.glass.xiuyetang.com';
+const DOMAIN = 'https://api.glass.xiuyetang.com'
export default async function request({
- url,
- method = "post",
- data = {},
- header = {
- "Content-Type": "application/x-www-form-urlencoded",
- },
- timeout = 3000,
- withCredentials = false, // 跨域请求时是否携带凭证(cookies)
- // sslVerify: true, // 验证 ssl 证书
- success,
- fail = (res) => {
- console.log("fail status === > ", res);
- },
- complete = (res) => {
- console.log("complete status === > ", res);
- },
+ url,
+ method = 'post',
+ data = {},
+ header = {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ },
+ timeout = 3000,
+ withCredentials = false, // 跨域请求时是否携带凭证(cookies)
+ // sslVerify: true, // 验证 ssl 证书
+ success,
+ fail = (res) => {
+ console.log('fail status === > ', res)
+ },
+ complete = (res) => {
+ console.log('complete status === > ', res)
+ }
}) {
- const uid = uni.getStorageSync('uid');
- data = {
- uid,
- ...data,
- };
- uni
- .request({
- url: DOMAIN + url,
- method,
- data,
- header,
- timeout,
- withCredentials,
- success,
- fail,
- complete,
- })
-}
\ No newline at end of file
+ const uid = uni.getStorageSync('uid')
+ const openid = uni.getStorageSync('uid')
+ data = {
+ uid,
+ openid,
+ ...data
+ }
+ uni
+ .request({
+ url: DOMAIN + url,
+ method,
+ data,
+ header,
+ timeout,
+ withCredentials,
+ success,
+ fail,
+ complete
+ })
+}
--
2.0.0