123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- <template>
- <view class="content">
- <view class="top">
- 爱心捐赠
- </view>
- <view class="box">
- <view class="box-item">
- <view class="box-left">
- 捐款意向
- </view>
- <view class="box-right">
-
- <picker :value="index" @change="PickerDire" :range="chooseDire" class="box-right" @click="addType">
- <text>{{ intention || '请选择捐款意向'}}</text>
- </picker>
- </view>
- </view>
- <view class="box-item">
- <view class="box-left">
- 捐款方式
- </view>
- <view class="box-right">
-
- <picker @change="PickerType" :value="index" :range="chooseType" class="box-right">
- <text>{{ way || '请选择捐款方式'}}</text>
- </picker>
- </view>
- </view>
- <view class="box-item">
- <view class="box-left">
- 捐款金额
- </view>
- <view class="box-right">
- <input type="text" placeholder="单位(元)" v-model="money"/>
- </view>
- </view>
- </view>
- <view class="switch-box">
- <view class="switch-left">
- 是否实名公开
- </view>
- <view class="switch-right">
- <switch :checked="is_public" color='#E63931' style="transform: scale(0.7,0.7)" @change="switch1Change"/>
- </view>
- </view>
-
- <view class="switch-box">
- <view class="switch-left">
- 寄发票
- </view>
- <view class="switch-right">
- <switch :checked="is_receiptsL" color='#E63931' style="transform: scale(0.7,0.7)" @change="switch2Change"/>
- </view>
- </view>
- <view class="infoOptional">
- 信息(选填)
- </view>
- <view class="box">
- <view class="box-item">
- <view class="box-left">
- 捐款人/单位
- </view>
- <view class="box-right">
- <input type="text" placeholder="请选择捐款人/单位" v-model="donate_er"/>
- </view>
- </view>
- <view class="box-item">
- <view class="box-left">
- 手机号
- </view>
- <view class="box-right">
- <input type="text" placeholder="请填写手机号" v-model="mobile"/>
- </view>
- </view>
- <view class="box-item">
- <view class="box-left">
- 联系地址
- </view>
- <view class="box-right">
- <input type="text" placeholder="请输入联系地址(用于寄发票)" v-model="address"/>
- </view>
- </view>
- </view>
- <view class="submit" @click="!payLoding ? confirm() : ''">
- 提交
- </view>
-
- </view>
- </template>
- <script>
- import {
- chosintention,
- joinDona
- } from '@/api/ask.js';
- import { computedOrderkey, balance, createOrderkey, orderPay } from '@/api/money.js';
- export default{
- data(){
- return{
- index: 0,
- intention:'',
- way:'',
- money:'',
- is_public: false,
- is_receiptsL: false,
- donate_er: '',
- mobile: '',
- address:'',
-
- chooseDire:[],
- chooseType:['个人','单位'],
- payLoding: false,
- froms: '',
- type: '',
- }
- },
- onLoad(options) {
- console.log(333,options)
- },
- methods:{
-
- addType(e){
- chosintention({}).then(({ data })=>{
- console.log(data)
- this.chooseDire = data.map(item => item.title)
- }).catch()
- },
-
- PickerDire:function(e) {
- console.log(334,this.chooseDire)
- this.intention = this.chooseDire[e.target.value];
- this.index = e.target.value + 1;
- },
-
- PickerType:function(e) {
- this.way = this.chooseType[e.target.value];
- this.index = e.target.value + 1;
- },
-
- switch1Change(e){
- this.is_public = e.detail.value
- console.log(this.is_public )
- },
-
- switch2Change(e){
- this.is_receiptsL = e.detail.value
- console.log(this.is_receiptsL )
- },
-
-
- confirm: async function() {
- let obj = this;
-
- obj.payLoding = true;
-
-
- obj.froms = uni.getStorageSync('weichatBrowser') || '';
-
-
- if (obj.type != 1) {
-
- obj.firstCreateOrder();
- } else {
-
- obj.orderMoneyPay();
- }
- },
-
-
- firstCreateOrder() {
- let obj = this;
-
- let prepage = obj.$api.prePage();
- let data = {
- use_integral_pink: obj.use_integral_pink,
- real_name: prepage.addressData.real_name,
- phone: prepage.addressData.phone,
- couponId: prepage.couponChecked.id,
- addressId: prepage.addressData.id,
- useIntegral: prepage.checkedPoints ? 1 : 0,
- useShopping_card: prepage.shoppingPoints ? 1 : 0,
- payType: obj.payName,
- mark: prepage.idcardName+prepage.idcardNum,
-
- from: obj.froms ? 'weixin' : 'H5',
-
-
- from: 'routine',
-
-
- from: 'app',
-
- shipping_type: 1,
- };
-
- if (obj.typegoods == 6) {
- data.level = obj.level;
- }else{
- data.pinkId = obj.pinkid;
- }
-
- createOrderkey(data, obj.orderKey)
- .then(({ data, status, msg }) => {
-
- obj.orderId = data.result.orderId;
-
-
- obj.payLoding = false;
- if (data.status == 'ORDER_EXIST') {
- obj.$api.msg(msg);
- return;
- }
-
- if (obj.payName == 'yue') {
- if (status == 200&&data.status == 'SUCCESS') {
- obj.paySuccessTo();
- } else {
- alert(msg);
- obj.$api.msg(msg)
- }
- } else {
-
- obj.orderMoneyPay();
- }
- })
- .catch(e => {
- alert(e.message);
- console.log(e);
- });
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- }
- </script>
- <style lang="scss">
- .content{
-
- }
- .top{
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #E63931;
- color: #FFFFFF;
- padding: 22rpx 0;
- }
- .box{
- .box-item{
- background-color: #FFFFFF;
- padding: 24rpx;
- display: flex;
- border-bottom: 1rpx solid #F2F2F2;
- }
- .box-left{
- width: 200rpx;
- flex-shrink: 0;
- // flex: 0;
- }
- .box-right{
- width: 100%;
- color: #999999;
- }
- }
- .switch-box{
- margin-top: 24rpx;
- display: flex;
- align-items: center;
- padding: 16rpx 24rpx;
- color: #7b7b7b;
- background-color: #FFFFFF;
- border-bottom: 1rpx solid #F2F2F2;
- justify-content: space-between;
- .switch-right{
- // background-color: #E63931;
- }
- }
- .infoOptional{
- padding: 20rpx 24rpx;
- }
- .submit{
- background-color: #E63931;
- color: #FFFFFF;
- padding: 20rpx 0;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 12rpx;
- margin: 32rpx;
- }
-
- </style>
|