orderPopup.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template name="orderPopup">
  2. <!--促销活动弹窗提示-->
  3. <view class="orderPopup">
  4. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  5. <view class="tui-popup-box clearfix">
  6. <template v-if="popupType == 1">
  7. <view class="tui-popup-title">修改收货人信息:</view>
  8. <view class="tui-scrollview-box">
  9. <view class="text-input b-b">
  10. <input class="input" type="text" v-model="receiverInfo.receiverName" placeholder="收货人姓名" placeholder-class="placeholder" />
  11. </view>
  12. <view class="text-input b-b">
  13. <input class="input" type="number" maxlength="11" v-model="receiverInfo.receiverPhone" placeholder="手机号码" placeholder-class="placeholder" />
  14. </view>
  15. <view class="text-input b-b">
  16. <input class="input" type="number" maxlength="11" v-model="receiverInfo.receiverPostCode" placeholder="邮政编码" placeholder-class="placeholder" />
  17. </view>
  18. <view class="text-input b-b" @click="showMulLinkageThreePicker">
  19. <text class="input">
  20. {{receiverInfo.receiverProvince}}{{receiverInfo.receiverCity}}{{receiverInfo.receiverRegion}}
  21. </text>
  22. <text class="iconfont icon-xiayibu"></text>
  23. </view>
  24. <view class="text-textarea b-b">
  25. <view class="textarea show" v-if="isShowInput">{{receiverInfo.receiverDetailAddress ? receiverInfo.receiverDetailAddress :'详细地址:如道路、门牌号、小区、楼房号、单元室等'}}</view>
  26. <textarea v-else
  27. class="textarea"
  28. type="text"
  29. v-model="receiverInfo.receiverDetailAddress"
  30. placeholder="详细地址:如道路、门牌号、小区、楼房号、单元室等"
  31. placeholder-class="placeholder"
  32. maxlength="50"
  33. @input="onTextareaInput"
  34. :class="isShowInput ? '':''"
  35. />
  36. </view>
  37. </view>
  38. </template>
  39. <template v-if="popupType == 2">
  40. <view class="tui-popup-title">修改费用信息:</view>
  41. <view class="tui-scrollview-box">
  42. <view class="information-view">
  43. <view class="view-num time">
  44. <view class="view-num-label">商品合计:</view>
  45. <view class="view-num-text">
  46. {{orderInfo.totalAmount}}
  47. </view>
  48. </view>
  49. <view class="view-num time">
  50. <view class="view-num-label">优惠券:</view>
  51. <view class="view-num-text">
  52. {{orderInfo.couponAmount}}
  53. </view>
  54. </view>
  55. </view>
  56. <view class="information-view">
  57. <view class="view-num time">
  58. <view class="view-num-label">积分抵扣:</view>
  59. <view class="view-num-text">
  60. {{orderInfo.integrationAmount}}
  61. </view>
  62. </view>
  63. <view class="view-num time">
  64. <view class="view-num-label">活动优惠:</view>
  65. <view class="view-num-text">
  66. {{orderInfo.promotionAmount}}
  67. </view>
  68. </view>
  69. </view>
  70. <view class="information-view">
  71. <view class="view-num time">
  72. <view class="view-num-label">运费:</view>
  73. <view class="view-num-text">
  74. <input class="input" type="number" maxlength="11" v-model="moneyInfo.freightAmount" placeholder-class="placeholder" />
  75. </view>
  76. </view>
  77. <view class="view-num time">
  78. <view class="view-num-label">折扣金额:</view>
  79. <view class="view-num-text">
  80. <input class="input" type="number" maxlength="11" v-model="moneyInfo.discountAmount" placeholder-class="placeholder" />
  81. </view>
  82. </view>
  83. </view>
  84. <view class="information-view">
  85. <view class="view-num time">
  86. <view class="view-num-label">订单总金额:</view>
  87. <view class="view-num-text">
  88. {{orderInfo.totalAmount+moneyInfo.freightAmount}}
  89. </view>
  90. </view>
  91. <view class="view-num time">
  92. <view class="view-num-label">应付款金额:</view>
  93. <view class="view-num-text">
  94. {{orderInfo.payAmount+moneyInfo.freightAmount-moneyInfo.discountAmount}}
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <template v-if="popupType == 3">
  101. <view class="tui-popup-title">订单备注:</view>
  102. <view class="tui-scrollview-box">
  103. <view class="text-textarea b-b">
  104. <textarea class="textarea"
  105. type="text"
  106. v-model="markInfo.note"
  107. placeholder="备注内容"
  108. placeholder-class="placeholder"
  109. maxlength="100"
  110. />
  111. </view>
  112. </view>
  113. </template>
  114. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  115. <view class="tui-flex-1">
  116. <view class="tui-button cancel" @click="hidePopup()">取消</view>
  117. <view class="tui-button confirm" @click="updataConfirm(popupType)">确定</view>
  118. </view>
  119. </view>
  120. </view>
  121. </tui-bottom-popup>
  122. <mpvue-city-picker ref="mpvueCityPicker"
  123. :pickerValueDefault="cityPickerValueDefault"
  124. @onCancel="onCancel"
  125. @onConfirm="onConfirm">
  126. </mpvue-city-picker>
  127. </view>
  128. </template>
  129. <script>
  130. import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker'
  131. import { mapState,mapMutations } from 'vuex'
  132. const defaultReceiverInfo = {
  133. orderId:null,
  134. receiverName:null,
  135. receiverPhone:null,
  136. receiverPostCode:null,
  137. receiverDetailAddress:null,
  138. receiverProvince:null,
  139. receiverCity:null,
  140. receiverRegion:null,
  141. status:null
  142. };
  143. export default{
  144. name:'orderPopup',
  145. components:{
  146. mpvueCityPicker
  147. },
  148. props:{
  149. orderInfo:{
  150. type:Object,
  151. },
  152. popupType:{
  153. type:Number,
  154. },
  155. },
  156. data() {
  157. return{
  158. isIphoneX:this.$store.state.isIphoneX,
  159. receiverInfo:Object.assign({},defaultReceiverInfo),
  160. cityPickerValueDefault: [0, 0, 1],
  161. isShowInput:false,
  162. popupShow:true,
  163. moneyInfo:{
  164. orderId:null,
  165. freightAmount:0,
  166. discountAmount:0,
  167. status:null,
  168. },
  169. markInfo:{note:null},
  170. }
  171. },
  172. filters: {
  173. NumFormat:function(text) {//处理金额
  174. return Number(text).toFixed(2);
  175. },
  176. formatAddress(order) {
  177. let str = order.receiverProvince;
  178. if (order.receiverCity != null) {
  179. str += " " + order.receiverCity;
  180. }
  181. str += " " + order.receiverRegion;
  182. str += " " + order.receiverDetailAddress;
  183. return str;
  184. },
  185. },
  186. created() {
  187. this.receiverInfo={
  188. orderId:this.orderInfo.id,
  189. receiverName:this.orderInfo.receiverName,
  190. receiverPhone:this.orderInfo.receiverPhone,
  191. receiverPostCode:this.orderInfo.receiverPostCode,
  192. receiverDetailAddress:this.orderInfo.receiverDetailAddress,
  193. receiverProvince:this.orderInfo.receiverProvince,
  194. receiverCity:this.orderInfo.receiverCity,
  195. receiverRegion:this.orderInfo.receiverRegion,
  196. status:this.orderInfo.status
  197. }
  198. this.moneyInfo.orderId=this.orderInfo.id;
  199. this.moneyInfo.freightAmount=this.orderInfo.freightAmount;
  200. this.moneyInfo.discountAmount=this.orderInfo.discountAmount;
  201. this.moneyInfo.status=this.orderInfo.status;
  202. },
  203. computed: {
  204. ...mapState(['hasLogin','isWxAuthorize'])
  205. },
  206. methods:{
  207. // 三级联动选择
  208. showMulLinkageThreePicker() {
  209. this.isShowInput = true
  210. this.$refs.mpvueCityPicker.show()
  211. },
  212. onConfirm(e) {
  213. console.log(e)
  214. this.isShowInput = false
  215. this.receiverInfo.receiverProvince=e.province;
  216. this.receiverInfo.receiverCity=e.city;
  217. this.receiverInfo.receiverRegion=e.region;
  218. },
  219. onCancel(e) {
  220. console.log(e)
  221. },
  222. hidePopup(){
  223. this.popupShow = false
  224. this.$parent.isPopupShow = false
  225. },
  226. updataConfirm(type){
  227. switch(this.popupType){
  228. case 1:
  229. this.$emit('popupTypeConfirm',this.receiverInfo)
  230. this.popupShow = false
  231. break;
  232. case 2:
  233. this.$emit('popupTypeConfirm',this.moneyInfo)
  234. this.popupShow = false
  235. break;
  236. case 3:
  237. let params = new URLSearchParams();
  238. params.append("id",this.markInfo.id);
  239. params.append("note",this.markInfo.note);
  240. params.append("status",this.order.status);
  241. this.$emit('popupTypeConfirm',params)
  242. this.popupShow = false
  243. break;
  244. }
  245. },
  246. },
  247. }
  248. </script>
  249. <style lang="scss">
  250. .tui-flex-1 {
  251. flex: 1;
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. }
  256. .tui-popup-title{
  257. line-height: 80rpx;
  258. font-size: $font-size-28;
  259. color: $text-color;
  260. padding: 0 24rpx;
  261. }
  262. .tui-popup-box {
  263. position: relative;
  264. box-sizing: border-box;
  265. min-height: 220rpx;
  266. padding:0 24rpx 0 24rpx;
  267. }
  268. .text-textarea{
  269. width: 100%;
  270. height: 216rpx;
  271. padding: 24rpx;
  272. background: #F7F7F7;
  273. .textarea{
  274. width: 100%;
  275. height: 100%;
  276. font-size: $font-size-28;
  277. color: $text-color;
  278. z-index: 1;
  279. }
  280. .textarea.hide{
  281. opacity: 0;
  282. }
  283. .textarea.show{
  284. color: #999999;
  285. }
  286. }
  287. .tui-scrollview-box{
  288. width: 100%;
  289. height: auto;
  290. float: left;
  291. box-sizing: border-box;
  292. .information-view{
  293. height: 60rpx;
  294. line-height: 60rpx;
  295. font-size: $font-size-28;
  296. color: $text-color;
  297. margin: 4rpx 0;
  298. display: flex;
  299. .view-num{
  300. flex: 1;
  301. color: $text-color;
  302. text-align: left;
  303. .view-num-label{
  304. text-align: left;
  305. float: left;
  306. color: $text-color;
  307. }
  308. .view-num-text{
  309. float: left;
  310. text-align: left;
  311. color: #999999;
  312. .input{
  313. width: 150rpx;
  314. height: 60rpx;
  315. border: 1px solid #EBEBEB;
  316. border-radius: 4rpx;
  317. padding: 0 15rpx;
  318. }
  319. }
  320. }
  321. .view-num.ord{
  322. color: $color-system;
  323. text-align: left;
  324. flex:3;
  325. font-weight: bold;
  326. }
  327. .view-num.time{
  328. color: #999999;
  329. }
  330. .bold{
  331. font-weight: bold;
  332. }
  333. .red{
  334. color: #FF2A2A;
  335. }
  336. .view-type{
  337. float: right;
  338. text-align: right;
  339. color: #FF2A2A;
  340. flex: 2;
  341. }
  342. .clipboard{
  343. width: 84rpx;
  344. height: 36rpx;
  345. background: #EBEBEB;
  346. text-align: center;
  347. font-size: $font-size-24;
  348. color: #999999;
  349. border-radius: 18rpx;
  350. line-height: 36rpx;
  351. display: inline-block;
  352. margin-left: 42rpx;
  353. }
  354. }
  355. }
  356. .tui-popup-btn {
  357. width: 100%;
  358. height: auto;
  359. float: left;
  360. margin-top: 24rpx;
  361. .tui-button{
  362. width: 40%;
  363. flex: 1;
  364. height: 70rpx;
  365. background: $btn-confirm;
  366. line-height: 70rpx;
  367. text-align: center;
  368. color: #FFFFFF;
  369. font-size: $font-size-26;
  370. border-radius: 8rpx;
  371. margin: 0 5%;
  372. &.cancel{
  373. background-color:#f6f6f6;
  374. color: #333333;
  375. }
  376. &.confirm{
  377. background-color:#4688fa;
  378. color: #FFFFFF;
  379. }
  380. }
  381. }
  382. </style>