confirmCompanyOrder.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 产品列表 -->
  5. <view class="goods-list">
  6. <view v-for="(item,index) in carts" :key="index" class="item" @click="showDetail(item)">
  7. <view class="img-box">
  8. <image :src="item.productImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-box">
  11. <view>
  12. <view class="name-box ellipsis2">
  13. <!-- <view class="tag">{{utils.getDictLabelName("storeProductType",item.productType)}}</view> -->
  14. {{item.productName}}
  15. </view>
  16. <view class="spec ellipsis2">{{item.productAttrName}}</view>
  17. </view>
  18. <view class="price-num">
  19. <view class="price">
  20. <text class="unit">¥</text>
  21. <text class="num">{{item.price.toFixed(2)}}</text>
  22. </view>
  23. <view class="num">x{{item.cartNum}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 小计 -->
  28. <view class="sub-total">
  29. <text class="label">合计金额:</text>
  30. <view class="price">
  31. <text class="unit">¥</text>
  32. <text class="num">{{price.payPrice.toFixed(2)}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 底部按钮 -->
  38. <view class="btn-foot">
  39. <view class="right">
  40. <view class="total" >
  41. <text class="label">总金额:</text>
  42. <view class="price">
  43. <text class="unit">¥</text>
  44. <text class="num">{{price.totalPrice.toFixed(2)}}</text>
  45. </view>
  46. </view>
  47. <view class="btn" @click="openUpdateMoney()" >
  48. 实收金额
  49. </view>
  50. <view class="btn" >
  51. 分享
  52. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  53. </view>
  54. </view>
  55. </view>
  56. <modal v-if="inputShow" title="实收金额" confirm-text="保存" cancel-text="取消" @cancel="cancelUpdateMoney" @confirm="confirmUpdateMoney">
  57. <input type="text" v-model="inputTxt" placeholder="请输入实收金额" class="intxt" maxlength="8" />
  58. <!-- <input type="text" v-model="payAmount" placeholder="请输入货到付款金额" class="intxt pay_type" maxlength="8" /> -->
  59. </modal>
  60. </view>
  61. </template>
  62. <script>
  63. import {getSalesOrder,addUserCart,updateSalseOrderMoney} from '@/api/companyOrder.js'
  64. export default {
  65. data() {
  66. return {
  67. inputShow:false,
  68. inputTxt:null,
  69. orderKey:null,
  70. price:{
  71. payPrice:0.00,
  72. totalPrice:0.00,
  73. },
  74. carts:[],
  75. isAgreement:false,
  76. payAmount:null
  77. }
  78. },
  79. onLoad(option) {
  80. this.orderKey=option.orderKey;
  81. this.getSalesOrder();
  82. },
  83. //发送给朋友
  84. onShareAppMessage(res) {
  85. return {
  86. title: "百域承品-您的专属解决方案",
  87. path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey,
  88. imageUrl: '/static/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  89. }
  90. },
  91. //分享到朋友圈
  92. onShareTimeline(res) {
  93. return {
  94. title:"百域承品-您的专属解决方案",
  95. query:'orderKey='+this.orderKey,
  96. imageUrl: '/static/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  97. }
  98. },
  99. methods: {
  100. handleAgreement(){
  101. this.isAgreement=!this.isAgreement
  102. },
  103. openUpdateMoney(){
  104. console.log(1)
  105. this.inputShow = true
  106. },
  107. cancelUpdateMoney(){
  108. this.inputShow = false
  109. },
  110. confirmUpdateMoney(){
  111. console.log(parseFloat(this.inputTxt) )
  112. console.log(parseFloat(this.payAmount) )
  113. if(parseFloat(this.inputTxt)>0||parseFloat(this.payAmount)>0){
  114. var that=this;
  115. if(this.inputTxt==0){
  116. this.inputTxt=this.price.totalPrice.toFixed(2)
  117. }
  118. // ,payAmount:this.payAmount
  119. var data={createOrderKey:this.orderKey,token:uni.getStorageSync('CompanyUserToken'),money:this.inputTxt}
  120. updateSalseOrderMoney(data).then(
  121. res => {
  122. if(res.code==200){
  123. this.inputShow = false
  124. this.getSalesOrder();
  125. }else{
  126. uni.showToast({
  127. icon:'none',
  128. title: res.msg,
  129. });
  130. }
  131. },
  132. rej => {}
  133. );
  134. }
  135. else{
  136. uni.showToast({
  137. icon:'none',
  138. title: "必须其中一个金额大于0",
  139. });
  140. }
  141. },
  142. showDetail(item) {
  143. uni.navigateTo({
  144. url: 'productDetails?productId='+item.productId
  145. })
  146. },
  147. getSalesOrder(){
  148. var that=this;
  149. that.price.payPrice=0;
  150. that.price.totalPrice=0;
  151. var data={createOrderKey:this.orderKey}
  152. getSalesOrder(data).then(
  153. res => {
  154. if(res.code==200){
  155. this.carts=res.carts;
  156. this.carts.forEach(function(element) {
  157. that.price.payPrice+=element.price*element.cartNum;
  158. });
  159. that.price.totalPrice=res.totalMoney
  160. }else{
  161. uni.showToast({
  162. icon:'none',
  163. title: res.msg,
  164. });
  165. }
  166. },
  167. rej => {}
  168. );
  169. },
  170. }
  171. }
  172. </script>
  173. <style lang="scss">
  174. .pay_type{
  175. margin-top: 20rpx;
  176. }
  177. .inner-box{
  178. padding: 20upx 20upx 140upx;
  179. .goods-list{
  180. margin-top: 20upx;
  181. padding: 0 30upx;
  182. background-color: #FFFFFF;
  183. border-radius: 16upx;
  184. .item{
  185. padding: 30upx 0;
  186. border-bottom: 1px solid #EDEEEF;
  187. display: flex;
  188. align-items: center;
  189. .img-box{
  190. width: 160upx;
  191. height: 160upx;
  192. margin-right: 30upx;
  193. image{
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. .info-box{
  199. width: calc(100% - 190upx);
  200. height: 160upx;
  201. display: flex;
  202. flex-direction: column;
  203. justify-content: space-between;
  204. .name-box{
  205. font-size: 28upx;
  206. font-family: PingFang SC;
  207. font-weight: 500;
  208. color: #111111;
  209. line-height: 40upx;
  210. .tag{
  211. display: inline-block;
  212. padding: 0 6upx;
  213. height: 30upx;
  214. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  215. border-radius: 4upx;
  216. margin-right: 10upx;
  217. font-size: 22upx;
  218. font-family: PingFang SC;
  219. font-weight: bold;
  220. color: #FFFFFF;
  221. line-height: 30upx;
  222. float: left;
  223. margin-top: 7upx;
  224. }
  225. }
  226. .spec{
  227. margin-top: 10upx;
  228. font-size: 24upx;
  229. font-family: PingFang SC;
  230. font-weight: 500;
  231. color: #999999;
  232. line-height: 1;
  233. }
  234. .price-num{
  235. display: flex;
  236. align-items: center;
  237. justify-content: space-between;
  238. .price{
  239. display: flex;
  240. align-items: flex-end;
  241. .unit{
  242. font-size: 24upx;
  243. font-family: PingFang SC;
  244. font-weight: 500;
  245. color: #111111;
  246. line-height: 1.2;
  247. margin-right: 4upx;
  248. }
  249. .num{
  250. font-size: 32upx;
  251. font-family: PingFang SC;
  252. font-weight: 500;
  253. color: #111111;
  254. line-height: 1;
  255. }
  256. }
  257. .num{
  258. font-size: 24upx;
  259. font-family: PingFang SC;
  260. font-weight: 500;
  261. color: #999999;
  262. line-height: 1;
  263. }
  264. }
  265. }
  266. }
  267. .sub-total{
  268. height: 88upx;
  269. display: flex;
  270. align-items: center;
  271. justify-content: flex-end;
  272. .label{
  273. font-size: 24upx;
  274. font-family: PingFang SC;
  275. font-weight: 500;
  276. color: #999999;
  277. }
  278. .price{
  279. display: flex;
  280. align-items: flex-end;
  281. .unit{
  282. font-size: 24upx;
  283. font-family: PingFang SC;
  284. font-weight: 500;
  285. color: #FF6633;
  286. line-height: 1.2;
  287. margin-right: 4upx;
  288. }
  289. .num{
  290. font-size: 32upx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. color: #FF6633;
  294. line-height: 1;
  295. }
  296. }
  297. }
  298. }
  299. .points{
  300. height: 88upx;
  301. padding: 0 30upx;
  302. background: #FFFFFF;
  303. border-radius: 16upx;
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-between;
  307. .left{
  308. display: flex;
  309. align-items: center;
  310. image{
  311. width: 28upx;
  312. height: 28upx;
  313. margin-right: 20upx;
  314. }
  315. .text{
  316. font-size: 28upx;
  317. font-family: PingFang SC;
  318. font-weight: 500;
  319. color: #666666;
  320. }
  321. }
  322. .right{
  323. display: flex;
  324. align-items: center;
  325. .text{
  326. font-size: 28upx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #111111;
  330. }
  331. image{
  332. margin-left: 15upx;
  333. width: 14upx;
  334. height: 24upx;
  335. }
  336. }
  337. }
  338. .remarks{
  339. height: 88upx;
  340. padding: 0 30upx;
  341. background: #FFFFFF;
  342. border-radius: 16upx;
  343. margin-top: 20upx;
  344. display: flex;
  345. align-items: center;
  346. input{
  347. width: 100%;
  348. font-size: 28upx;
  349. font-family: PingFang SC;
  350. font-weight: 500;
  351. color: #000000;
  352. }
  353. .input{
  354. font-size: 28upx;
  355. font-family: PingFang SC;
  356. font-weight: 500;
  357. color: #999999;
  358. }
  359. }
  360. }
  361. .btn-foot{
  362. box-sizing: border-box;
  363. width: 100%;
  364. height: 121upx;
  365. background: #FFFFFF;
  366. padding: 16upx 30upx;
  367. display: flex;
  368. align-items: center;
  369. justify-content: flex-end;
  370. position: fixed;
  371. left: 0;
  372. bottom: 0;
  373. z-index: 99;
  374. .right{
  375. display: flex;
  376. align-items: center;
  377. .total{
  378. display: flex;
  379. align-items: flex-end;
  380. margin-right: 15upx;
  381. .label{
  382. font-size: 26upx;
  383. font-family: PingFang SC;
  384. font-weight: 500;
  385. color: #999999;
  386. line-height: 1.5;
  387. }
  388. .price{
  389. display: flex;
  390. align-items: flex-end;
  391. .unit{
  392. font-size: 28upx;
  393. font-family: PingFang SC;
  394. font-weight: bold;
  395. color: #FF6633;
  396. line-height: 1.2;
  397. margin-right: 10upx;
  398. }
  399. .num{
  400. font-size: 32upx;
  401. font-family: PingFang SC;
  402. font-weight: bold;
  403. color: #FF6633;
  404. line-height: 1;
  405. }
  406. }
  407. }
  408. .btn{
  409. margin-left: 10rpx;
  410. width: 180upx;
  411. height: 88upx;
  412. line-height: 88upx;
  413. text-align: center;
  414. font-size: 30upx;
  415. font-family: PingFang SC;
  416. font-weight: bold;
  417. color: #FFFFFF;
  418. background: #2BC7B9;
  419. border-radius: 44upx;
  420. position: relative;
  421. .share{
  422. display: inline-block;
  423. position: absolute;
  424. top: 0;
  425. left: 0;
  426. width: 100%;
  427. height: 100%rpx;
  428. opacity: 0;
  429. }
  430. }
  431. }
  432. }
  433. </style>