confirmCompanyOrder.vue 10.0 KB

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