create-order.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. <template>
  2. <view class="container order clearfix" :style="{paddingBottom :isIphoneX ? '170rpx' : '134rpx'}">
  3. <!-- 地址选择 -->
  4. <choice-address ref="choiceAddress" v-if="isAddress" :addressData="addressData"></choice-address>
  5. <!-- 商品 -->
  6. <goods-list ref='goods' v-if="isRequest" :goodsData="goodsData" @handleGoodList="handChangeInputGoodsList"></goods-list>
  7. <!-- 发票信息 -->
  8. <invoice-tent ref="invoice"
  9. v-if="isRequest"
  10. :invoiceDatas="invoiceData"
  11. @handleChoiceaInvoice="handleChoiceaInvoiceData">
  12. </invoice-tent>
  13. <!-- 优惠券选择弹窗 -->
  14. <coupon ref="coupon"
  15. v-if="isCouponShow"
  16. :couponList="couponList"
  17. @handleChoiceaCoupon="handleChoiceaCouponData">
  18. </coupon>
  19. <!-- 兑换优惠券弹窗 -->
  20. <exchangeCoupon v-if="isExchangePopup"></exchangeCoupon>
  21. <!-- 运费 -->
  22. <freight ref="freight"
  23. v-if="isFreight"
  24. :freightData="freightData"
  25. @confirmFreight="hanldFreightFn"
  26. @confirmFreightBeans = "hanldFreightBeans"
  27. >
  28. </freight>
  29. <freight-alert v-if="isfreightTip" ref="csPhone"></freight-alert>
  30. <!-- 余额抵扣 -->
  31. <view class="invoice-balance" v-show="!rechargeGoods">
  32. <view class="balabce-t">
  33. <view class="balabce-t-le">余额抵扣</view>
  34. <view class="balabce-t-ri">
  35. <view class="money">
  36. <text>可用余额:</text>
  37. <text>¥{{userMoney | NumFormat}}</text>
  38. </view>
  39. <view class="checkbox-box">
  40. <button class="checkbox iconfont"
  41. hover-class="btn-hover"
  42. v-if="userMoney!=0"
  43. @click.stop="checkedBalabce"
  44. :class="[ischecked ?'icon-yixuanze':'icon-weixuanze']"
  45. >
  46. </button>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="balabce-b" :class="{'balabce-b--hide':!ischecked}">
  51. <view class="balabce-b-text animation" :style="{'transform':ischecked?'translateY(0)':'translateY(-50%)','-webkit-transform':ischecked?'translateY(0)':'translateY(-50%)'}">
  52. <text>当前使用:¥{{deductMoney | NumFormat}},剩余:¥{{surplusMoney | NumFormat}}</text>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 底部 -->
  57. <view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  58. <view class="footer-le">
  59. <view class="footer-count">
  60. <text>共{{ totalCount }}件商品</text>
  61. </view>
  62. <view class="footer-price">
  63. <view class="sum" :class="totalDiscountAmount == 0 ? 'none' : ''">
  64. 总价:<text class="price">¥{{ orderShouldPayFee | NumFormat }}</text>
  65. </view>
  66. <view class="sum-none" v-if="totalDiscountAmount > 0">
  67. <text class="money-reduced">共减<text>¥{{ totalDiscountAmount | NumFormat}}</text></text>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="footer-submit" @click.stop="orderSubmitMit">
  72. <view class="btn" :class="isSubLoading ? 'disabled' : ''" >提交订单</view>
  73. </view>
  74. </view>
  75. <!-- 优惠券 -->
  76. <view class="coupon-content-model" v-if="isCouponModel">
  77. <view class="coupon-alert-content">
  78. <view class="coupon">
  79. <view class="coupon-list">
  80. <view class="list-cell-tags">{{ ExchangeCouponData.couponType | TypeFormat }}</text></view>
  81. <view class="list-cell-le">
  82. <view class="coupon-maxMoney">
  83. <text class="small">¥</text>
  84. {{ ExchangeCouponData.couponAmount }}
  85. </view>
  86. <view class="coupon-minMoney">
  87. <text class="txt">满{{ ExchangeCouponData.touchPrice }}可用</text>
  88. </view>
  89. </view>
  90. <view class="list-cell-ri">
  91. <view class="list-cell-top">
  92. <text v-if="ExchangeCouponData.couponType == 0">
  93. {{ ExchangeCouponData.productType && ExchangeCouponData.productType == 1 ? '全商城商品通用' : '仅可购买指定商品' }}
  94. </text>
  95. <text v-if="ExchangeCouponData.couponType == 1">
  96. {{ ExchangeCouponData.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
  97. </text>
  98. <text v-if="ExchangeCouponData.couponType == 3">仅限购买店铺【{{ ExchangeCouponData.shopName }}】的商品</text>
  99. <text v-if="ExchangeCouponData.couponType == 4 || ExchangeCouponData.couponType == 2">全商城商品通用</text>
  100. </view>
  101. <view class="list-cell-time">{{ ExchangeCouponData.startDate }} - {{ ExchangeCouponData.endDate }}</view>
  102. </view>
  103. </view>
  104. <view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import choiceAddress from '@/components/cm-module/creatOrder/choiceAddress'
  112. import goodsList from '@/components/cm-module/creatOrder/goodsList'
  113. import invoiceTent from '@/components/cm-module/creatOrder/invoiceTent'
  114. import coupon from '@/components/cm-module/creatOrder/coupon'
  115. import exchangeCoupon from '@/components/cm-module/creatOrder/exchangeCoupon'
  116. import freight from '@/components/cm-module/creatOrder/freight'
  117. import freightAlert from '@/components/cm-module/modelAlert/freightAlert'
  118. const defaultProductParam = {
  119. productCount:0, // 商品数量
  120. productId:0, // 商品Id
  121. source:2, // 来源:1WWW 2小程序
  122. userId:0 // 用户Id
  123. };
  124. const defaultCartParam = {
  125. productIds:0, // 商品Id(逗号隔开)
  126. source:2, // 来源:1WWW 2小程序
  127. userId:0 // 用户Id
  128. };
  129. const defaultPostageParam = {
  130. productIds:0, // 商品Id(逗号隔开)
  131. userId:0, // 用户Id
  132. townId:0 // 地区Id
  133. };
  134. const defaultConfirmParam = {
  135. cartType:1, // 购买类型:(1自主下单, 3协销下单)
  136. orderSource:6, // 订单来源 1WWW 6小程序[采美,星范]
  137. addressId:0, // 收货地址Id
  138. clubCouponId:0, // 关联优惠券Id
  139. clubId:0, // 机构Id
  140. orderInfo:[], // 订单商品数据
  141. orderInvoice:{type:0}, // 订单发票信息
  142. payInfo:{ // 订单金额数据
  143. orderShouldPayFee: 0, // 订单最终支付金额
  144. balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
  145. clauseId:0, // 条款Id
  146. postage: 0, // 运费金额
  147. postageFlag: 0, // 运费类型
  148. userBeans: 0, // 抵扣采美豆数量
  149. rebateFlag:0 // 是否返佣订单
  150. },
  151. unionId:uni.getStorageSync('unionId'),// 用户unionId
  152. };
  153. export default {
  154. components:{
  155. choiceAddress,
  156. goodsList,
  157. invoiceTent,
  158. coupon,
  159. exchangeCoupon,
  160. freight,
  161. freightAlert
  162. },
  163. data() {
  164. return {
  165. isIphoneX:this.$store.state.isIphoneX,
  166. isSubLoading:false,
  167. confirmType:1,
  168. orderID:0,
  169. cartParam: Object.assign({}, defaultCartParam), // 购物车立即结算确认订单参数
  170. productParam: Object.assign({}, defaultProductParam), // 商品立即购买确认订单参数
  171. postageParam: Object.assign({}, defaultPostageParam), // 邮费计算参数
  172. confirmParam: Object.assign({}, defaultConfirmParam), // 提交订单参数
  173. productIds:'', // 获取上一级页面商品信息
  174. submitState:'', // 提交状态
  175. totalCount:1, // 订单提交总数量
  176. reducedPrice:0, // 满减金额
  177. couponAmount:0, // 优惠券金额
  178. totalDiscountAmount:0, // 共减金额
  179. allPrice:0.00, // 订单总金额
  180. orderShouldPayFee:0, // 订单最终支付金额
  181. surplusMoney:0.00, // 显示勾选后的剩余抵扣
  182. userMoney:0.00, // 显示可使用余额
  183. deductMoney:0.00, // 显示已使用的余额
  184. isRequest:false, // 是否加载完成渲染子组件
  185. isFreight:false, // 是否加载完成渲染子组件
  186. isAddress:false, // 是否加载完成地址
  187. isExchangePopup:false, // 控制兑换优惠券弹窗
  188. isfreightTip:false, // 控制邮费弹窗
  189. ischecked:false, // 是否勾选余额
  190. hanldFreePostFlag:'', // 邮费状态
  191. hanldFreight:'', // 邮费
  192. addressData:{}, // 初始化地址信息
  193. goodsData:[], // 初始化商品信息
  194. couponList:[], // 初始化优惠券信息
  195. invoiceData:{type:0}, // 初始化发票信息
  196. freightData:{}, // 邮费数据
  197. orderInfo:[], // 提交的商品信息
  198. rechargeGoods:null, // 判断订单里有定金商品或者充值商品时,余额抵扣部分不显示
  199. freightBeansMoney:0, // 存储采美豆抵扣金额
  200. isCouponShow:false, // 是否显示可选优惠券
  201. isCheckedBeans:false, // 是否抵扣采美豆
  202. isCouponModel:false, // 兑换优惠券成功提示
  203. ExchangeCouponData:{} // 兑换优惠券信息
  204. }
  205. },
  206. onLoad(option){//商品数据
  207. let data = JSON.parse(option.data);
  208. console.log('infodata',data)
  209. this.$api.getStorage().then((resolve) =>{
  210. this.productParam.userId = this.cartParam.userId = this.postageParam.userId = resolve.userId ? resolve.userId : 0
  211. this.confirmParam.clubId = resolve.clubId ? resolve.clubId : 0
  212. if(option.type =='prodcut'){
  213. this.confirmType = 1
  214. this.productParam.productCount = data.data.productCount
  215. this.productParam.productId = data.data.productIds
  216. this.productIds = this.postageParam.productIds = data.data.productIds
  217. this.GetProductCreateOrderInfo()
  218. }else{
  219. this.confirmType = 2
  220. this.productIds = this.cartParam.productIds = this.postageParam.productIds = data.data.productIds
  221. this.CartCreateOrderInfo()
  222. }
  223. })
  224. },
  225. filters:{
  226. NumFormat(value) {//处理金额
  227. return Number(value).toFixed(2)
  228. },
  229. },
  230. methods: {
  231. GetProductCreateOrderInfo(){// 商品立即购买确认订单数据初始化
  232. this.OrderService.ProductCreateOrderInfo(this.productParam).then(response =>{
  233. let data = response.data
  234. this.isRequest = true
  235. this.goodsData = data.list
  236. this.couponList = data.couponList
  237. this.userMoney = data.userMoney
  238. this.reducedPrice = data.reducedPrice
  239. this.totalCount = data.totalCount
  240. this.allPrice = data.totalPrice
  241. this.rechargeGoods = data.rechargeGoods
  242. if(this.couponList.length>0){
  243. this.isCouponShow = true
  244. this.couponAmount = data.couponList[0].couponAmount
  245. this.confirmParam.clubCouponId = data.couponList[0].clubCouponId
  246. }
  247. this.orderShouldPayFee = this.allPrice - this.couponAmount
  248. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  249. })
  250. .catch(error =>{
  251. this.$util.msg(error.msg,2000)
  252. })
  253. },
  254. CartCreateOrderInfo(){// 购物车去结算确认订单数据初始化
  255. this.OrderService.CartCreateOrderInfo(this.cartParam).then(response =>{
  256. let data = response.data
  257. this.isRequest = true
  258. this.goodsData = data.list
  259. this.couponList = data.couponList
  260. this.userMoney = data.userMoney
  261. this.reducedPrice = data.reducedPrice
  262. this.totalCount = data.totalCount
  263. this.allPrice = data.totalPrice
  264. this.rechargeGoods = data.rechargeGoods
  265. if(this.couponList.length>0){
  266. this.isCouponShow = true
  267. this.couponAmount = data.couponList[0].couponAmount
  268. this.confirmParam.clubCouponId = data.couponList[0].clubCouponId
  269. }
  270. this.orderShouldPayFee = this.allPrice - this.couponAmount
  271. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  272. })
  273. .catch(error =>{
  274. this.$util.msg(error.msg,2000)
  275. })
  276. },
  277. getFreightData(){// 获取邮费信息
  278. this.isFreight = false
  279. this.OrderService.GetOrderPostage(this.postageParam).then(response =>{
  280. const data = response.data
  281. this.isFreight = true
  282. this.isCheckedBeans = false
  283. this.freightData = data
  284. this.hanldFreePostFlag = data.postageFlag
  285. this.hanldFreight = data.postage
  286. if(this.hanldFreePostFlag == 1){
  287. if( this.freightData.userBeans > 0 ){
  288. this.freightBeansMoney = this.hanldFreight
  289. }else{
  290. this.freightBeansMoney = 0
  291. }
  292. this.orderShouldPayFee = this.allPrice + data.postage
  293. this.attributePallPrice()
  294. this.hanldFreightBeans(this.isCheckedBeans)
  295. }else{
  296. if( this.freightData.userBeans > 0 ){
  297. this.freightBeansMoney = 30
  298. }else{
  299. this.freightBeansMoney = 0
  300. }
  301. this.orderShouldPayFee = this.allPrice
  302. this.attributePallPrice()
  303. this.hanldFreightBeans(this.isCheckedBeans)
  304. }
  305. })
  306. },
  307. getAddressData(){//获取地址信息
  308. this.$api.getStorage().then((resolve) => {
  309. this.UserService.QueryAddressList({pageNum:1,pageSize:1,userId:resolve.userId}).then(response =>{
  310. let data = response.data
  311. this.isAddress = true
  312. this.addressData = {}
  313. if( data.list && data.list.length > 0 ){
  314. this.confirmParam.addressId = data.list[0].addressId;
  315. this.postageParam.townId = data.list[0].townId;
  316. this.addressData = data.list[0];
  317. this.getFreightData()
  318. }else{
  319. this.addressData = this.addressData
  320. }
  321. })
  322. })
  323. },
  324. handChangeInputGoodsList(data){//对应供应商的留言信息
  325. this.goodsData = data
  326. },
  327. handleChoiceaInvoiceData(data){//获取发票信息
  328. this.confirmParam.orderInvoice = data
  329. },
  330. hanldFreightFn(data){//显示邮费弹窗
  331. console.log('邮费信息',data)
  332. switch(data.postageFlag){
  333. case 1:
  334. this.hanldFreight = this.freightData.postage
  335. this.hanldFreePostFlag = data.postageFlag
  336. this.freightBeansMoney = data.freightBeansMoney
  337. this.orderShouldPayFee =this.allPrice + this.hanldFreight
  338. this.attributePallPrice()
  339. this.hanldFreightBeans(this.isCheckedBeans)
  340. break
  341. case -1:
  342. this.hanldFreight = 0
  343. this.hanldFreePostFlag = data.postageFlag
  344. this.freightBeansMoney = data.freightBeansMoney
  345. this.orderShouldPayFee = this.allPrice
  346. this.attributePallPrice()
  347. this.hanldFreightBeans(this.isCheckedBeans)
  348. break
  349. }
  350. },
  351. hanldFreightBeans(data){//是否勾选采美豆抵扣
  352. this.isCheckedBeans = data
  353. if(this.isCheckedBeans){
  354. // 判断如果采美豆大于等于运费*100
  355. if( this.freightData.userBeans > 0 ){
  356. this.confirmParam.payInfo.userBeans = this.freightBeansMoney*100
  357. }else{
  358. this.confirmParam.payInfo.userBeans = 0
  359. }
  360. // 计算抵扣后的总价
  361. if(this.hanldFreePostFlag == 1){
  362. // 如果使用了余额 最终价格
  363. if(this.ischecked){
  364. let totalAmount = this.allPrice - this.couponAmount
  365. if(this.userMoney >= totalAmount){
  366. this.orderShouldPayFee = 0.00
  367. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  368. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额-当前使用金额
  369. }else{
  370. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额-账户余额
  371. this.deductMoney = this.userMoney // 当前使用金额等于总余额
  372. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  373. }
  374. }else{
  375. this.orderShouldPayFee = this.allPrice + this.hanldFreight - this.freightBeansMoney - this.couponAmount
  376. }
  377. console.log('抵扣',this.orderShouldPayFee)
  378. }
  379. }else{// 采美豆不抵扣运费
  380. this.confirmParam.payInfo.userBeans = 0
  381. // 不抵扣时计算总价
  382. if(this.hanldFreePostFlag == 1){
  383. this.attributeHashfreight(this.hanldFreight)
  384. }
  385. }
  386. },
  387. handleChoiceaCouponData(data){// 勾选使用优惠券
  388. console.log('优惠券信息',data)
  389. this.couponAmount = data.couponAmount
  390. this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
  391. this.confirmParam.clubCouponId = data.clubCouponId
  392. this.attributePallPrice()
  393. this.hanldFreightBeans(this.isCheckedBeans)
  394. },
  395. checkedBalabce(){//勾选使用余额
  396. if(this.userMoney > 0){
  397. this.ischecked = !this.ischecked
  398. if(this.ischecked){
  399. this.confirmParam.payInfo.balancePayFlag = 1
  400. this.attributePallPrice()
  401. }else{
  402. if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){ //如果是有运费时
  403. if(this.isCheckedBeans){
  404. this.orderShouldPayFee = this.allPrice - this.couponAmount
  405. }else{
  406. this.orderShouldPayFee = this.allPrice+parseInt(this.freightData.postage) - this.couponAmount
  407. }
  408. }else{
  409. this.orderShouldPayFee = this.allPrice - this.couponAmount
  410. }
  411. this.confirmParam.payInfo.balancePayFlag = 0
  412. }
  413. console.log('最终订单支付金额',this.orderShouldPayFee)
  414. console.log('优惠券金额',this.couponAmount)
  415. }else{
  416. return
  417. }
  418. },
  419. attributePallPrice(){// 计算价格
  420. if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){
  421. this.attributeHashfreight(this.freightData.postage)
  422. }else{
  423. this.attributeNofreight()
  424. }
  425. },
  426. attributeNofreight(){// 计算没有邮费的支付价格
  427. if(this.ischecked){
  428. let totalAmount = this.allPrice - this.couponAmount
  429. if(this.userMoney >= totalAmount){
  430. this.orderShouldPayFee = 0.00
  431. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  432. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额-当前使用金额
  433. }else{
  434. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额-账户余额
  435. this.deductMoney = this.userMoney // 当前使用金额等于总余额
  436. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  437. }
  438. }else{
  439. this.orderShouldPayFee = this.allPrice - this.couponAmount;
  440. this.deductMoney = 0.00; // 当前使用
  441. this.surplusMoney = this.userMoney; // 剩余余额
  442. }
  443. console.log('最终订单支付金额',this.orderShouldPayFee)
  444. console.log('优惠券金额',this.couponAmount)
  445. },
  446. attributeHashfreight(postage){// 计算需要邮费的支付价格
  447. console.log()
  448. let totalAmount = this.allPrice + parseInt(postage) - this.couponAmount//计算不包邮的价格 总价等于商品价格+邮费
  449. if(this.ischecked){
  450. if(this.userMoney >= totalAmount){// 全部抵扣
  451. this.orderShouldPayFee =0.00
  452. if(this.isCheckedBeans){// 抵扣运费了
  453. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  454. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额减去当前使用金额
  455. }else{
  456. this.deductMoney = this.allPrice + parseInt(postage)- this.couponAmount // 当前使用金额等于订单金额+运费金额
  457. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  458. }
  459. }else{// 部分抵扣
  460. if(this.isCheckedBeans){// 抵扣运费了
  461. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于总订单金额-账户余额-优惠券金额
  462. this.deductMoney = this.userMoney // 当前使用金额等于账户余额
  463. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于账户余额-当前使用金额
  464. }else{
  465. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.userMoney - this.couponAmount//订单支付金额等于订单金额+运费-账户余额-优惠券
  466. this.deductMoney = this.userMoney // 当前使用金额等于账户余额
  467. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于账户余额-当前使用金额
  468. }
  469. }
  470. }else{
  471. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.couponAmount
  472. this.deductMoney = 0.00 // 当前使用金额
  473. this.surplusMoney = this.userMoney // 剩余余额
  474. }
  475. console.log('最终订单支付金额',this.orderShouldPayFee)
  476. console.log('优惠券金额',this.couponAmount)
  477. },
  478. orderSubmitMit(){// 提交订单
  479. if(this.isSubLoading){ return; }
  480. if(this.confirmParam.addressId == ''){
  481. this.$util.msg('请先添加收货地址~',2000)
  482. return
  483. }
  484. this.confirmParam.orderInfo = this.goodsData.map(el => {
  485. let productInfo = [];
  486. el.cartList.forEach(item => {
  487. productInfo.push({
  488. productId:item.productId,
  489. productNum:item.number,
  490. presentNum:0,
  491. productType:item.productType
  492. })
  493. })
  494. return {shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
  495. })
  496. this.confirmParam.payInfo.postage = parseInt(this.hanldFreight).toFixed(2)
  497. this.confirmParam.payInfo.postageFlag = parseInt(this.hanldFreePostFlag)
  498. this.confirmParam.payInfo.orderShouldPayFee = this.orderShouldPayFee.toFixed(2)
  499. this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo)
  500. this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo)
  501. this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice)
  502. console.log(this.confirmParam)
  503. this.isSubLoading = true;
  504. this.OrderService.CreatedOrderSubmit(this.confirmParam).then(response =>{
  505. let data = response.data;
  506. // 友盟埋点收集机构自主提交订单
  507. if(process.env.NODE_ENV != 'development'){
  508. this.$uma.trackEvent('Um_Event_ConfirmOrder', {
  509. Um_Key_PageName: '机构提交订单',
  510. Um_Key_SourcePage: '确认订单',
  511. Um_Key_OrderID:`${data.orderId}`
  512. })
  513. }
  514. console.log('机构提交订单机构提交订单机构提交订单机构提交订单')
  515. if(data.code === 1){
  516. this.submitState ='success'
  517. setTimeout(()=>{
  518. this.isSubLoading = false
  519. },2000)
  520. this.$api.navigateTo(`/pages/user/order/success?data=${JSON.stringify({data:{orderId:data.orderId}})}`)
  521. }else{
  522. this.submitState ='confirm'
  523. this.$util.msg('订单提交成功',3000,true,'success')
  524. setTimeout(()=>{
  525. this.isSubLoading = false
  526. },2000)
  527. setTimeout(()=>{
  528. this.$api.redirectTo(`/pages/user/order/order-payment?type=${this.submitState}&orderId=${data.orderId}`)
  529. },3000)
  530. }
  531. }).catch(error =>{
  532. this.$util.msg(error.msg,3000)
  533. })
  534. },
  535. handFreightAlertShow(){//显示邮费弹窗
  536. this.isfreightTip = true
  537. },
  538. handleClickCancel(){// 关闭优惠券弹窗
  539. this.isCouponModel = false;
  540. if(this.confirmType == 1){
  541. this.GetProductCreateOrderInfo()
  542. }else{
  543. this.CartCreateOrderInfo();
  544. }
  545. },
  546. hideFreight(){//关闭邮费弹窗
  547. this.isfreightTip = false
  548. },
  549. },
  550. onShow() {
  551. let pages = getCurrentPages();
  552. let currPage = pages[pages.length-1];
  553. if(currPage.data.select =='select'){
  554. this.isAddress = true
  555. let SelectData = uni.getStorageSync('selectAddress');
  556. this.confirmParam.addressId = SelectData.addressId;
  557. this.postageParam.townId = SelectData.townId
  558. this.addressData = SelectData
  559. this.getFreightData()
  560. }else{
  561. this.getAddressData()
  562. }
  563. }
  564. }
  565. </script>
  566. <style lang="scss">
  567. page {
  568. height: auto;
  569. background:#F7F7F7;
  570. }
  571. .btn-hover{
  572. background: #FFFFFF;
  573. }
  574. .animation{
  575. /* transition: transform 0.3s ease;*/
  576. transition-property: transform;
  577. transition-duration: 0.3s;
  578. transition-timing-function: ease;
  579. }
  580. .order{
  581. padding-bottom: 134rpx;
  582. }
  583. .invoice-freight{
  584. width: 702rpx;
  585. padding: 0 24rpx;
  586. height: auto;
  587. font-size: $font-size-28;
  588. color: $text-color;
  589. background: #FFFFFF;
  590. float: left;
  591. font-weight: bold;
  592. }
  593. .invoice-balance{
  594. width: 702rpx;
  595. height: auto;
  596. padding:0 24rpx;
  597. background: #FFFFFF;
  598. float: left;
  599. margin-top: 24rpx;
  600. margin-bottom: 24rpx;
  601. .balabce-t{
  602. width: 100%;
  603. height: 86rpx;
  604. line-height: 86rpx;
  605. font-size: $font-size-28;
  606. color: $text-color;
  607. float: left;
  608. .balabce-t-le{
  609. float: left;
  610. font-weight: bold;
  611. }
  612. .balabce-t-ri{
  613. float: right;
  614. display: flex;
  615. align-items: center;
  616. .money{
  617. display: flex;
  618. float: left;
  619. }
  620. .checkbox-box{
  621. display: flex;
  622. width: 60rpx;
  623. float: left;
  624. height: 100%;
  625. font-size: $font-size-24;
  626. .checkbox{
  627. width: 40rpx;
  628. text-align: right;
  629. box-sizing: border-box;
  630. text-align: center;
  631. text-decoration: none;
  632. border-radius: 0;
  633. -webkit-tap-highlight-color: transparent;
  634. overflow: hidden;
  635. color: $color-system;
  636. }
  637. }
  638. }
  639. }
  640. .balabce-b{
  641. width: 100%;
  642. float: left;
  643. overflow: hidden;
  644. .balabce-b-text{
  645. width: 100%;
  646. line-height: 58rpx;
  647. font-size: $font-size-24;
  648. color: #FF2A2A;
  649. text-align: right;
  650. float: right;
  651. }
  652. &.balabce-b--hide {
  653. padding: 0 0;
  654. height: 0px;
  655. line-height: 0px;
  656. }
  657. }
  658. }
  659. .footer{
  660. position: fixed;
  661. left: 0;
  662. bottom: 0;
  663. display: flex;
  664. align-items: center;
  665. width: 100%;
  666. height: 110rpx;
  667. line-height: 110rpx;
  668. justify-content: space-between;
  669. font-size: $font-size-28;
  670. background-color: #FFFFFF;
  671. z-index: 990;
  672. color: $text-color;
  673. .footer-le{
  674. width:570rpx;
  675. height:100%;
  676. float: left;
  677. }
  678. .footer-count{
  679. float: left;
  680. padding-left: 24rpx;
  681. width:180rpx;
  682. box-sizing: border-box;
  683. }
  684. .footer-price{
  685. width:370rpx;
  686. float: right;
  687. text-align: right;
  688. color: $text-color;
  689. padding: 10rpx 20rpx 10rpx 0;
  690. box-sizing: border-box;
  691. .sum-none{
  692. width: 100%;
  693. height: 45rpx;
  694. line-height: 45rpx;
  695. color: $text-color;
  696. float: left;
  697. text-align: right;
  698. .money{
  699. font-size: $font-size-26;
  700. color: #999999;
  701. text-decoration: line-through;
  702. }
  703. .money-sign{
  704. font-size: $font-size-26;
  705. color: #999999;
  706. text-decoration: line-through;
  707. }
  708. .money-reduced{
  709. margin-left: 10rpx;
  710. font-size: $font-size-26;
  711. color:#FF2A2A;
  712. }
  713. }
  714. .sum{
  715. width: 100%;
  716. height: 45rpx;
  717. line-height: 45rpx;
  718. float: left;
  719. &.none{
  720. height: 90rpx;
  721. line-height: 90rpx;
  722. }
  723. .price{
  724. font-size: $font-size-32;
  725. color: #FF2A2A;
  726. }
  727. }
  728. }
  729. .footer-submit{
  730. display:flex;
  731. align-items:center;
  732. justify-content: center;
  733. width: 180rpx;
  734. height: 100%;
  735. box-sizing: border-box;
  736. padding: 15rpx 5rpx;
  737. .btn{
  738. width: 100%;
  739. height: 100%;
  740. color: #FFFFFF;
  741. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  742. font-size: $font-size-26;
  743. text-align: center;
  744. line-height: 80rpx;
  745. border-radius: 40rpx;
  746. &.disabled{
  747. background: #e4e8eb;
  748. color: #999999;
  749. }
  750. }
  751. }
  752. }
  753. .coupon-content-model{
  754. width: 100%;
  755. height: 100%;
  756. background: rgba(0,0,0,.5);
  757. position: fixed;
  758. top: 0;
  759. left: 0;
  760. z-index: 8888;
  761. transition: all 0.4s;
  762. .coupon-alert-content{
  763. width: 600rpx;
  764. height: 612rpx;
  765. position: absolute;
  766. top: 0;
  767. left: 0;
  768. bottom: 0;
  769. right: 0;
  770. margin: auto;
  771. box-sizing: border-box;
  772. padding-top: 92rpx;
  773. .coupon{
  774. width: 600rpx;
  775. height: 522rpx;
  776. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  777. background-size: cover;
  778. box-sizing: border-box;
  779. padding: 230rpx 40rpx 0 40rpx;
  780. .coupon-list{
  781. width: 100%;
  782. height: 147rpx;
  783. margin-bottom: 32rpx;
  784. box-sizing: border-box;
  785. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  786. background-size: cover;
  787. position: relative;
  788. .list-cell-tags{
  789. display: inline-block;
  790. padding: 0 10rpx;
  791. height: 32rpx;
  792. line-height: 32rpx;
  793. background-color: #f94b4b;
  794. color: #FFFFFF;
  795. font-size: 18rpx;
  796. border-radius: 16rpx 0 16rpx 0;
  797. text-align: center;
  798. position: absolute;
  799. top: 0;
  800. left: 0;
  801. }
  802. .list-cell-le{
  803. width: 154rpx;
  804. height: 100%;
  805. box-sizing: border-box;
  806. padding: 30rpx 0;
  807. float: left;
  808. .coupon-maxMoney{
  809. width: 100%;
  810. height: 54rpx;
  811. line-height: 54rpx;
  812. font-size: 42rpx;
  813. color: #f94b4b;
  814. text-align: center;
  815. margin-top: 10rpx;
  816. .small{
  817. font-size: $font-size-20;
  818. }
  819. }
  820. .coupon-minMoney{
  821. width: 100%;
  822. height: 28rpx;
  823. float: left;
  824. box-sizing: border-box;
  825. padding-left: 24rpx;
  826. .txt{
  827. display: block;
  828. height: 28rpx;
  829. line-height: 28rpx;
  830. font-size: 16rpx;
  831. color: #f94b4b;
  832. text-align: center;
  833. padding: 0 5rpx;
  834. background-color: #fff1eb;
  835. border-radius: 4rpx;
  836. float: left;
  837. }
  838. }
  839. }
  840. .list-cell-ri{
  841. width: 366rpx;
  842. height: 100%;
  843. box-sizing: border-box;
  844. padding:30rpx 20rpx;
  845. float: left;
  846. .list-cell-top{
  847. width: 100%;
  848. height: 64rpx;
  849. line-height: 64rpx;
  850. font-size: $font-size-26;
  851. color: #333333;
  852. float: left;
  853. text-overflow:ellipsis;
  854. display: -webkit-box;
  855. word-break: break-all;
  856. -webkit-box-orient: vertical;
  857. -webkit-line-clamp: 1;
  858. overflow: hidden;
  859. }
  860. .list-cell-time{
  861. width: 100%;
  862. height: 28rpx;
  863. line-height: 28rpx;
  864. text-align: left;
  865. font-size: $font-size-20;
  866. color: #999999;
  867. }
  868. }
  869. }
  870. .coupon-btn{
  871. width: 100%;
  872. height: 78rpx;
  873. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  874. background-size: cover;
  875. line-height: 78rpx;
  876. text-align: center;
  877. color: #FFFFFF;
  878. font-size: $font-size-36;
  879. }
  880. }
  881. }
  882. }
  883. </style>