123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065 |
- <template>
- <view v-if="checkStatus == '通过'">
- <view style="width: 100%;height: 155rpx;background: #FFFFFF;display: flex;align-items: center;" v-if="!editDel"
- @click="clickAddress">
- <view>
- <view style="font-size: 28rpx;color: #3B3B3B;font-weight: 400;display: flex;align-items: center;">
- <image src="/static/images/tabBar/1061@2x.png"
- style="width: 25rpx;height: 30rpx;margin-left: 34rpx;margin-right: 2rpx;" mode="scaleToFill">
- <text>{{addres.contacts}}</text>
- <text style="margin-left: 35rpx;">{{addres.tel}}</text>
- </image>
- </view>
- <view style="font-size: 26rpx;color:#989898;font-weight: 400;margin-top: 22rpx;margin-left: 61rpx;">
- <text>{{addres.belongtoarea + addres.detailedAddress}}</text>
- </view>
- </view>
- </view>
- <scroll-view scroll-y="true" style="max-height: 68vh;">
- <u-checkbox-group v-model="companyValue" placement="column" @change="companyChange" :size='15'>
- <view class="card" v-for="(item,index) in dataList" :key="index">
- <view style="margin-left: 50rpx;">
- <u-checkbox activeColor="#E75F37" shape="circle" :customStyle="{marginBottom: '8px'}"
- :label="item.name" :name="item.name" labelSize="28rpx" labelColor='#3B3B3B'></u-checkbox>
- </view>
- <view style="background: #FCF7F5;padding: 30rpx 30rpx;">
- <view style="margin:15rpx 0 15rpx 20rpx;display: flex;align-items: center;"
- v-for="(ite,ind) in item.list" :key="ind">
- <view>
- <image v-for="(li,inde) in ite.filesList" :key="inde" v-if="li.version === '0'"
- :src="li.url" style="width: 200rpx;height: 200rpx;border-radius: 20rpx;">
- </image>
- </view>
- <view style="width: 100%;margin-left: 8rpx ;">
- <view style="display: flex;justify-content: space-between;">
- <u--text :text="ite.goodsName" size="24rpx" color='#797979' lines="2"></u--text>
- <u-icon name="trash" size="40rpx" color='#C9C9C9'
- @click="deleteGoods(ite.id)"></u-icon>
- </view>
- <view style="display: flex;justify-content: space-between;margin-top: 20rpx;">
- <view style="color: #E75F37;font-size: 32rpx;">¥{{ite.price}}</view>
- <view v-if="!editDel">
- <u-number-box v-model="ite.goodsNum" :min="1" buttonSize="53rpx" color="#414141"
- bgColor="#FCF7F5" iconStyle="color:#A4A4A4"
- @change="(val)=>{statistics(val,index,ind)}"></u-number-box>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </u-checkbox-group>
- </scroll-view>
- <view class="submitBar">
- <view style="margin:20rpx 47rpx;">
- <!-- 第一行:余额支付 -->
- <view v-if="!editDel" class="balance-row">
- <u-checkbox-group v-model="checkRecoveredBalance" placement="row" :size='15' @change="checkRecovered">
- <u-checkbox label="使用余额支付" name="余额支付" activeColor="#E75F37" shape="circle" :disabled="!recoveredBalance || recoveredBalance <= 0"
- labelSize="24rpx" labelColor='#3B3B3B'></u-checkbox>
- </u-checkbox-group>
- <view class="balance-info">
- <view style="font-size: 24rpx;color: #A3A3A3">可用余额: <text style="color: #E75F37;">¥{{recoveredBalance}}</text></view>
- <view v-if="checkRecoveredBalance.length > 0" style="font-size: 24rpx;color: #E75F37;margin-top: 5rpx;">
- 最多抵扣{{(totalPrice / 2).toFixed(2)}}元
- </view>
- </view>
- </view>
- <!-- 第二行:全选和合计 -->
- <view v-if="!editDel" class="top-row">
- <view class="select-all">
- <u-checkbox-group v-model="radiovalue" placement="column" @change="radioGroupChange" :size='15'>
- <u-checkbox label="全选" name="全选" activeColor="#E75F37" shape="circle"
- labelSize="28rpx" labelColor='#3B3B3B'></u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="total-price">
- <text style="font-size: 24rpx;">合计:</text>
- <text style="color: #E75F37;">¥</text>
- <text style="font-size: 42rpx;color: #E75F37;">{{totalPrice}}</text>
- </view>
- </view>
- <!-- 分隔线 -->
- <view style="height: 2rpx;width: 100%;background: #EEEEEE;"></view>
- <!-- 第三行:运费和支付按钮 -->
- <view style="display: flex;justify-content:space-between;align-items: center;padding: 28rpx 0 28rpx 28rpx;">
- <view v-if="!editDel" style="font-size: 24rpx;">
- <view style="color:#A3A3A3">运费:<text style="color: #E75F37;">¥{{totalFreight}}</text></view>
- </view>
- <view style="display: flex;">
- <view class="left-btn" v-if="!editDel" @click="submit('W01')">他人代付</view>
- <view class="right-btn" v-if="!editDel" @click="submit()">立即支付</view>
- </view>
- </view>
- <!-- 分隔线 -->
- <view style="height: 2rpx;width: 100%;background: #EEEEEE;"></view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- shoppingCartList,
- generateOrder,
- generateOrderLimit,
- shoppingCartUpdate,
- getCorpsAddr,
- paramserviceDetail,
- getParamservice,
- isProcurement,
- generateOrderShare
- } from '@/api/tabBar/shoppingCart.js'
- import {
- details
- } from '@/api/views/personalInformation/index.js'
- import {
- appDetail
- } from '@/api/views/salesSlip/index.js'
- import {
- activityList
- } from '@/api/tabBar/activity.js'
- export default {
- data() {
- return {
- qrcodeshow: false, // 二维码弹窗
- qrcodeData: [], // 二维码数据
- qrcodeurl: '', // 二维码参数
- editDel: false,
- radiovalue: [],
- companyValue: [],
- dataList: [],
- companyValueLength: 0,
- selectedProduct: [],
- totalPrice: 0.00,
- totalFreight: 0.00,
- addres: {},
- checkStatus: null,
- adminShow: false,
- inventoryShow: false,
- inventoryContent: '',
- freight: 5,
- recoveredBalance: 0,
- checkRecoveredBalance: []
- }
- },
- watch: {
- companyValue() {
- if (this.companyValue.length != 0 || this.companyValueLength != 0) {
- if (this.companyValue.length == this.companyValueLength) {
- this.radiovalue = ["全选"]
- } else {
- this.radiovalue = []
- }
- }
- this.statistics()
- },
- getUserInfo(){
- details().then(res => {
- this.recoveredBalance = res.data.recoveredBalance
- })
- }
- },
- onShow() {
- this.getUpdate()
- activityList({
- current: 1,
- size: 10,
- status: 1
- }).then(res => {
- uni.setTabBarBadge({
- index: 1, // tabIndex,tabBar的哪一项,从0开始
- text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
- })
- })
- if (uni.getStorageSync('userInfo').tenant_id == '000000') {
- this.adminShow = true
- return
- }
- // 获取审核状态
- details().then(res => {
- this.checkStatus = res.data.checkStatus
- this.recoveredBalance = res.data.recoveredBalance
- uni.setStorageSync('checkStatus', res.data.checkStatus);
- console.log(1111111)
- if (this.checkStatus != '通过') {
- uni.showToast({
- title: "当前用户未授权,请联系客服",
- icon: "none",
- mask: true
- });
- // uni.switchTab({
- // url:'/pages/tabBar/home'
- // })
- // return
- }
- })
- this.editDel = false
- this.companyValue = []
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength = this.dataList.length
- if (res.data.length) {
- this.companyChange([res.data[0].name])
- }
- this.inventoryfun(res.data)
- let num = 0
- res.data.forEach(e => {
- console.log(e.list)
- num = num + e.list.length
- })
- uni.setTabBarBadge({
- index: 3, // tabIndex,tabBar的哪一项,从0开始
- text: num.toString() // 显示的文本,超过 99 显示成 “…”
- })
- uni.hideLoading();
- }).catch(err => {
- uni.hideLoading();
- })
- getCorpsAddr().then(res => {
- this.addres = res.data
- })
- // 支付成功之后的回调
- let options = wx.getEnterOptionsSync();
- if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3') {
- // 代表从收银台小程序返回
- let extraData = options.referrerInfo.extraData;
- if (!extraData) {
- // "当前通过物理按键返回,未接收到返参,建议自行查询交易结果";
- console.log('当前通过物理按键返回,未接收到返参,建议自行查询交易结果');
- } else {
- if (extraData.code == 'success') {
- // "支付成功";
- } else if (extraData.code == 'cancel') {
- // "支付已取消";
- console.log(extraData, '支付已取消');
- } else {
- console.log(extraData, '失败');
- // "支付失败:" + extraData.errmsg;
- }
- }
- }
- isProcurement({
- "param": "freight"
- }).then(res => {
- // res.data.data === '1'
- this.freight = res.data
- })
- },
- methods: {
- getUpdate() {
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function(res) {
- // 请求完新版本信息的回调
- if (res.hasUpdate) {
- updateManager.onUpdateReady(function() {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success: function(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }
- }
- });
- });
- updateManager.onUpdateFailed(function() {
- // 新的版本下载失败
- uni.showModal({
- title: '已经有新版本了哟~',
- content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
- });
- });
- }
- });
- },
- // 库存弹窗
- inventoryfun(arr) {
- let sum = ''
- arr.map((item, index) => {
- item.list.map(ite => {
- if (Number(ite.goodsNum) > Number(ite.inventory)) {
- console.log(ite)
- sum += `${ite.goodsName} 的库存数量为${ite.inventory}<br>`
- }
- return ite
- })
- return item
- })
- if (sum != '') {
- this.inventoryContent = sum + '请修正数量后重新结算'
- this.inventoryShow = true
- return true
- }
- return false
- },
- // admin确认
- adminConfirm() {
- uni.clearStorageSync();
- uni.redirectTo({
- url: '/pages/login/login'
- })
- },
- // admin取消
- adminCancel() {
- uni.switchTab({
- url: '/pages/tabBar/home'
- })
- },
- // 弹窗关闭
- qrcodeclose() {
- this.qrcodeshow = false
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // 详情调用
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength = this.dataList.length
- uni.hideLoading();
- }).catch(err => {
- uni.hideLoading();
- })
- },
- clickAddress() {
- this.$u.route('/pages/views/personalInformation/addressManagement');
- },
- getList() {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength = this.dataList.length
- if (res.data.length) {
- this.companyChange([res.data[0].name])
- }
- let num = 0
- res.data.forEach(e => {
- num = num + e.list.length
- })
- uni.setTabBarBadge({
- index: 3, // tabIndex,tabBar的哪一项,从0开始
- text: num.toString() // 显示的文本,超过 99 显示成 “…”
- })
- uni.hideLoading();
- }).catch(err => {
- uni.hideLoading();
- })
- },
- deleteGoods(val) {
- let _this = this
- uni.showModal({
- title: '提示',
- content: '是否删除?',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- shoppingCartUpdate({
- ids: val
- }).then(res => {
- uni.showToast({
- title: "删除成功",
- icon: 'none'
- });
- _this.getList()
- // this.editDel = false
- _this.companyValue = []
- }).catch(err => {
- uni.hideLoading();
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- deleteShopping() {
- if (this.selectedProduct.length == 0) {
- uni.showToast({
- title: "请先选择要支付的商品",
- icon: 'none'
- });
- return
- }
- let data = []
- for (let item of this.companyValue) {
- for (let ite of this.dataList) {
- if (item == ite.name) {
- for (let it of ite.list) {
- data.push(it.id)
- }
- }
- }
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- shoppingCartUpdate({
- ids: data.join(',')
- }).then(res => {
- uni.showToast({
- title: "删除成功",
- icon: 'none'
- });
- this.editDel = false
- this.companyValue = []
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength = this.dataList.length
- uni.hideLoading();
- }).catch(err => {
- uni.hideLoading();
- })
- }).catch(err => {
- uni.hideLoading();
- })
- },
- // 立即支付
- submit() {
- if (this.selectedProduct.length == 0) {
- uni.showToast({
- title: "请先选择要支付的商品",
- icon: 'none'
- });
- return
- }
- if (this.inventoryfun(this.dataList)) {
- return
- }
- isProcurement({
- "param": "whether.open.share"
- }).then(res => {
- if (res.data == 1) {
- //共享支付流程
- this.sharedPayment()
- } else {
- //正常支付流程
- this.normalPayment()
- }
- })
- },
- //原来支付流程
- async normalPayment() {
- if (this.companyValue.length > 0) {
- let data = []
- for (let item of this.companyValue) {
- let ite = this.dataList.find(e => e.name === item)
- if (ite) {
- data.push({
- name: item,
- list: ite.list
- })
- }
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // 判断是否用额度支付
- const personRef = await details()
- let latest = Number(personRef.data.recoveredBalance)
- let realRecoveredBalanceAmount = 0.0
- let useRecoveredBalance = false
- if (this.checkRecoveredBalance.length > 0) {
- let half = Number(this.totalPrice) / 2
- realRecoveredBalanceAmount = latest > half ? half : latest
- useRecoveredBalance = true
- }
- const totalPrice = Number(this.totalPrice) + Number(this.totalFreight) - Number(realRecoveredBalanceAmount)
- // 是否开通额度
- getParamservice(1, 10, {
- paramKey: 'WeChat.shipping.notification'
- }).then(res => {
- console.log(res)
- if (res.data.records.length > 0) {
- let payType = res.data.records[0].paramValue == 1 ? 'W11' : 'W06'
- if (personRef.data.ifLimitAmount == 1) {
- // 额度是否够用
- if (Number(personRef.data.limitAmount >= totalPrice)) {
- // 额度
- // this.payType='W06'
- generateOrderLimit({
- payType: res.data.records[0].paramValue == 1 ? 'W11' : 'W06',
- address: this.addres.belongtoarea + this.addres
- .detailedAddress,
- list: data,
- }).then(res => {
- uni.hideLoading();
- uni.showToast({
- title: '支付成功',
- mask: true,
- duration: 2000
- });
- setTimeout(function() {
- uni.hideLoading({
- noConflict: true
- });
- }, 1000);
- // 详情调用
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength = this.dataList.length
- }).catch(err => {})
- })
- return
- }
- }
- // 正常支付
- generateOrder({
- payType: res.data.records[0].paramValue == 1 ? 'W11' : 'W06',
- address: this.addres.belongtoarea + this.addres.detailedAddress,
- list: data,
- }).then(res => {
- let generateOrderData = res.data
- paramserviceDetail({
- paramKey: 'cashier.payment'
- }).then(res => {
- let paramservice = res.data
- // paramservice.paramValue=0
- // 判断是调支付台的接口还是微信支付的接口
- if (paramservice && paramservice.paramValue == '1') {
- console.log(222211111111);
- // uni.hideLoading();
- // uni.requestPayment({
- // provider: "wxpay",
- // appId: generateOrderData.appId,
- // timeStamp: generateOrderData.timeStamp,
- // nonceStr: generateOrderData.nonceStr,
- // package: generateOrderData.package,
- // signType: generateOrderData.signType,
- // paySign: generateOrderData.paySign,
- // success(res) {
- // uni.showToast({
- // title: '支付成功',
- // mask: true,
- // duration: 2000
- // });
- // setTimeout(function() {
- // uni.hideLoading();
- // // this_.refresh(res.data.data.id)
- // }, 1000);
- // },
- // fail(e) {
- // console.log(e,11111111);
- // uni.showToast({
- // title: "支付失败",
- // icon: 'none',
- // mask: true
- // });
- // setTimeout(function() {
- // uni.hideLoading();
- // // this_.refresh(res.data.id)
- // }, 1000);
- // }
- // })
- let obj = {
- appId: 'wxef277996acc166c3',
- extraData: {
- cusid: generateOrderData.cusid,
- appid: generateOrderData.appid,
- orgid: generateOrderData.orgid,
- version: generateOrderData.version,
- trxamt: generateOrderData.trxamt,
- reqsn: generateOrderData.reqsn,
- notify_url: generateOrderData.notify_url,
- body: generateOrderData.body,
- remark: generateOrderData.remark,
- validtime: generateOrderData.validtime,
- limit_pay: generateOrderData.limit_pay,
- randomstr: generateOrderData.randomstr,
- paytype: generateOrderData.paytype,
- signtype: generateOrderData.signtype,
- sign: generateOrderData.sign,
- },
- }
- console.log(obj);
- if (!generateOrderData.reqsn) {
- uni.showToast({
- title: '当前订单号为空,请联系供应商!!!',
- icon: 'none',
- mask: true,
- duration: 2000
- });
- // 详情调用
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength = this.dataList
- .length
- }).catch(err => {})
- return
- }
- wx.openEmbeddedMiniProgram({
- appId: 'wxef277996acc166c3',
- extraData: {
- cusid: generateOrderData.cusid,
- appid: generateOrderData.appid,
- orgid: generateOrderData.orgid,
- version: generateOrderData.version,
- trxamt: generateOrderData.trxamt,
- reqsn: generateOrderData.reqsn,
- notify_url: generateOrderData
- .notify_url,
- body: generateOrderData.body,
- remark: generateOrderData.remark,
- validtime: generateOrderData.validtime,
- // limit_pay: generateOrderData.limit_pay,
- limit_pay: "",
- randomstr: generateOrderData.randomstr,
- paytype: generateOrderData.paytype,
- signtype: generateOrderData.signtype,
- sign: generateOrderData.sign,
- },
- success: (a) => {
- uni.hideLoading();
- },
- fail: (err) => {
- uni.hideLoading();
- }
- })
- } else {
- console.log(2222222222222222);
- if (payType && (payType == 'W01' || payType == 'U01' ||
- payType == 'A01' || payType == 'S01'
- )) {
- console.log(generateOrderData, 321);
- // 订单详情接口
- this.qrcodeurl = generateOrderData.url
- appDetail({
- id: generateOrderData.id
- }).then(res => {
- uni.hideLoading();
- this.qrcodeshow = true
- this.qrcodeData = res.data
- console.log(res.data);
- })
- } else {
- uni.requestPayment({
- provider: "wxpay",
- appId: generateOrderData.appId,
- timeStamp: generateOrderData.timeStamp,
- nonceStr: generateOrderData.nonceStr,
- package: generateOrderData.package,
- signType: generateOrderData.signType,
- paySign: generateOrderData.paySign,
- success(res) {
- uni.showToast({
- title: '支付成功',
- mask: true,
- duration: 2000
- });
- setTimeout(function() {
- uni.hideLoading({
- noConflict: true
- });
- // this_.refresh(res.data.data.id)
- }, 1000);
- },
- fail(e) {
- console.log(22222222);
- uni.showToast({
- title: "支付失败",
- icon: 'none',
- mask: true
- });
- setTimeout(function() {
- uni.hideLoading({
- noConflict: true
- });
- // this_.refresh(res.data.id)
- }, 1000);
- }
- })
- }
- }
- })
- }).catch(err => {
- uni.hideLoading();
- })
- }
- })
- }
- },
- sharedPayment() {
- if (this.companyValue.length > 0) {
- let data = []
- for (let item of this.companyValue) {
- let ite = this.dataList.find(e => e.name === item)
- if (ite) {
- data = data.concat(ite.list)
- }
- }
- let obj = {
- address: this.addres.belongtoarea + this.addres.detailedAddress,
- shoppingCartList: data,
- useRecoveredBalance: this.checkRecoveredBalance.length > 0
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- generateOrderShare(obj).then(res => {
- // res.data.type=0
- let generateOrderData = res.data
- //小程序支付
- if (res.data.type == '0') {
- uni.requestPayment({
- provider: "wxpay",
- appId: generateOrderData.appId,
- timeStamp: generateOrderData.timeStamp,
- nonceStr: generateOrderData.nonceStr,
- package: generateOrderData.package,
- signType: generateOrderData.signType,
- paySign: generateOrderData.paySign,
- success(res) {
- uni.showToast({
- title: '支付成功',
- mask: true,
- duration: 2000
- });
- setTimeout(function() {
- uni.hideLoading({
- noConflict: true
- });
- // this_.refresh(res.data.data.id)
- }, 1000);
- },
- fail(e) {
- console.log(22222222);
- uni.showToast({
- title: "支付失败",
- icon: 'none',
- mask: true
- });
- setTimeout(function() {
- uni.hideLoading({
- noConflict: true
- });
- // this_.refresh(res.data.id)
- }, 1000);
- }
- })
- }
- //收银台支付 'w06'
- if (res.data.type == '1') {
- wx.openEmbeddedMiniProgram({
- appId: 'wxef277996acc166c3',
- extraData: {
- cusid: generateOrderData.cusid,
- appid: generateOrderData.appid,
- orgid: generateOrderData.orgid,
- version: generateOrderData.version,
- trxamt: generateOrderData.trxamt,
- reqsn: generateOrderData.reqsn,
- notify_url: generateOrderData.notify_url,
- body: generateOrderData.body,
- remark: generateOrderData.remark,
- validtime: generateOrderData.validtime,
- // limit_pay: generateOrderData.limit_pay,
- limit_pay: "",
- randomstr: generateOrderData.randomstr,
- paytype: generateOrderData.paytype,
- signtype: generateOrderData.signtype,
- sign: generateOrderData.sign,
- },
- success: (a) => {
- uni.hideLoading();
- },
- fail: (err) => {
- uni.hideLoading();
- }
- })
- }
- //额度支付
- if (res.data.type == '2') {
- details().then(res => {
- const personRef = res
- const totalPrice = Number(this.totalPrice) + Number(this.totalFreight)
- // 是否开通额度
- isProcurement({
- "param": "WeChat.shipping.notification"
- }).then(res => {
- if (personRef.data.ifLimitAmount == 1) {
- // 额度是否够用
- if (Number(personRef.data.limitAmount >= totalPrice)) {
- // 额度
- // this.payType='W06'
- generateOrderLimit({
- payType: res.data == 1 ? 'W11' : 'W06',
- address: this.addres.belongtoarea +
- this.addres
- .detailedAddress,
- list: data,
- }).then(res => {
- uni.hideLoading();
- uni.showToast({
- title: '支付成功',
- mask: true,
- duration: 2000
- });
- setTimeout(function() {
- uni.hideLoading({
- noConflict: true
- });
- }, 1000);
- // 详情调用
- shoppingCartList({
- whetherIntegral: '0'
- }).then(res => {
- this.dataList = res.data
- this.companyValueLength =
- this.dataList.length
- }).catch(err => {})
- })
- }
- }
- })
- })
- }
- })
- }
- },
- radioGroupChange(e) {
- this.radiovalue = e
- if (e.length == 0) {
- this.companyValue = []
- } else {
- for (let li of this.dataList) {
- if (!this.companyValue.includes(li.name)) {
- this.companyValue.push(li.name)
- }
- }
- }
- this.inventoryfun(this.dataList)
- this.statistics()
- },
- checkRecovered(e){
- console.info('e---------', e)
- this.checkRecoveredBalance = e
- },
- statistics(val, index, ind) {
- console.log(val, index, ind)
- if (val) {
- this.dataList[index].list[ind].goodsNum = val.value
- }
- let data = []
- // for (let item of this.companyValue) {
- // for (let ite of this.dataList) {
- // if (item == ite.name) {
- // for (let it of ite.list) {
- // data.push(it)
- // }
- // }
- // }
- // }、
- for (let item of this.companyValue) {
- for (let ite of this.dataList) {
- if (item == ite.name) {
- data.push({
- name: item,
- list: ite.list
- })
- }
- }
- }
- this.totalPrice = 0
- this.totalFreight = 0
- let num = 0
- for (let item of data) {
- let num1 = 0
- for (let items of item.list) {
- this.totalPrice += Number(items.price) * Number(items.goodsNum)
- num += Number(items.goodsNum)
- num1 += Number(items.goodsNum)
- }
- if (num1 == 1) {
- this.totalFreight += this.freight ? Number(this.freight) : 5
- this.totalPrice = Number(this.totalPrice) + Number(this.totalFreight)
- }
- }
- /* if(num>1){
- this.totalFreight = 0
- } */
- this.totalFreight = this.totalFreight.toFixed(2)
- this.totalPrice = this.totalPrice.toFixed(2)
- this.selectedProduct = data
- },
- companyChange(n) {
- this.companyValue = n
- this.inventoryfun(this.dataList)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .card {
- background: #FFFFFF;
- padding: 32rpx;
- margin: 20rpx 0;
- ::v-deep .u-checkbox__icon-wrap {
- border-color: #E75F37 !important;
- }
- ::v-deep .u-number-box {
- border: 2rpx #E1E1E1 solid;
- border-radius: 8rpx;
- }
- ::v-deep .u-number-box__minus {
- border-right: 2rpx #E1E1E1 solid;
- }
- ::v-deep .u-number-box__plus {
- border-left: 2rpx #E1E1E1 solid;
- }
- }
- .submitBar {
- position: fixed;
- bottom: 0;
- background-color: #fff;
- width: 100%;
- z-index: 10;
- .balance-row {
- display: flex;
- justify-content: space-between;
- align-items: flex-start; /* 改为flex-start使内容顶部对齐 */
- padding: 15rpx 0 20rpx 0;
- .balance-info {
- text-align: right;
- display: flex;
- flex-direction: column;
- }
- }
- .top-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10rpx 0;
- .select-all {
- flex: 1;
- }
- .total-price {
- flex: 1;
- text-align: right;
- }
- }
- .left-btn {
- background-color: #FFEEE9;
- color: #E75F37;
- font-size: 26rpx;
- width: 160rpx;
- height: 65rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-top-left-radius: 33rpx;
- border-bottom-left-radius: 33rpx;
- }
- .right-btn {
- background-color: #E75F37;
- color: #fff;
- font-size: 26rpx;
- width: 160rpx;
- height: 65rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-top-right-radius: 33rpx;
- border-bottom-right-radius: 33rpx;
- }
- }
- /* .submitBar {
- position: fixed;
- bottom: 0;
- background-color: #fff;
- width: 100%;
- z-index: 10;
- ::v-deep .u-checkbox__icon-wrap {
- border-color: #E75F37 !important;
- }
- .left-btn {
- background-color: #FFEEE9;
- color: #E75F37;
- font-size: 26rpx;
- width: 160rpx;
- height: 65rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-top-left-radius: 33rpx;
- border-bottom-left-radius: 33rpx;
- }
- .right-btn {
- background-color: #E75F37;
- color: #fff;
- font-size: 26rpx;
- width: 160rpx;
- height: 65rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-top-right-radius: 33rpx;
- border-bottom-right-radius: 33rpx;
- }
- }*/
- </style>
|