1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066 |
- <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) > Number(recoveredBalance) ? recoveredBalance : (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,
- useRecoveredBalance: this.checkRecoveredBalance.length > 0
- }).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>
|