Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
h5-base
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
new-sing
h5-base
Commits
465e9148
Commit
465e9148
authored
Oct 09, 2019
by
IvyXia123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
20191009-打卡
parent
ae07b3e9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
701 additions
and
893 deletions
+701
-893
zhifubaotup.png
src/assets/punchTheClock/zhifubaotup.png
+0
-0
zhiying.png
src/assets/punchTheClock/zhiying.png
+0
-0
buy.vue
src/components/buy/buy.vue
+686
-675
guidelines.vue
src/components/buy/guidelines.vue
+0
-56
index.vue
src/components/punchTheClock/index.vue
+1
-1
main.js
src/main.js
+6
-61
index.js
src/router/index.js
+8
-31
api.js
src/service/api.js
+0
-5
common.js
src/util/common.js
+0
-27
vancs.less
src/util/vancs.less
+0
-37
No files found.
src/assets/punchTheClock/zhifubaotup.png
deleted
100755 → 0
View file @
ae07b3e9
23.5 KB
src/assets/punchTheClock/zhiying.png
deleted
100755 → 0
View file @
ae07b3e9
43.9 KB
src/components/buy/buy.vue
View file @
465e9148
<
template
>
<div
class=
"group-buy"
>
<!--
<guidelines
v-if=
"guidelinesShow"
></guidelines>
-->
<div
:style=
"
{backgroundImage:`url('${lineImage}')`}" class="main-background">
<div
class=
"title-top"
>
<img
:src=
"clock"
/>
...
...
@@ -74,7 +71,7 @@
</div>
<!-- 支付方式选择 -->
<div
class=
"pay-list"
>
<
!--
<
div
class=
"pay-list"
>
<div
class=
"pay-choice"
>
支付方式选择
</div>
<ul
class=
"pay"
>
<li
v-for=
"item in payList"
:key=
"item.value"
@
click=
"payListClick(item.value)"
>
...
...
@@ -85,8 +82,7 @@
</div>
</li>
</ul>
</div>
</div>
-->
<footer>
<div
class=
"sub-block"
>
...
...
@@ -95,8 +91,11 @@
class=
"tips-price"
v-if=
"groupDetail.goods_desc"
>
{{
groupDetail
.
goods_desc
.
tips
?
groupDetail
.
goods_desc
.
tips
:
''
}}
</span>
<!--
<div
class=
"pay-btn"
@
click=
"payOrder(orderFlag)"
>
提交订单
</div>
-->
<div
class=
"pay-btn"
@
click=
"payOrder(orderFlag)"
>
提交订单
</div>
<!--
<div
class=
"pay-btn"
@
click=
"payOrder(orderFlag)"
v-clipboard:copy=
"payIndex !== 0 ? payUrl : ''"
v-clipboard:success=
"copy"
v-clipboard:error=
"onError"
>
提交订单
</div>
-->
</div>
</footer>
<transition
name=
"slide-fade"
>
...
...
@@ -131,753 +130,765 @@
</
template
>
<
script
>
import
{
Toast
}
from
"vant"
;
import
{
getUserAdressApi
,
getGoodsDetailApi
,
payApi
,
getwechatParam
,
getStatusWechatApi
,
getCouponListApi
,
getCourseInfoApi
,
postPayBillApi
}
from
"../../service/api"
;
import
addAddress
from
"./address"
;
import
loginPage
from
"./login"
;
import
youHuiUrl
from
"../../assets/shop/pic.png"
;
import
saleDiv
from
"./sale"
;
import
lineImage
from
"../../assets/shop/buyBg.png"
;
import
clock
from
"../../assets/shop/clock.png"
;
import
addressImg
from
"../../assets/shop/address.png"
;
import
leftG
from
"../../assets/shop/leftg.png"
;
import
popup_img
from
"../../assets/shop/popup_img@2x.png"
;
import
weixin
from
"../../assets/evaluate/weixin.png"
;
import
zhifubao
from
"../../assets/evaluate/zhifubao.png"
;
import
xinyongka
from
"../../assets/evaluate/xinyongka.png"
;
import
fenqi
from
"../../assets/evaluate/fenqi.png"
;
import
icon_re
from
"../../assets/evaluate/icon_re.png"
;
import
icon_re_acitve
from
"../../assets/evaluate/icon_re_acitve.png"
;
import
{
Popup
}
from
"mint-ui"
;
import
guidelines
from
'./guidelines'
import
{
Toast
}
from
"vant"
;
import
{
getUserAdressApi
,
getGoodsDetailApi
,
payApi
,
getwechatParam
,
getStatusWechatApi
,
getCouponListApi
,
getCourseInfoApi
,
postPayBillApi
}
from
"../../service/api"
;
import
addAddress
from
"./address"
;
import
loginPage
from
"./login"
;
import
youHuiUrl
from
"../../assets/shop/pic.png"
;
import
saleDiv
from
"./sale"
;
import
lineImage
from
"../../assets/shop/buyBg.png"
;
import
clock
from
"../../assets/shop/clock.png"
;
import
addressImg
from
"../../assets/shop/address.png"
;
import
leftG
from
"../../assets/shop/leftg.png"
;
import
popup_img
from
"../../assets/shop/popup_img@2x.png"
;
import
weixin
from
"../../assets/evaluate/weixin.png"
;
import
zhifubao
from
"../../assets/evaluate/zhifubao.png"
;
import
xinyongka
from
"../../assets/evaluate/xinyongka.png"
;
import
fenqi
from
"../../assets/evaluate/fenqi.png"
;
import
icon_re
from
"../../assets/evaluate/icon_re.png"
;
import
icon_re_acitve
from
"../../assets/evaluate/icon_re_acitve.png"
;
import
{
Popup
}
from
"mint-ui"
;
export
default
{
name
:
"buy"
,
components
:
{
addAddress
,
saleDiv
,
loginPage
,
[
Popup
.
name
]:
Popup
,
guidelines
},
data
()
{
return
{
bindMobile
:
{
show
:
false
,
mobile
:
""
,
img_code
:
""
,
verify_code
:
""
,
flag
:
false
},
iconRe
:
icon_re
,
icon_re_acitve
:
icon_re_acitve
,
lineImage
:
lineImage
,
youHuiUrl
:
youHuiUrl
,
leftG
:
leftG
,
addressImg
:
addressImg
,
addressPop
:
false
,
clock
:
clock
,
groupDetail
:
false
,
popupVisible
:
true
,
orderFlag
:
false
,
shopId
:
""
,
salePop
:
{
show
:
false
,
id
:
""
},
saleObj
:
null
,
hasMObile
:
!
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
||
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
===
""
,
userDetail
:
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)),
// mobile:'',
group_order_id
:
null
,
addressObj
:
false
,
price
:
""
,
invite_code
:
""
,
type
:
this
.
$route
.
query
.
type
,
jsApiParameters
:
""
,
orderNo
:
""
,
canSale
:
false
,
popup_img
:
popup_img
,
orderCancel
:
false
,
userCourse
:
{},
payList
:
[
{
icon
:
weixin
,
title
:
'微信支付'
,
value
:
0
},
{
icon
:
zhifubao
,
title
:
'支付宝支付'
,
value
:
1
}
],
payIndex
:
0
,
};
},
mounted
()
{
this
.
initPage
();
export
default
{
name
:
"buy"
,
components
:
{
addAddress
,
saleDiv
,
loginPage
,
[
Popup
.
name
]:
Popup
},
data
()
{
return
{
bindMobile
:
{
show
:
false
,
mobile
:
""
,
img_code
:
""
,
verify_code
:
""
,
flag
:
false
},
iconRe
:
icon_re
,
icon_re_acitve
:
icon_re_acitve
,
lineImage
:
lineImage
,
youHuiUrl
:
youHuiUrl
,
leftG
:
leftG
,
addressImg
:
addressImg
,
addressPop
:
false
,
clock
:
clock
,
groupDetail
:
false
,
popupVisible
:
true
,
orderFlag
:
false
,
shopId
:
""
,
salePop
:
{
show
:
false
,
id
:
""
},
saleObj
:
null
,
hasMObile
:
!
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
||
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
===
""
,
userDetail
:
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)),
// mobile:'',
group_order_id
:
null
,
addressObj
:
false
,
price
:
""
,
invite_code
:
""
,
type
:
this
.
$route
.
query
.
type
,
jsApiParameters
:
""
,
orderNo
:
""
,
canSale
:
false
,
popup_img
:
popup_img
,
orderCancel
:
false
,
userCourse
:
{},
payList
:
[
{
icon
:
weixin
,
title
:
'微信支付'
,
value
:
0
},
{
icon
:
zhifubao
,
title
:
'支付宝支付'
,
value
:
1
},
{
icon
:
xinyongka
,
title
:
'信用卡分期'
,
value
:
2
},
{
icon
:
fenqi
,
title
:
'其他分期'
,
value
:
3
},
],
payIndex
:
0
,
payUrl
:
''
};
},
mounted
()
{
this
.
initPage
();
},
filters
:
{
price
(
value
)
{
return
(
value
/
100
).
toFixed
(
1
);
}
},
computed
:
{
priceTotal
()
{
let
priceT
=
0
;
if
(
this
.
type
)
{
priceT
=
this
.
groupDetail
.
original_price
;
}
else
{
priceT
=
this
.
groupDetail
.
current_price
;
}
if
(
this
.
saleObj
)
{
priceT
=
priceT
-
this
.
saleObj
.
money
;
}
priceT
=
(
priceT
/
100
).
toFixed
(
2
);
let
str
=
priceT
.
toString
();
if
(
str
.
length
>
1
)
{
str
=
str
.
split
(
"."
)[
1
];
if
(
str
===
"0"
)
priceT
=
parseInt
(
priceT
);
}
return
priceT
;
}
},
methods
:
{
copy
(
e
)
{
if
(
this
.
payIndex
===
1
)
{
Toast
(
"支付宝支付获取成功,请把粘贴到支付宝里"
);
}
else
if
(
this
.
payIndex
===
2
)
{
Toast
(
"信用卡支付获取成功"
);
}
},
filters
:
{
price
(
value
)
{
return
(
value
/
100
).
toFixed
(
1
);
onError
()
{
if
(
this
.
payIndex
===
1
)
{
Toast
(
"信用卡支付获取成功"
);
}
},
computed
:
{
priceTotal
()
{
let
priceT
=
0
;
if
(
this
.
type
)
{
priceT
=
this
.
groupDetail
.
original_price
;
}
else
{
priceT
=
this
.
groupDetail
.
current_price
;
}
if
(
this
.
saleObj
)
{
priceT
=
priceT
-
this
.
saleObj
.
money
;
}
priceT
=
(
priceT
/
100
).
toFixed
(
2
);
let
str
=
priceT
.
toString
();
if
(
str
.
length
>
1
)
{
str
=
str
.
split
(
"."
)[
1
];
if
(
str
===
"0"
)
priceT
=
parseInt
(
priceT
);
// 支付方式
payListClick
(
val
)
{
this
.
payIndex
=
val
},
recursion
()
{
getCourseInfoApi
().
then
(
res
=>
{
if
(
res
.
status
){
this
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
));
this
.
navPage
(
res
);
}
else
{
setTimeout
(()
=>
{
this
.
recursion
()
},
500
);
}
return
priceT
;
}
});
},
methods
:
{
// 支付方式
payListClick
(
val
)
{
this
.
orderFlag
=
true
;
this
.
payIndex
=
val
},
recursion
()
{
getCourseInfoApi
().
then
(
res
=>
{
if
(
res
.
status
){
this
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
));
this
.
navPage
(
res
);
}
else
{
jsApiCall
:
function
()
{
let
that
=
this
;
WeixinJSBridge
.
invoke
(
"getBrandWCPayRequest"
,
that
.
jsApiParameters
,
function
(
res
)
{
that
.
orderFlag
=
true
;
console
.
log
(
res
,
110
);
if
(
res
.
err_msg
===
"get_brand_wcpay_request:ok"
)
{
// 支付成功后处理
console
.
log
(
237
)
Toast
(
"支付成功"
);
setTimeout
(()
=>
{
this
.
recursion
()
},
500
);
}
});
},
jsApiCall
:
function
()
{
let
that
=
this
;
WeixinJSBridge
.
invoke
(
"getBrandWCPayRequest"
,
that
.
jsApiParameters
,
function
(
res
)
{
that
.
orderFlag
=
true
;
if
(
res
.
err_msg
===
"get_brand_wcpay_request:ok"
)
{
// 支付成功后处理
Toast
(
"支付成功"
);
setTimeout
(()
=>
{
getCourseInfoApi
().
then
(
res
=>
{
that
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
that
.
userCourse
)
);
that
.
navPage
(
res
);
});
},
1500
);
}
if
(
res
.
err_msg
===
"get_brand_wcpay_request:fail"
)
{
}
if
(
res
.
err_msg
===
"get_brand_wcpay_request:cancel"
)
{
that
.
orderCancel
=
true
;
}
}
);
},
chooseSale
(
data
)
{
this
.
saleObj
=
data
;
},
showSale
()
{
this
.
salePop
.
id
=
this
.
shopId
;
this
.
salePop
.
show
=
true
;
},
buttonClick
(
buttonType
,
buttonName
)
{
this
.
$sa
.
track
(
"buttonClick"
,
{
tabTitle
:
"商品"
,
moduleTitle
:
"购买页"
,
buttonType
:
buttonType
,
buttonName
:
buttonName
});
},
goToBuyPage
()
{
Toast
(
"提交成功"
);
this
.
bindMobile
.
show
=
false
;
},
payOrder
(
flag
)
{
console
.
log
(
flag
)
let
type
=
this
.
type
?
0
:
1
;
let
that
=
this
;
this
.
orderCancel
=
false
;
if
(
!
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
||
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
===
""
)
{
this
.
bindMobile
.
flag
=
type
;
this
.
bindMobile
.
show
=
true
;
setTimeout
(()
=>
{
this
.
$sa
.
track
(
"ViewRegisterpage"
,
{});
},
1000
);
}
else
if
(
flag
)
{
let
json
=
{
goods_id
:
Number
(
this
.
shopId
)
};
if
(
this
.
groupDetail
.
is_real
===
1
&&
!
this
.
addressObj
)
{
Toast
(
"请填写地址"
);
return
false
;
}
if
(
this
.
groupDetail
.
goods_type
===
2
&&
!
this
.
type
)
{
json
.
buy_type
=
2
;
}
if
(
this
.
invite_code
)
{
json
.
invite_code
=
this
.
invite_code
;
}
if
(
this
.
saleObj
)
{
json
.
order_coupon_id
=
this
.
saleObj
.
id
;
}
let
invite
=
this
.
$route
.
query
.
invite_code
;
this
.
$sa
.
track
(
"placeOrder"
,
{
buyType
:
this
.
groupDetail
.
goods_type
===
2
&&
!
this
.
type
?
"团购"
:
"直购"
,
couponAmount
:
this
.
saleObj
?
Number
(
this
.
saleObj
.
money
/
100
)
:
0
,
paymentAmount
:
Number
(
this
.
priceTotal
),
goodsID
:
this
.
shopId
.
toString
(),
salesType
:
invite
?
invite
.
split
(
"-"
)[
1
]
:
"null"
,
salesID
:
invite
?
Number
(
invite
.
split
(
"-"
)[
2
])
:
0
});
console
.
log
(
window
.
location
.
href
.
indexOf
(
"gdt_vid"
))
if
(
window
.
location
.
href
.
indexOf
(
"gdt_vid"
)
>
-
1
){
json
.
gdt_vid
=
localStorage
.
getItem
(
"gdt_vid"
)
}
if
(
window
.
location
.
href
.
indexOf
(
"group_order_id"
)
>
-
1
){
json
.
cct_user_id
=
localStorage
.
getItem
(
"cct_user_id"
)
console
.
log
(
238
)
getCourseInfoApi
().
then
(
res
=>
{
that
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
that
.
userCourse
)
);
that
.
navPage
(
res
);
});
},
1500
);
}
if
(
window
.
location
.
href
.
indexOf
(
"group_order_id"
)
>
-
1
)
{
json
.
group_order_id
=
this
.
$route
.
query
.
group_order_id
;
// alert(res.errMsg)
// alert(res.err_msg)
if
(
res
.
err_msg
===
"get_brand_wcpay_request:fail"
)
{
}
this
.
orderFlag
=
false
;
if
(
this
.
payIndex
===
0
)
{
// 微信支付
payApi
(
json
).
then
(
res
=>
{
this
.
orderNo
=
res
.
out_trade_no
;
console
.
log
(
res
)
if
(
res
.
out_trade_no
&&
!
res
.
appId
)
{
getCourseInfoApi
().
then
(
res
=>
{
this
.
userCourse
=
res
;
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
)
);
this
.
navPage
(
res
);
});
}
else
{
let
that
=
this
;
this
.
orderNo
=
res
.
out_trade_no
;
this
.
jsApiParameters
=
res
;
wx
.
miniProgram
.
getEnv
(
function
(
res
)
{
if
(
res
.
miniprogram
)
{
let
payParam
=
encodeURIComponent
(
JSON
.
stringify
(
json
));
wx
.
miniProgram
.
navigateTo
({
url
:
`pages/wxPay/main?payParam=
${
payParam
}
`
});
}
else
if
(
typeof
WeixinJSBridge
===
"undefined"
)
{
if
(
document
.
addEventListener
)
{
document
.
addEventListener
(
"WeixinJSBridgeReady"
,
that
.
jsApiCall
,
false
);
}
else
if
(
document
.
attachEvent
)
{
document
.
attachEvent
(
"WeixinJSBridgeReady"
,
that
.
jsApiCall
);
document
.
attachEvent
(
"onWeixinJSBridgeReady"
,
that
.
jsApiCall
);
}
}
else
{
that
.
jsApiCall
();
}
});
}
})
.
catch
(
res
=>
{
// alert(res)
this
.
orderFlag
=
true
;
});
}
else
{
// 支付宝支付
let
data
=
{
pay_type
:
'ALI'
,
return_url
:
window
.
location
.
href
,
buy_type
:
this
.
groupDetail
.
goods_type
}
let
dataObj
=
Object
.
assign
({},
data
,
json
)
postPayBillApi
(
dataObj
).
then
(
res
=>
{
let
outTradEno
=
JSON
.
stringify
({
out_trade_no
:
res
.
out_trade_no
,
invite_code
:
this
.
$route
.
query
.
invite_code
,
shopId
:
this
.
$route
.
query
.
shopId
,
goods_type
:
this
.
groupDetail
.
goods_type
,
is_subscribe
:
this
.
userDetail
.
open_info
.
is_subscribe
})
localStorage
.
setItem
(
'out_trade_no'
,
outTradEno
);
localStorage
.
setItem
(
'pay_url'
,
res
.
pay_url
);
location
.
href
=
`http://
${
window
.
location
.
host
}
/#/guidelines?pay_url=
${
encodeURI
(
res
.
pay_url
)
}
`
}).
catch
(
err
=>
{
console
.
log
(
err
)
Toast
(
err
.
msg
)
})
if
(
res
.
err_msg
===
"get_brand_wcpay_request:cancel"
)
{
that
.
orderCancel
=
true
;
}
}
},
closeAdd
(
data
)
{
this
.
addressPop
=
data
;
this
.
initPage
();
},
showAdd
()
{
this
.
addressPop
=
true
;
},
initPage
()
{
Toast
.
loading
({
mask
:
true
,
message
:
""
});
sessionStorage
.
setItem
(
"buyindex"
,
1
);
getwechatParam
({
api_list
:
"chooseWXPay"
}).
then
(
res
=>
{
wx
.
config
({
debug
:
false
,
appId
:
res
.
appId
,
timestamp
:
parseInt
(
res
.
timestamp
),
nonceStr
:
res
.
nonceStr
,
signature
:
res
.
signature
,
jsApiList
:
res
.
jsApiList
});
});
getUserAdressApi
().
then
(
res
=>
{
this
.
addressObj
=
res
;
});
this
.
shopId
=
this
.
$route
.
query
.
shopId
;
this
.
group_order_id
=
this
.
$route
.
query
.
group_order_id
;
getCouponListApi
(
this
.
shopId
).
then
(
res
=>
{
if
(
res
.
length
>
0
)
{
let
x
=
{
money
:
0
};
for
(
let
k
=
0
;
k
<
res
.
length
;
k
++
)
{
x
=
res
[
k
].
money
>
x
.
money
?
res
[
k
]
:
x
;
}
this
.
saleObj
=
x
;
this
.
canSale
=
true
;
}
);
},
chooseSale
(
data
)
{
this
.
saleObj
=
data
;
},
showSale
()
{
this
.
salePop
.
id
=
this
.
shopId
;
this
.
salePop
.
show
=
true
;
},
buttonClick
(
buttonType
,
buttonName
)
{
this
.
$sa
.
track
(
"buttonClick"
,
{
tabTitle
:
"商品"
,
moduleTitle
:
"购买页"
,
buttonType
:
buttonType
,
buttonName
:
buttonName
});
},
goToBuyPage
()
{
Toast
(
"提交成功"
);
this
.
bindMobile
.
show
=
false
;
},
payOrder
(
flag
)
{
let
type
=
this
.
type
?
0
:
1
;
let
that
=
this
;
this
.
orderCancel
=
false
;
if
(
!
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
||
JSON
.
parse
(
localStorage
.
getItem
(
"userDesc"
)).
mobile
===
""
)
{
this
.
bindMobile
.
flag
=
type
;
this
.
bindMobile
.
show
=
true
;
setTimeout
(()
=>
{
this
.
$sa
.
track
(
"ViewRegisterpage"
,
{});
},
1000
);
}
else
if
(
flag
)
{
let
json
=
{
goods_id
:
Number
(
this
.
shopId
)
};
if
(
this
.
groupDetail
.
is_real
===
1
&&
!
this
.
addressObj
)
{
Toast
(
"请填写地址"
);
return
false
;
}
if
(
this
.
groupDetail
.
goods_type
===
2
&&
!
this
.
type
)
{
json
.
buy_type
=
2
;
}
if
(
this
.
invite_code
)
{
json
.
invite_code
=
this
.
invite_code
;
}
if
(
this
.
saleObj
)
{
json
.
order_coupon_id
=
this
.
saleObj
.
id
;
}
let
invite
=
this
.
$route
.
query
.
invite_code
;
this
.
$sa
.
track
(
"placeOrder"
,
{
buyType
:
this
.
groupDetail
.
goods_type
===
2
&&
!
this
.
type
?
"团购"
:
"直购"
,
couponAmount
:
this
.
saleObj
?
Number
(
this
.
saleObj
.
money
/
100
)
:
0
,
paymentAmount
:
Number
(
this
.
priceTotal
),
goodsID
:
this
.
shopId
.
toString
(),
salesType
:
invite
?
invite
.
split
(
"-"
)[
1
]
:
"null"
,
salesID
:
invite
?
Number
(
invite
.
split
(
"-"
)[
2
])
:
0
});
getGoodsDetailApi
(
this
.
shopId
).
then
(
data
=>
{
// debugger
data
.
desc
=
JSON
.
parse
(
data
.
desc
);
data
.
goods_desc
=
JSON
.
parse
(
data
.
goods_desc
);
data
.
share_desc
=
JSON
.
parse
(
data
.
share_desc
);
this
.
groupDetail
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
localStorage
.
setItem
(
"groupDetail"
,
JSON
.
stringify
(
data
));
console
.
log
(
this
.
groupDetail
,
408
);
this
.
invite_code
=
this
.
$route
.
query
.
invite_code
;
if
(
this
.
type
&&
this
.
type
===
0
)
{
this
.
price
=
data
.
single_price
/
100
;
}
else
{
this
.
price
=
data
.
group_price
/
100
;
}
getStatusWechatApi
({
goods_id
:
this
.
shopId
}).
then
(
res
=>
{
Toast
.
clear
();
let
orderData
=
res
;
console
.
log
(
window
.
location
.
href
.
indexOf
(
"gdt_vid"
))
if
(
window
.
location
.
href
.
indexOf
(
"gdt_vid"
)
>
-
1
){
json
.
gdt_vid
=
localStorage
.
getItem
(
"gdt_vid"
)
}
if
(
window
.
location
.
href
.
indexOf
(
"group_order_id"
)
>
-
1
){
json
.
cct_user_id
=
localStorage
.
getItem
(
"cct_user_id"
)
}
if
(
window
.
location
.
href
.
indexOf
(
"group_order_id"
)
>
-
1
)
{
json
.
group_order_id
=
this
.
$route
.
query
.
group_order_id
;
}
this
.
orderFlag
=
false
;
/*let payTypeArr = ['WX', 'ALI', 'KFQ']
let data = { pay_type: payTypeArr[this.payIndex], return_url: window.location.href, goods_id: json.goods_id, buy_type: this.groupDetail.goods_type, group_order_id: json.group_order_id, order_coupon_id:json.order_coupon_id }
postPayBillApi(data).then(res => {
if(this.payIndex === 0) {
window.location.href = res.pay_url;
}else if(this.payIndex === 1){
this.payUrl = res.pay_url;
}else if(this.payIndex === 2) {
this.payUrl = res.pay_url;
}
})*/
payApi
(
json
).
then
(
res
=>
{
this
.
orderNo
=
res
.
out_trade_no
;
if
(
res
.
out_trade_no
)
{
console
.
log
(
res
)
if
(
res
.
out_trade_no
&&
!
res
.
appId
)
{
getCourseInfoApi
().
then
(
res
=>
{
this
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
res
))
;
this
.
userCourse
=
res
;
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
)
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
)
);
this
.
navPage
(
res
);
console
.
log
(
res
,
424
);
});
}
else
{
let
that
=
this
;
this
.
orderNo
=
res
.
out_trade_no
;
this
.
jsApiParameters
=
res
;
wx
.
miniProgram
.
getEnv
(
function
(
res
)
{
if
(
res
.
miniprogram
)
{
let
payParam
=
encodeURIComponent
(
JSON
.
stringify
(
json
));
wx
.
miniProgram
.
navigateTo
({
url
:
`pages/wxPay/main?payParam=
${
payParam
}
`
});
}
else
if
(
typeof
WeixinJSBridge
===
"undefined"
)
{
if
(
document
.
addEventListener
)
{
document
.
addEventListener
(
"WeixinJSBridgeReady"
,
that
.
jsApiCall
,
false
);
}
else
if
(
document
.
attachEvent
)
{
document
.
attachEvent
(
"WeixinJSBridgeReady"
,
that
.
jsApiCall
);
document
.
attachEvent
(
"onWeixinJSBridgeReady"
,
that
.
jsApiCall
);
}
}
else
{
that
.
jsApiCall
();
}
});
}
});
this
.
$nextTick
(()
=>
{
})
.
catch
(
res
=>
{
// alert(res)
this
.
orderFlag
=
true
;
});
}
},
closeAdd
(
data
)
{
this
.
addressPop
=
data
;
this
.
initPage
();
},
showAdd
()
{
this
.
addressPop
=
true
;
},
initPage
()
{
Toast
.
loading
({
mask
:
true
,
message
:
""
});
sessionStorage
.
setItem
(
"buyindex"
,
1
);
getwechatParam
({
api_list
:
"chooseWXPay"
}).
then
(
res
=>
{
wx
.
config
({
debug
:
false
,
appId
:
res
.
appId
,
timestamp
:
parseInt
(
res
.
timestamp
),
nonceStr
:
res
.
nonceStr
,
signature
:
res
.
signature
,
jsApiList
:
res
.
jsApiList
});
},
navPage
(
res
)
{
console
.
log
(
res
,
437
);
console
.
log
(
this
.
groupDetail
);
if
(
res
.
teacher_alias
&&
res
.
teacher_alias
.
substr
(
0
,
1
)
==
1
&&
this
.
groupDetail
.
goods_type
!=
4
&&
this
.
userDetail
.
open_info
.
is_subscribe
==
1
)
{
this
.
$router
.
push
({
name
:
"guide"
,
query
:
{
shopId
:
this
.
shopId
}
});
});
getUserAdressApi
().
then
(
res
=>
{
this
.
addressObj
=
res
;
});
this
.
shopId
=
this
.
$route
.
query
.
shopId
;
this
.
group_order_id
=
this
.
$route
.
query
.
group_order_id
;
getCouponListApi
(
this
.
shopId
).
then
(
res
=>
{
if
(
res
.
length
>
0
)
{
let
x
=
{
money
:
0
};
for
(
let
k
=
0
;
k
<
res
.
length
;
k
++
)
{
x
=
res
[
k
].
money
>
x
.
money
?
res
[
k
]
:
x
;
}
this
.
saleObj
=
x
;
this
.
canSale
=
true
;
}
});
getGoodsDetailApi
(
this
.
shopId
).
then
(
data
=>
{
// debugger
data
.
desc
=
JSON
.
parse
(
data
.
desc
);
data
.
goods_desc
=
JSON
.
parse
(
data
.
goods_desc
);
data
.
share_desc
=
JSON
.
parse
(
data
.
share_desc
);
this
.
groupDetail
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
sessionStorage
.
setItem
(
"groupDetail"
,
JSON
.
stringify
(
data
));
console
.
log
(
this
.
groupDetail
,
408
);
this
.
invite_code
=
this
.
$route
.
query
.
invite_code
;
if
(
this
.
type
&&
this
.
type
===
0
)
{
this
.
price
=
data
.
single_price
/
100
;
}
else
{
if
(
this
.
groupDetail
.
goods_type
===
2
&&
!
this
.
type
)
{
this
.
$router
.
push
({
name
:
"success"
,
query
:
{
out_trade_no
:
this
.
orderNo
,
invite_code
:
this
.
invite_code
,
shopId
:
this
.
shopId
}
});
}
else
if
(
this
.
groupDetail
.
goods_type
===
4
)
{
this
.
$router
.
push
({
name
:
"saleSuccess"
,
query
:
{
out_trade_no
:
this
.
orderNo
,
invite_code
:
this
.
invite_code
,
shopId
:
this
.
shopId
}
});
}
else
{
this
.
$router
.
push
({
name
:
"buySuccess"
,
query
:
{
out_trade_no
:
this
.
orderNo
,
invite_code
:
this
.
invite_code
,
shopId
:
this
.
shopId
}
this
.
price
=
data
.
group_price
/
100
;
}
getStatusWechatApi
({
goods_id
:
this
.
shopId
}).
then
(
res
=>
{
Toast
.
clear
();
let
orderData
=
res
;
this
.
orderNo
=
res
.
out_trade_no
;
if
(
res
.
out_trade_no
)
{
getCourseInfoApi
().
then
(
res
=>
{
this
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
)
);
this
.
navPage
(
res
);
console
.
log
(
res
,
424
);
});
}
});
this
.
$nextTick
(()
=>
{
this
.
orderFlag
=
true
;
});
});
},
navPage
(
res
)
{
console
.
log
(
res
,
437
);
console
.
log
(
this
.
groupDetail
);
if
(
res
.
teacher_alias
&&
res
.
teacher_alias
.
substr
(
0
,
1
)
==
1
&&
this
.
groupDetail
.
goods_type
!=
4
&&
this
.
userDetail
.
open_info
.
is_subscribe
==
1
)
{
this
.
$router
.
push
({
name
:
"guide"
,
query
:
{
shopId
:
this
.
shopId
}
});
}
else
{
if
(
this
.
groupDetail
.
goods_type
===
2
&&
!
this
.
type
)
{
this
.
$router
.
push
({
name
:
"success"
,
query
:
{
out_trade_no
:
this
.
orderNo
,
invite_code
:
this
.
invite_code
,
shopId
:
this
.
shopId
}
});
}
else
if
(
this
.
groupDetail
.
goods_type
===
4
)
{
this
.
$router
.
push
({
name
:
"saleSuccess"
,
query
:
{
out_trade_no
:
this
.
orderNo
,
invite_code
:
this
.
invite_code
,
shopId
:
this
.
shopId
}
});
}
else
{
this
.
$router
.
push
({
name
:
"buySuccess"
,
query
:
{
out_trade_no
:
this
.
orderNo
,
invite_code
:
this
.
invite_code
,
shopId
:
this
.
shopId
}
});
}
}
}
};
}
};
</
script
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
@import "../../util/public";
img {
max-width: none;
}
.slide-fade-enter-active {
transition: all 0.5s ease;
}
.you-block {
font-size: 16 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(0, 0, 0, 1);
line-height: 40 * @toVw;
margin-top: 10 * @toVw;
height: 40 * @toVw;
padding: 5 * @toVw 15 * @toVw;
background: white;
img {
max-width: none;
width: 16 * @toVw;
margin-left: 8 * @toVw;
vertical-align: middle;
}
.slide-fade-enter-active {
transition: all 0.5s ease;
.you-content {
float: right;
color: #999999;
font-size: 14 * @toVw;
}
.you-block {
font-size: 16 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(0, 0, 0, 1);
line-height: 40 * @toVw;
margin-top: 10 * @toVw;
height: 40 * @toVw;
padding: 5 * @toVw 15 * @toVw;
background: white;
img {
width: 16 * @toVw;
margin-left: 8 * @toVw;
vertical-align: middle;
}
.orderCancel {
top: 45%;
background: transparent;
.box {
width: 315 * @toVw;
}
.img {
width: 315 * @toVw;
}
.content {
position: absolute;
width: 315 * @toVw;
top: 112 * @toVw;
left: 0;
text-align: center;
h2 {
font-size: 25 * @toVw;
color: #6c6c6c;
}
.you-content {
float: right;
color: #999999;
p {
font-size: 14 * @toVw;
color: #999999;
margin: 20 * @toVw 0 0;
}
}
.orderCancel {
top: 45%;
background: transparent;
.box {
width: 315 * @toVw;
}
.img {
width: 315 * @toVw;
.warn {
font-size: 15 * @toVw;
color: #ec612a;
margin: 10 * @toVw 0 25 * @toVw;
font-weight: bold;
}
.content {
position: absolute;
width: 315 * @toVw;
top: 112 * @toVw;
left: 0;
text-align: center;
h2 {
font-size: 25 * @toVw;
color: #6c6c6c;
}
p {
.btnbox {
display: flex;
.btn {
width: 118 * @toVw;
height: 40 * @toVw;
line-height: 40 * @toVw;
font-size: 14 * @toVw;
color: #999999;
margin: 20 * @toVw 0 0;
}
.warn {
font-size: 15 * @toVw;
color: #ec612a;
margin: 10 * @toVw 0 25 * @toVw;
color: white;
border-radius: 20 * @toVw;
font-weight: bold;
}
.btnbox {
display: flex;
.btn {
width: 118 * @toVw;
height: 40 * @toVw;
line-height: 40 * @toVw;
font-size: 14 * @toVw;
color: white;
border-radius: 20 * @toVw;
font-weight: bold;
}
.fal {
background: #f8d56b;
box-shadow: 0px 4px 0px 0px rgba(239, 147, 70, 0.97);
}
.suc {
background: #ec612a;
box-shadow: 0px 4px 0px 0px rgba(190, 61, 10, 0.97);
}
.fal {
background: #f8d56b;
box-shadow: 0px 4px 0px 0px rgba(239, 147, 70, 0.97);
}
.suc {
background: #ec612a;
box-shadow: 0px 4px 0px 0px rgba(190, 61, 10, 0.97);
}
}
}
}
.slide-fade-leave-active {
transition: all 0.5s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter, .slide-fade-leave-to
.slide-fade-leave-active {
transition: all 0.5s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active for below version 2.1.8 */ {
transform: translateX(10px);
opacity: 0;
}
.phone-block {
padding: 10 * @toVw;
text-align: center;
background: #f8f8f8;
}
.phone-input {
width: 280 * @toVw;
height: 30 * @toVw;
border-radius: 8 * @toVw;
outline: none;
padding: 0 10 * @toVw;
border: 1px solid #e8e8e8;
text-align: center;
}
.block-title {
font-size: 12 * @toVw;
color: #999;
padding: 8 * @toVw 16 * @toVw;
}
.group-buy {
.main-background {
padding: 0 20 * @toVw;
background: white no-repeat;
background-size: 100% auto;
.title-top {
color: white;
font-size: 14 * @toVw;
transform: translateX(10px);
opacity: 0;
}
.phone-block {
padding: 10 * @toVw;
text-align: center;
background: #f8f8f8;
}
.phone-input {
width: 280 * @toVw;
height: 30 * @toVw;
border-radius: 8 * @toVw;
outline: none;
padding: 0 10 * @toVw;
border: 1px solid #e8e8e8;
text-align: center;
}
.block-title {
font-size: 12 * @toVw;
color: #999;
padding: 8 * @toVw 16 * @toVw;
}
.group-buy {
.main-background {
padding: 0 20 * @toVw;
background: white no-repeat;
background-size: 100% auto;
.title-top {
color: white;
font-size: 14 * @toVw;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(255, 255, 255, 1);
line-height: 60 * @toVw;
span {
vertical-align: middle;
}
img {
width: 20 * @toVw;
vertical-align: middle;
margin-right: 5 * @toVw;
}
}
.user-message {
border-radius: 8 * @toVw;
position: relative;
background: white;
padding: 20 * @toVw 40 * @toVw;
box-shadow: 0 1 * @toVw 20 * @toVw -3 * @toVw rgba(255, 77, 84, 0.2);
margin-bottom: 10 * @toVw;
.icon-left {
width: 10 * @toVw;
position: absolute;
right: 17 * @toVw;
top: 50%;
margin-top: -8 * @toVw;
}
.add-address {
line-height: 50 * @toVw;
text-align: center;
font-size: 16 * @toVw;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(255, 255, 255, 1);
line-height: 60 * @toVw;
span {
vertical-align: middle;
}
img {
width: 20 * @toVw;
vertical-align: middle;
margin-right: 5 * @toVw;
}
color: #666666;
}
.user-message {
border-radius: 8 * @toVw;
position: relative;
background: white;
padding: 20 * @toVw 40 * @toVw;
box-shadow: 0 1 * @toVw 20 * @toVw -3 * @toVw rgba(255, 77, 84, 0.2);
margin-bottom: 10 * @toVw;
.icon-left {
width: 10 * @toVw;
position: absolute;
right: 17 * @toVw;
top: 50%;
margin-top: -8 * @toVw;
}
.add-address {
line-height: 50 * @toVw;
text-align: center;
.icon-address {
width: 12 * @toVw;
position: absolute;
top: 23 * @toVw;
left: 17 * @toVw;
}
.address-content {
.name {
font-size: 16 * @toVw;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: #666666;
}
.icon-address {
width: 12 * @toVw;
position: absolute;
top: 23 * @toVw;
left: 17 * @toVw;
}
.address-content {
.name {
font-size: 16 * @toVw;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(0, 0, 0, 1);
.mobile {
display: inline-block;
margin-left: 10 * @toVw;
font-size: 14 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(0, 0, 0, 1);
}
}
.address {
font-size: 12 * @toVw;
color: rgba(0, 0, 0, 1);
.mobile {
display: inline-block;
margin-left: 10 * @toVw;
font-size: 14 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(102, 102, 102, 1);
margin-top: 7 * @toVw;
}
}
}
}
background: #f0f0f0;
.shop-block {
background: white;
padding-top: 10 * @toVw;
.shop {
position: relative;
padding-bottom: 20 * @toVw;
&:after {
content: "";
display: block;
clear: both;
}
.img-block {
float: left;
margin-right: 20/7.5vw;
img {
width: 80 * @toVw;
color: rgba(0, 0, 0, 1);
}
}
.title {
font-size: 16 * @toVw;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(0, 0, 0, 1);
}
.content {
.address {
font-size: 12 * @toVw;
margin-top: 8 * @toVw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(102, 102, 102, 1);
margin-top: 7 * @toVw;
}
.price {
font-size: 16 * @toVw;
margin-top: 15 * @toVw;
}
}
}
background: #f0f0f0;
.shop-block {
background: white;
padding-top: 10 * @toVw;
.shop {
position: relative;
padding-bottom: 20 * @toVw;
&:after {
content: "";
display: block;
clear: both;
}
.img-block {
float: left;
margin-right: 20/7.5vw;
img {
width: 80 * @toVw;
}
}
.title {
font-size: 16 * @toVw;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: rgba(0, 0, 0, 1);
}
.content {
font-size: 12 * @toVw;
margin-top: 8 * @toVw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(102, 102, 102, 1);
}
.price {
font-size: 16 * @toVw;
margin-top: 15 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(248, 78, 78, 1);
.origina {
font-size: 12 * @toVw;
text-decoration: line-through;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(248, 78, 78, 1);
.origina {
font-size: 12 * @toVw;
text-decoration: line-through;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(153, 153, 153, 1);
}
color: rgba(153, 153, 153, 1);
}
}
}
}
.pay-list {
width: 100%;
padding-bottom: 80 * @toVw;
.pay-choice {
padding: 15 * @toVw;
font-size: 13 * @toVw;
color: #666;
box-sizing: border-box;
}
.pay
-list
{
.pay {
width: 100%;
padding-bottom: 80 * @toVw;
.pay-choice {
padding: 15 * @toVw;
font-size: 13 * @toVw;
color: #666;
li {
position: relative;
padding: 14 * @toVw 14 * @toVw;
box-sizing: border-box;
}
background: #ffffff;
border-bottom: 1px solid #DFDFDF;
img {
width: 28 * @toVw;
height: 28 * @toVw;
vertical-align: middle;
}
span {
padding-left: 7 * @toVw;
font-size: 15 * @toVw;
color: #333333;
vertical-align: middle;
}
.pay {
width: 100%;
li {
position: relative;
padding: 14 * @toVw 14 * @toVw;
box-sizing: border-box;
background: #ffffff;
border-bottom: 1px solid #DFDFDF;
.icon-re {
width: 18 * @toVw;
height: 18 * @toVw;
position: absolute;
top: 19 * @toVw;
right: 21 * @toVw;
img {
width: 28 * @toVw;
height: 28 * @toVw;
vertical-align: middle;
}
span {
padding-left: 7 * @toVw;
font-size: 15 * @toVw;
color: #333333;
vertical-align: middle;
}
.icon-re {
width: 18 * @toVw;
height: 18 * @toVw;
position: absolute;
top: 19 * @toVw;
right: 21 * @toVw;
img {
width: 100%;
height: 100%;
}
}
&:last-child {
border-bottom: none;
width: 100%;
height: 100%;
}
}
&:last-child {
border-bottom: none;
}
}
}
}
}
footer {
position: fixed;
background: white;
bottom: 0;
width: 100%;
.sub-block {
padding-left: 20/7.5vw;
line-height: 60 * @toVw;
height: 60 * @toVw;
.tips-price {
font-size: 12 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(0, 0, 0, 1);
display: inline-block;
vertical-align: middle;
max-width: 125 * @toVw;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
span {
font-size: 22 * @toVw;
color: #f83534;
}
.pay-btn {
width: 300/7.5vw;
text-align: center;
float: right;
height: 60 * @toVw;
background: #f83534;
color: white;
font-size: 16 * @toVw;
footer {
position: fixed;
background: white;
bottom: 0;
width: 100%;
.sub-block {
padding-left: 20/7.5vw;
line-height: 60 * @toVw;
height: 60 * @toVw;
.tips-price {
font-size: 12 * @toVw;
font-family: PingFang-SC-Medium;
font-weight: 500;
color: rgba(0, 0, 0, 1);
display: inline-block;
vertical-align: middle;
max-width: 125 * @toVw;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
.address-pop {
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
background: white;
span {
font-size: 22 * @toVw;
color: #f83534;
}
.pay-btn {
width: 300/7.5vw;
text-align: center;
float: right;
height: 60 * @toVw;
background: #f83534;
color: white;
font-size: 16 * @toVw;
}
}
.address-pop {
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
background: white;
}
}
</
style
>
src/components/buy/guidelines.vue
deleted
100644 → 0
View file @
ae07b3e9
<
template
>
<div
class=
"guidelines"
>
<div
class=
"zhiying"
v-if=
"micromessenger == 0"
>
<img
:src=
"zhiying"
alt=
""
>
</div>
</div>
</
template
>
<
script
>
import
common
from
'../../util/common'
import
zhiying
from
"../../assets/punchTheClock/zhiying.png"
import
zhufubao
from
"../../assets/punchTheClock/zhifubaotup.png"
export
default
{
name
:
"guidelines"
,
data
()
{
return
{
micromessenger
:
0
,
// 判断在微信里还是在浏览器里
zhiying
:
zhiying
,
// 图片
zhufubao
:
zhufubao
}
},
mounted
()
{
// 0 -> 微信 1 -> 支付宝
this
.
micromessenger
=
common
.
isWeixinBrowser
()
// 到浏览器里支付宝支付
if
(
this
.
micromessenger
==
1
)
{
location
.
href
=
this
.
$route
.
query
.
pay_url
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
.guidelines {
width: 100%;
height: 100%;
padding-top: 3 * @toVw;
background: #F3F2F7;
text-align: center;
.zhiying {
width: 244 * @toVw;
height: 361 * @toVw;
margin-left: 112 * @toVw;
box-sizing: border-box;
img {
width: 100%;
height: 100%;
}
}
}
</
style
>
src/components/punchTheClock/index.vue
View file @
465e9148
...
...
@@ -11,7 +11,7 @@
<div
class=
"punch-the-clock-name-bg"
>
<div
class=
"punch-the-clock-name-content"
>
<!-- 倒计时 hasEnded 指是否在规定时间内完成学习 -->
<div
class=
"punch-the-clock-name-contentText"
v-if=
"!hasEnded
&& forthRate != 100
"
>
很遗憾,您未在指定时间内完成任务哦
</div>
<div
class=
"punch-the-clock-name-contentText"
v-if=
"!hasEnded"
>
很遗憾,您未在指定时间内完成任务哦
</div>
<div
class=
"punch-the-clock-name-content-timer"
v-if=
"hasEnded"
>
<span>
剩余完成时间
</span>
<span
class=
"timer"
>
{{
countDownDay
}}
</span>
...
...
src/main.js
View file @
465e9148
...
...
@@ -10,12 +10,10 @@ import VueClipboard from 'vue-clipboard2'
import
sa
from
'sa-sdk-javascript'
;
import
'mint-ui/lib/style.css'
import
scroll
from
"./base/scroll/scroll"
import
{
Popup
,
Lazyload
,
Button
,
Dialog
,
Toast
}
from
'vant'
;
import
{
getBillRefreshApi
,
getStatusWechatApi
,
getCourseInfoApi
}
from
'./service/api'
import
'./util/vancs.less'
import
{
Popup
,
Lazyload
,
Button
,
Dialog
,
Toast
}
from
'vant'
;
import
*
as
fundebug
from
'fundebug-javascript'
;
import
fundebugVue
from
'fundebug-vue'
;
fundebug
.
apikey
=
'4d414770c72b034dfa896048206a72258ede4e4ad5f9c6c4320d19b7f91a567e'
;
fundebugVue
(
fundebug
,
Vue
);
...
...
@@ -48,62 +46,12 @@ Vue.prototype.$sa.quick('autoTrack')
Vue
.
use
(
VueClipboard
);
Vue
.
use
(
Popup
).
use
(
Lazyload
).
use
(
Button
).
use
(
Dialog
).
use
(
Toast
);
Vue
.
component
(
'scroll'
,
scroll
);
// 支付宝支付完成,订单状态查询
let
timer
=
null
;
if
(
window
.
localStorage
.
out_trade_no
)
{
timer
=
setInterval
(()
=>
{
let
outTradEno
=
JSON
.
parse
(
window
.
localStorage
.
out_trade_no
);
getBillRefreshApi
({
outTradeNo
:
outTradEno
.
out_trade_no
}).
then
(
res
=>
{
// 支付成功
if
(
res
.
status
===
"SUCCESS"
)
{
getCourseInfoApi
().
then
(
response
=>
{
this
.
userCourse
=
JSON
.
parse
(
JSON
.
stringify
(
response
));
console
.
log
(
this
.
userCourse
)
localStorage
.
setItem
(
"userCourse"
,
JSON
.
stringify
(
this
.
userCourse
));
localStorage
.
setItem
(
"buyindex"
,
1
);
Dialog
.
confirm
({
title
:
'标题'
,
message
:
'支付成功'
,
confirmButtonText
:
'去查看'
}).
then
(()
=>
{
if
(
response
.
teacher_alias
&&
response
.
teacher_alias
.
substr
(
0
,
1
)
==
1
&&
outTradEno
.
goods_type
!=
4
&&
outTradEno
.
is_subscribe
==
1
)
{
clearInterval
(
timer
);
router
.
push
({
name
:
"guide"
,
query
:
{
shopId
:
outTradEno
.
shopId
}
});
localStorage
.
removeItem
(
'out_trade_no'
)
}
else
{
if
(
res
.
buy_type
==
1
)
{
clearInterval
(
timer
);
router
.
push
({
name
:
"buySuccess"
,
query
:
outTradEno
});
localStorage
.
removeItem
(
'out_trade_no'
)
}
else
{
clearInterval
(
timer
);
router
.
push
({
name
:
"success"
,
query
:
outTradEno
});
localStorage
.
removeItem
(
'out_trade_no'
)
}
}
}).
catch
(()
=>
{
clearInterval
(
timer
);
localStorage
.
removeItem
(
'out_trade_no'
)
});
});
}
else
if
(
res
.
status
===
"NO_SYNC"
)
{
Dialog
.
confirm
({
title
:
'标题'
,
message
:
'您有一笔未支付的订单'
,
confirmButtonText
:
'去查看'
}).
then
(()
=>
{
clearInterval
(
timer
);
location
.
href
=
`http://
${
window
.
location
.
host
}
/#/guidelines?pay_url=
${
encodeURI
(
window
.
localStorage
.
pay_url
)}
`
localStorage
.
removeItem
(
'out_trade_no'
)
}).
catch
(()
=>
{
clearInterval
(
timer
);
localStorage
.
removeItem
(
'out_trade_no'
)
});
}
})
},
6000
)
}
// 全局错误日志
const
errorHandler
=
(
error
,
vm
)
=>
{
Vue
.
prototype
.
$post
(
`api/client/report/errors/log`
,
{
'routes_url'
:
vm
.
$route
.
name
,
'result_text'
:
error
.
toString
()})
const
errorHandler
=
(
error
,
vm
)
=>
{
Vue
.
prototype
.
$post
(
`api/client/report/errors/log`
,
{
'routes_url'
:
vm
.
$route
.
name
,
'result_text'
:
error
.
toString
()})
}
Vue
.
config
.
errorHandler
=
errorHandler
;
Vue
.
prototype
.
$throw
=
(
error
)
=>
errorHandler
(
error
,
this
);
Vue
.
prototype
.
$throw
=
(
error
)
=>
errorHandler
(
error
,
this
);
Vue
.
prototype
.
$common
=
common
//VConsole关闭屏蔽代码
if
(
process
.
env
.
NODE_ENV
!=
'production'
)
{
...
...
@@ -122,16 +70,13 @@ router.beforeEach((to, from, next) => {
}
})
new
Vue
({
el
:
'#app'
,
router
,
store
,
components
:
{
App
},
components
:
{
App
},
template
:
'<App/>'
});
if
(
!
Array
.
prototype
.
find
)
{
Array
.
prototype
.
find
=
function
(
predicate
)
{
'use strict'
;
...
...
src/router/index.js
View file @
465e9148
...
...
@@ -39,6 +39,7 @@ const router = new Router({
deep
:
0
,
}
},
{
path
:
'/extensionV1Shop'
,
name
:
'extensionV1Shop'
,
...
...
@@ -570,12 +571,6 @@ const router = new Router({
name
:
'punchTheClock'
,
component
:
e
=>
require
([
'@/components/punchTheClock'
],
e
)
},
// 微信跳转支付宝
{
path
:
'/guidelines'
,
name
:
'guidelines'
,
component
:
e
=>
require
([
'@/components/buy/guidelines'
],
e
)
},
{
path
:
'*'
,
component
:
()
=>
import
(
'@/components/error'
),
...
...
@@ -604,16 +599,6 @@ router.beforeEach((to, from, next) => {
next
({
name
:
'noWechat'
,
query
:
{
url
:
encodeURIComponent
(
to
.
fullPath
)
}
});
}
}
/*let micromessenger = common.isWeixinBrowser();
if(micromessenger == 2){
alert(micromessenger);
alert(999999)
// location.href = `http://${ window.location.host }/#/guidelines`
next({ path: 'guidelines' })
return false;
}*/
// 移动端判断
store
.
dispatch
(
'isMobile'
,
browser
.
versions
.
mobile
);
// 默认title
...
...
@@ -625,9 +610,9 @@ router.beforeEach((to, from, next) => {
if
(
to
.
meta
.
title
)
{
document
.
title
=
to
.
meta
.
title
;
}
let
goOn
=
function
()
{
if
(
localStorage
.
getItem
(
'retUrl'
)
&&
localStorage
.
getItem
(
'retUrl'
)
!==
null
&&
localStorage
.
getItem
(
'retUrl'
)
!==
''
)
{
console
.
log
(
localStorage
.
getItem
(
'retUrl'
))
let
retUrl
=
localStorage
.
getItem
(
'retUrl'
).
toString
();
localStorage
.
removeItem
(
'retUrl'
);
next
(
retUrl
);
...
...
@@ -636,30 +621,22 @@ router.beforeEach((to, from, next) => {
}
};
if
(
window
.
location
.
href
.
indexOf
(
'gdt_vid'
)
>
-
1
)
{
console
.
log
(
3333333
,
common
.
getUrlParam
())
localStorage
.
setItem
(
'gdt_vid'
,
common
.
getUrlParam
().
gdt_vid
);
localStorage
.
setItem
(
'cct_user_id'
,
common
.
getUrlParam
().
cct_user_id
);
localStorage
.
setItem
(
'redeem_code'
,
common
.
getUrlParam
().
cct_user_id
);
// localStorage.setItem('redeem_code', common.getParamhref().redeem_code);
}
// 在支付宝里跳转
let
micromessenger
=
common
.
isWeixinBrowser
();
if
(
micromessenger
==
2
){
// alert("支付成功啦,请回到唱唱公众号继续操作!")
// location.href = "https://wechat-pre.changchangenglish.com/#/weixin"
location
.
href
=
"https://static-cdn.changchangenglish.com/public/images/alipay_success.png"
// location.href = "https://www.changchangenglish.com/zhifubao.html"
return
;
}
// extensionV1Shop
// extensionV1
if
(
to
.
name
===
's
tarRankV2'
||
to
.
name
===
'order'
||
to
.
name
===
'buySuccess'
||
to
.
name
===
'success'
||
to
.
name
===
'guidelines'
||
to
.
name
===
's
pcShop'
||
to
.
name
===
'mpShop'
||
to
.
name
===
'extensionV1Shop'
||
to
.
name
===
'extensionV1'
||
to
.
name
===
'author'
||
to
.
name
===
'bindMobile'
||
to
.
name
===
'noWechat'
||
to
.
name
===
'inspectorActivit'
||
to
.
name
===
'buyDetail'
||
to
.
name
===
'passShop'
||
to
.
name
===
'ybIndex'
)
{
if
(
to
.
name
===
'spcShop'
||
to
.
name
===
'mpShop'
||
to
.
name
===
'extensionV1Shop'
||
to
.
name
===
'extensionV1'
||
to
.
name
===
'author'
||
to
.
name
===
'bindMobile'
||
to
.
name
===
'noWechat'
||
to
.
name
===
'inspectorActivit'
||
to
.
name
===
'buyDetail'
||
to
.
name
===
'passShop'
||
to
.
name
===
'ybIndex'
)
{
// 无需登录的页面
console
.
log
(
899
,
to
.
name
)
console
.
log
(
488
)
next
()
}
else
if
(
window
.
location
.
href
.
indexOf
(
'token'
)
>
-
1
&&
to
.
name
===
'index'
)
{
console
.
log
(
99000
)
let
token
=
common
.
getUrlParam
().
token
||
to
.
query
.
token
;
console
.
log
(
common
.
getUrlParam
())
console
.
log
(
to
.
name
)
// debugger
store
.
dispatch
(
'setToken'
,
token
);
getUserDetailApi
().
then
(
res
=>
{
...
...
src/service/api.js
View file @
465e9148
...
...
@@ -431,8 +431,3 @@ const getNewCashUrl = `${_baseUrl}api/client/new/return/cash/`
export
const
getNewCashApi
=
function
(
element_id
,
category_id
,
periods_id
,
json
)
{
return
Vue
.
prototype
.
$fetch
(
`
${
getNewCashUrl
}${
element_id
}
/
${
category_id
}
/
${
periods_id
}
`
,
json
)
};
const
getBillRefreshUrl
=
`
${
_baseUrl
}
api/client/bill/refresh`
export
const
getBillRefreshApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$fetch
(
getBillRefreshUrl
,
json
)
};
src/util/common.js
View file @
465e9148
...
...
@@ -118,32 +118,5 @@ export default {
}
}
return
newObj
;
},
/**
* 判断是否在那个浏览器里
* @returns {number}
*/
isWeixinBrowser
()
{
var
ui
=
0
// 0 -> 微信 2 -> 支付宝 1 -> 其他
if
(
/MicroMessenger/
.
test
(
window
.
navigator
.
userAgent
))
{
ui
=
0
}
else
if
(
/AlipayClient/
.
test
(
window
.
navigator
.
userAgent
))
{
ui
=
2
}
else
{
ui
=
1
}
return
ui
;
},
/**
* 获取链接后的参数
* @param name
* @param url
* @returns {RegExpExecArray | string}
*/
getParamByName
(
name
,
url
)
{
url
=
url
||
window
.
location
;
var
match
=
RegExp
(
'[?&]'
+
name
+
'=([^&]*)'
).
exec
(
url
);
return
match
&&
decodeURIComponent
(
match
[
1
].
replace
(
/
\+
/g
,
' '
))
}
}
src/util/vancs.less
deleted
100644 → 0
View file @
ae07b3e9
.van-dialog {
border-radius: 15px;
padding-bottom: 25px;
.van-dialog__header {
opacity: 0;
}
.van-button__text {
display: inline-block;
width: 98px;
height: 44px;
color: #FFFFFF;
border-radius: 25px;
}
[class*=van-hairline]::after {
border: none
}
.van-button::before {
}
border-color: transparent;
//background-color: transparent;
.van-dialog__cancel {
.van-button__text {
background: #97A0BB;
}
}
.van-dialog__confirm {
.van-button__text {
background: #40A9FF;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment