confirmCompanyOrder.vue 10.0 KB

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