pageOne.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="page-itemOne">
  3. <u-row justify="space-between" customStyle="margin-bottom: 10px">
  4. <u-col span="3">
  5. <div class="page-itemOne-title">图片资料</div>
  6. </u-col>
  7. <u-col span="3.5">
  8. <u-button size="small" @click="copyAllImages"
  9. style="border-radius: 20rpx;border-color: #007AFF;color: #007AFF;">复制全部图片</u-button>
  10. </u-col>
  11. </u-row>
  12. <!-- 实物图卡片 -->
  13. <view class="card_wrap">
  14. <view class="card-title">实物图</view>
  15. <view class="image-upload-container">
  16. <view class="image-list">
  17. <view class="image-item" v-for="(item, index) in trueUploadList" :key="'truePic-' + index">
  18. <pic-comp :src="item.fileUrl"></pic-comp>
  19. <view class="delete-btn" @click="deleteImage(item)">×</view>
  20. </view>
  21. <view class="upload-btn" @click="uploadImage('truePic', currentReceipt.id)">
  22. <u-icon name="plus" size="40" color="#999"></u-icon>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 聊天记录卡片 -->
  28. <view class="card_wrap">
  29. <view class="card-title">聊天记录</view>
  30. <view class="image-upload-container">
  31. <view class="image-list">
  32. <view class="image-item" v-for="(item, index) in chatRecordsUploadList"
  33. :key="'chatRecords-' + index">
  34. <pic-comp :src="item.fileUrl"></pic-comp>
  35. <view class="delete-btn" @click="deleteImage(item)">×</view>
  36. </view>
  37. <view class="upload-btn" @click="uploadImage('chatRecords', currentReceipt.id)">
  38. <u-icon name="plus" size="40" color="#999"></u-icon>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 基本信息卡片 -->
  44. <view class="info-card">
  45. <view class="info-card-title">基本信息</view>
  46. <u-row class="info-row">
  47. <u-col span="6">
  48. <view class="info-label">发单人</view>
  49. <view class="info-value">{{ orderDetail.createNickName || '未填写' }}</view>
  50. </u-col>
  51. <u-col span="6">
  52. <view class="info-label">型号</view>
  53. <view class="info-value">{{ orderDetail.model || '未填写' }}</view>
  54. </u-col>
  55. </u-row>
  56. <u-row class="info-row">
  57. <u-col span="6">
  58. <view class="info-label">上门时间</view>
  59. <view class="info-value">{{ orderDetail.visitTime || '未填写' }}</view>
  60. </u-col>
  61. <u-col span="6">
  62. <view class="info-label">地址</view>
  63. <view class="info-value">{{ orderDetail.address || '未填写' }}</view>
  64. </u-col>
  65. </u-row>
  66. </view>
  67. <!-- 联系方式卡片 -->
  68. <view class="connect">
  69. <view class="connect-card phone-card" @click="handlePhoneClick">
  70. <u-icon name="phone" size="40" color="#07C160" style="margin-bottom: 10rpx;"></u-icon>
  71. <view class="connect-title">电话</view>
  72. <!-- 小红点 -->
  73. <view v-if="orderDetail.phone" class="red-dot"></view>
  74. </view>
  75. <view class="connect-card wechat-card" @click="handleWechatClick">
  76. <u-icon name="chat" size="40" color="#07C160" style="margin-bottom: 10rpx;"></u-icon>
  77. <view class="connect-title">微信</view>
  78. <!-- 小红点 -->
  79. <view v-if="orderDetail.wechat" class="red-dot"></view>
  80. </view>
  81. </view>
  82. <u-button @click="handleNextClick" type="primary" size="middle" style="border-radius: 20rpx;">下一步</u-button>
  83. </view>
  84. </template>
  85. <script>
  86. import picComp from './picComp.vue'
  87. import imgUploadAndDownLoad from '../mixin/imgUploadAndDownLoad.js'
  88. export default {
  89. mixins: [imgUploadAndDownLoad],
  90. props: {
  91. orderDetail: {
  92. type: Object,
  93. default: () => { },
  94. },
  95. orderId: {
  96. type: String,
  97. default: '',
  98. },
  99. currentReceipt: {
  100. type: Object,
  101. default: () => { },
  102. },
  103. },
  104. components: {
  105. picComp
  106. },
  107. data() {
  108. return {
  109. //展示的图片列表
  110. trueUploadList: [],
  111. chatRecordsUploadList: [],
  112. // 待绑定的图片列表
  113. bindList: [],
  114. }
  115. },
  116. watch: {
  117. // 监听 props 变化,触发请求
  118. orderDetail: {
  119. handler(newVal) {
  120. if (newVal) {
  121. console.log('orderDetail 变化了', newVal);
  122. }
  123. }
  124. },
  125. currentReceipt: {
  126. handler(newVal) {
  127. console.log('currentReceipt 变化了', newVal);
  128. if (newVal) {
  129. //刷新图片列表
  130. setTimeout(() => {
  131. this.getList('2', '1', newVal.id, this.orderDetail.itemBrand);
  132. this.getList('2', '2', newVal.id, this.orderDetail.itemBrand);
  133. }, 100)
  134. }
  135. }
  136. },
  137. },
  138. methods: {
  139. // 电话卡片点击事件
  140. handlePhoneClick() {
  141. console.log('电话卡片被点击', '电话号码:', this.orderDetail.phone)
  142. if (this.orderDetail.phone) {
  143. //拨打电话
  144. // uni.makePhoneCall({
  145. // phoneNumber: this.orderDetail.phone,
  146. // success: () => {
  147. // this.$store.commit("call/SET_FORM", {
  148. // clueId: this.orderDetail.clueId,
  149. // type: "3",
  150. // callee: this.orderDetail.phone,
  151. // });
  152. // },
  153. // });
  154. //先暂时复制电话号码
  155. uni.setClipboardData({
  156. data: this.orderDetail.phone,
  157. success: () => {
  158. uni.showToast({
  159. title: '电话号码已复制',
  160. icon: 'none'
  161. })
  162. }
  163. })
  164. } else {
  165. uni.showToast({
  166. title: '该订单暂时没有电话号码',
  167. icon: 'none'
  168. })
  169. }
  170. },
  171. // 微信卡片点击事件
  172. handleWechatClick() {
  173. console.log('微信卡片被点击', '微信号:', this.orderDetail.wechat)
  174. if (this.orderDetail.wechat) {
  175. //复制微信号
  176. uni.setClipboardData({
  177. data: this.orderDetail.wechat,
  178. success: () => {
  179. uni.showToast({
  180. title: '微信号已复制',
  181. icon: 'none'
  182. })
  183. }
  184. })
  185. } else {
  186. uni.showToast({
  187. title: '该订单暂时没有微信号',
  188. icon: 'none'
  189. })
  190. }
  191. },
  192. // 下一步
  193. handleNextClick() {
  194. // 校验表单
  195. // if (!this.form.truePic.length) {
  196. // uni.showToast({
  197. // title: '请上传实物图',
  198. // icon: 'none'
  199. // })
  200. // return
  201. // }
  202. // if (!this.form.chatRecords.length) {
  203. // uni.showToast({
  204. // title: '请上传聊天记录',
  205. // icon: 'none'
  206. // })
  207. // return
  208. // }
  209. this.$emit('handleNextClick', {
  210. nowPage: 'formOne',
  211. form: this.form,
  212. })
  213. },
  214. //一键复制
  215. copyAllImages() {
  216. // 合并所有图片
  217. const allImages = [...this.trueUploadList, ...this.chatRecordsUploadList];
  218. //取出所有图的url
  219. const allUrls = allImages.map(item => item.fileUrl);
  220. console.log('所有图片:', allUrls)
  221. console.log('合并后的图片列表:', allUrls)
  222. if (allUrls.length > 0) {
  223. // 复制到剪贴板
  224. uni.setClipboardData({
  225. data: JSON.stringify(allUrls),
  226. success: () => {
  227. uni.showToast({
  228. title: '所有图片已复制',
  229. icon: 'none'
  230. })
  231. }
  232. })
  233. } else {
  234. uni.showToast({
  235. title: '没有图片可复制',
  236. icon: 'none'
  237. })
  238. }
  239. },
  240. },
  241. }
  242. </script>
  243. <style scoped lang="scss">
  244. // 导入公共样式
  245. @import './common.scss';
  246. // 主样式
  247. .page-itemOne {
  248. @extend .page-container;
  249. }
  250. .page-itemOne-title {
  251. @include font-styles($size: title, $weight: bold, $color: primary);
  252. }
  253. .page-itemOne-form {
  254. @include font-styles($size: tiny, $weight: semi-bold, $color: secondary);
  255. text-wrap: nowrap;
  256. }
  257. .image-upload-container {
  258. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  259. }
  260. .image-list {
  261. display: flex;
  262. flex-wrap: wrap;
  263. gap: 20rpx;
  264. }
  265. .image-item {
  266. position: relative;
  267. width: 200rpx;
  268. height: 200rpx;
  269. box-sizing: border-box;
  270. }
  271. .delete-btn {
  272. position: absolute;
  273. top: -10rpx;
  274. right: -10rpx;
  275. width: 40rpx;
  276. height: 40rpx;
  277. background-color: #ff4d4f;
  278. color: #fff;
  279. border-radius: 50%;
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. @include font-styles($size: tiny, $weight: bold);
  284. z-index: 10;
  285. }
  286. .upload-btn {
  287. width: 200rpx;
  288. height: 200rpx;
  289. border: 8rpx dashed #ddd;
  290. border-radius: 30rpx;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. background-color: #f9f9f9;
  295. box-sizing: border-box;
  296. }
  297. /* 基本信息卡片样式 */
  298. .info-card {
  299. @include card;
  300. margin-top: 20rpx;
  301. margin-bottom: 20rpx;
  302. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  303. &:hover {
  304. @include shadow(2);
  305. }
  306. }
  307. .info-card-title {
  308. @include font-styles($size: title, $weight: bold, $color: primary);
  309. margin-bottom: 25rpx;
  310. padding-bottom: 15rpx;
  311. border-bottom: 1rpx solid map-get($colors, border);
  312. }
  313. .info-row {
  314. margin-bottom: 20rpx;
  315. }
  316. .info-label {
  317. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  318. margin-bottom: 8rpx;
  319. }
  320. .info-value {
  321. @include font-styles($size: small, $weight: regular, $color: secondary, $line-height: small);
  322. word-break: break-all;
  323. }
  324. /* 联系方式卡片样式 */
  325. .connect {
  326. display: flex;
  327. justify-content: space-between;
  328. margin: 20rpx 0;
  329. gap: 20rpx;
  330. }
  331. .connect-card {
  332. flex: 1;
  333. @include card;
  334. padding: 30rpx;
  335. display: flex;
  336. flex-direction: column;
  337. align-items: center;
  338. box-sizing: border-box;
  339. position: relative;
  340. &:hover {
  341. @include shadow(2);
  342. }
  343. }
  344. .connect-title {
  345. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  346. margin-bottom: 8rpx;
  347. }
  348. .connect-value {
  349. @include font-styles($size: small, $weight: medium, $color: secondary);
  350. }
  351. /* 小红点样式 */
  352. .red-dot {
  353. position: absolute;
  354. top: 15rpx;
  355. right: 15rpx;
  356. width: 25rpx;
  357. height: 25rpx;
  358. background-color: #ff4d4f;
  359. border-radius: 50%;
  360. box-shadow: 0 0 4rpx rgba(255, 77, 79, 0.3);
  361. }
  362. </style>