|
|
@@ -26,7 +26,7 @@
|
|
|
<view class="txt_left_pay"><image src="/static/wepay.png" class="pay_icon"></image>微信支付</view>
|
|
|
<view ><u-radio @change="radioChange" name="wepay"></u-radio></view>
|
|
|
</view>
|
|
|
- <view class="list_item">
|
|
|
+ <view class="list_item" v-if="false">
|
|
|
<view class="txt_left_pay"><image src="/static/unipay.png" class="pay_icon"></image>云闪付</view>
|
|
|
<view ><u-radio @change="radioChange" name="unipay"></u-radio></view>
|
|
|
</view>
|
|
|
@@ -35,7 +35,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="bottomBtn" @click="pay()">确认支付</view>
|
|
|
+ <button class="bottomBtn" @click="pay()" >确认支付</button>
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
@@ -59,22 +59,98 @@ export default {
|
|
|
],
|
|
|
array:['全部','建设工程施工管理','机电全科','机电工程管理与实','机电全科','全科'],
|
|
|
current:0,
|
|
|
- menuIndex:0
|
|
|
+ menuIndex:0,
|
|
|
+ value:'wepay'
|
|
|
};
|
|
|
},
|
|
|
onPullDownRefresh(){
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
-
|
|
|
+ let self = this
|
|
|
+ console.log(self.shoppingCartList,6)
|
|
|
+ let list = self.shoppingCartList
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
onShow() {
|
|
|
- /* if(this.current === 2 && this.$method.isLogin()){
|
|
|
- this.$refs.refMy.init();
|
|
|
- } */
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
+ postOrder(){
|
|
|
+ let self = this
|
|
|
+ let list = self.shoppingCartList
|
|
|
+ for(let i=0;i<list.length;i++){
|
|
|
+ let item = list[i];
|
|
|
+ if(item.goodsType==1){
|
|
|
+ if(item.templateType=='class'){
|
|
|
+ delete item.gradObj.goodsList
|
|
|
+ let goodsInputData = {
|
|
|
+ type:'class',
|
|
|
+ gradeId:item.gradObj.gradeId,
|
|
|
+ gradeJson:JSON.stringify(item.gradObj)
|
|
|
+ }
|
|
|
+ item.goodsInputData = goodsInputData
|
|
|
+ }
|
|
|
+ if(item.templateType=='apply'){
|
|
|
+ let goodsInputData = {
|
|
|
+ type:'apply',
|
|
|
+ applyAreasJson:JSON.stringify(item.applyAreas),
|
|
|
+ examDateJson:JSON.stringify(item.examDate)
|
|
|
+ }
|
|
|
+ item.goodsInputData = goodsInputData
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let data = {goodsList:list}
|
|
|
+ this.$api.placeSmallOrder(data).then(res => {
|
|
|
+ if(res.data.code==200){
|
|
|
+ let data = res.data.data
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: data.provider,
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
+ package: data.package,
|
|
|
+ signType: data.signType,
|
|
|
+ paySign: data.sign,
|
|
|
+ timeStamp: String(data.timeStamp),
|
|
|
+ success: function (res) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages2/order/confirm_success?sn='+data.orderSn
|
|
|
+ });
|
|
|
+ console.log('success:' + JSON.stringify(res));
|
|
|
+ },
|
|
|
+ fail: function (err) {
|
|
|
+ console.log('fail:' + JSON.stringify(err));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: res.data.msg,
|
|
|
+ showCancel: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getOpenid(code){
|
|
|
+ let self = this
|
|
|
+ this.$api.wxOpenid({code:code}).then(res => {
|
|
|
+ if(res.data.code==200){
|
|
|
+ self.postOrder()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
pay(){
|
|
|
- this.$navTo.togo('/pages2/order/confirm_success');
|
|
|
+ let self = this
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: function(loginRes) {
|
|
|
+ console.log(loginRes,69)
|
|
|
+ self.getOpenid(loginRes.code)
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //
|
|
|
},
|
|
|
radioChange(e) {
|
|
|
// console.log(e);
|